aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/ConstantRange.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-04 02:46:44 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-04 02:46:44 +0000
commit575d95ce373f1e405e6c27ce8d9f244bba3bdd0d (patch)
tree7dbef38ce90d354f1eebb43931b7ecc2d12cf74e /lib/Support/ConstantRange.cpp
parent56667123b7f6d6dda8b4dc178c8be4192299ae6e (diff)
downloadexternal_llvm-575d95ce373f1e405e6c27ce8d9f244bba3bdd0d.zip
external_llvm-575d95ce373f1e405e6c27ce8d9f244bba3bdd0d.tar.gz
external_llvm-575d95ce373f1e405e6c27ce8d9f244bba3bdd0d.tar.bz2
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/Support/ConstantRange.cpp')
-rw-r--r--lib/Support/ConstantRange.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/Support/ConstantRange.cpp b/lib/Support/ConstantRange.cpp
index 3475c44..309edb3 100644
--- a/lib/Support/ConstantRange.cpp
+++ b/lib/Support/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));
}