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 | 1a06389f06c07a8e1005c038f0494269267c770f (patch) | |
| tree | 60a180f13fb821a8ade6ee6bad4bdd3762d01098 /llvm/lib/Analysis/ConstantRange.cpp | |
| parent | c4dacf24553383b975de34ec44485141c47863df (diff) | |
| download | bcm5719-llvm-1a06389f06c07a8e1005c038f0494269267c770f.tar.gz bcm5719-llvm-1a06389f06c07a8e1005c038f0494269267c770f.zip | |
Change inferred casts to explicit casts.
llvm-svn: 32165
Diffstat (limited to 'llvm/lib/Analysis/ConstantRange.cpp')
| -rw-r--r-- | llvm/lib/Analysis/ConstantRange.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/ConstantRange.cpp b/llvm/lib/Analysis/ConstantRange.cpp index 3475c444dc8..309edb3f50b 100644 --- a/llvm/lib/Analysis/ConstantRange.cpp +++ b/llvm/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)); } |

