diff options
Diffstat (limited to 'lib/Analysis/ConstantRange.cpp')
-rw-r--r-- | lib/Analysis/ConstantRange.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/Analysis/ConstantRange.cpp b/lib/Analysis/ConstantRange.cpp index 3475c444dc..309edb3f50 100644 --- a/lib/Analysis/ConstantRange.cpp +++ b/lib/Analysis/ConstantRange.cpp @@ -293,14 +293,9 @@ ConstantRange ConstantRange::zeroExtend(const Type *Ty) const { Constant *Lower = getLower(); Constant *Upper = getUpper(); - if (Lower->getType()->isInteger() && !Lower->getType()->isUnsigned()) { - // Ensure we are doing a ZERO extension even if the input range is signed. - Lower = ConstantExpr::getCast(Lower, Ty->getUnsignedVersion()); - Upper = ConstantExpr::getCast(Upper, Ty->getUnsignedVersion()); - } - return ConstantRange(ConstantExpr::getCast(Lower, Ty), - ConstantExpr::getCast(Upper, Ty)); + return ConstantRange(ConstantExpr::getCast(Instruction::ZExt, Lower, Ty), + ConstantExpr::getCast(Instruction::ZExt, Upper, Ty)); } /// truncate - Return a new range in the specified integer type, which must be @@ -314,8 +309,9 @@ ConstantRange ConstantRange::truncate(const Type *Ty) const { if (isFullSet() || getSetSize() >= Size) return ConstantRange(getType()); - return ConstantRange(ConstantExpr::getCast(getLower(), Ty), - ConstantExpr::getCast(getUpper(), Ty)); + return ConstantRange( + ConstantExpr::getCast(Instruction::Trunc, getLower(), Ty), + ConstantExpr::getCast(Instruction::Trunc, getUpper(), Ty)); } |