From ecc4d6088dcd6ef94fd73ee17d79c9d3a54ded92 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sat, 29 Apr 2017 17:46:13 +0000 Subject: [PATCH] [ConstantRange] Replace getMaxValue+zext with getLowBitsSet. Replace zero-init+setBit with getOneBitSet. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301752 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/ConstantRange.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/IR/ConstantRange.cpp b/lib/IR/ConstantRange.cpp index 754844e371a..8b595a69ad3 100644 --- a/lib/IR/ConstantRange.cpp +++ b/lib/IR/ConstantRange.cpp @@ -569,9 +569,8 @@ ConstantRange ConstantRange::truncate(uint32_t DstTySize) const { if (isFullSet()) return ConstantRange(DstTySize, /*isFullSet=*/true); - APInt MaxValue = APInt::getMaxValue(DstTySize).zext(getBitWidth()); - APInt MaxBitValue(getBitWidth(), 0); - MaxBitValue.setBit(DstTySize); + APInt MaxValue = APInt::getLowBitsSet(getBitWidth(), DstTySize); + APInt MaxBitValue = APInt::getOneBitSet(getBitWidth(), DstTySize); APInt LowerDiv(Lower), UpperDiv(Upper); ConstantRange Union(DstTySize, /*isFullSet=*/false); -- 2.50.1