summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-05-06 18:54:59 +0000
committerChris Lattner <sabre@nondot.org>2002-05-06 18:54:59 +0000
commita6e047a5d9db630743597c611ebd8997681808b1 (patch)
tree0ed07a375b12d1e5acb66c5279178cfd39c76188 /llvm
parentcfa675c14226ac4c94ec55ee28d63da687c40095 (diff)
downloadbcm5719-llvm-a6e047a5d9db630743597c611ebd8997681808b1.tar.gz
bcm5719-llvm-a6e047a5d9db630743597c611ebd8997681808b1.zip
Only do masking for unsigned values!
llvm-svn: 2504
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 5b9f31892ea..fda64ab49ad 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -249,16 +249,15 @@ static Constant *getMaxValue(const Type *Ty) {
if (Ty == Type::BoolTy)
return ConstantBool::True;
- // Calculate -1 casted to the right type...
- unsigned TypeBits = Ty->getPrimitiveSize()*8;
- uint64_t Val = (uint64_t)-1LL; // All ones
- Val >>= 64-TypeBits; // Shift out unwanted 1 bits...
-
if (Ty->isSigned())
- return ConstantSInt::get(Ty, (int64_t)Val);
- else if (Ty->isUnsigned())
+ return ConstantSInt::get(Ty, -1);
+ else if (Ty->isUnsigned()) {
+ // Calculate -1 casted to the right type...
+ unsigned TypeBits = Ty->getPrimitiveSize()*8;
+ uint64_t Val = (uint64_t)-1LL; // All ones
+ Val >>= 64-TypeBits; // Shift out unwanted 1 bits...
return ConstantUInt::get(Ty, Val);
-
+ }
return 0;
}
OpenPOWER on IntegriCloud