diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-12-04 02:46:44 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-12-04 02:46:44 +0000 |
commit | 575d95ce373f1e405e6c27ce8d9f244bba3bdd0d (patch) | |
tree | 7dbef38ce90d354f1eebb43931b7ecc2d12cf74e /lib/Analysis/ConstantRange.cpp | |
parent | 56667123b7f6d6dda8b4dc178c8be4192299ae6e (diff) |
Change inferred casts to explicit casts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32165 91177308-0d34-0410-b5e6-96231b3b80d8
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)); } |