summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorZhou Sheng <zhousheng00@gmail.com>2007-03-23 03:13:21 +0000
committerZhou Sheng <zhousheng00@gmail.com>2007-03-23 03:13:21 +0000
commit0900993ebc6e260e089465f8072c19c24174c4f0 (patch)
tree1a7467819c3ccfd1780c94bdb3eda9daba74a2b5 /llvm
parent755f04b5d7c42c46b29680cf326a71d1c8a7992f (diff)
downloadbcm5719-llvm-0900993ebc6e260e089465f8072c19c24174c4f0.tar.gz
bcm5719-llvm-0900993ebc6e260e089465f8072c19c24174c4f0.zip
Make the "KnownZero ^ TypeMask" computation just once.
llvm-svn: 35276
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 6d4a8ddb265..9713bc8a37d 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -7136,9 +7136,10 @@ Instruction *InstCombiner::commonIntCastTransforms(CastInst &CI) {
if (pred != ICmpInst::ICMP_NE && pred != ICmpInst::ICMP_EQ)
break;
- if ((KnownZero^TypeMask).isPowerOf2()) { // Exactly 1 possible 1?
+ APInt KnownZeroMask(KnownZero ^ TypeMask);
+ if (KnownZeroMask.isPowerOf2()) { // Exactly 1 possible 1?
bool isNE = pred == ICmpInst::ICMP_NE;
- if (Op1CV != 0 && (Op1CV != (KnownZero^TypeMask))) {
+ if (Op1CV != 0 && (Op1CV != KnownZeroMask)) {
// (X&4) == 2 --> false
// (X&4) != 2 --> true
Constant *Res = ConstantInt::get(Type::Int1Ty, isNE);
@@ -7146,7 +7147,7 @@ Instruction *InstCombiner::commonIntCastTransforms(CastInst &CI) {
return ReplaceInstUsesWith(CI, Res);
}
- unsigned ShiftAmt = (KnownZero^TypeMask).logBase2();
+ unsigned ShiftAmt = KnownZeroMask.logBase2();
Value *In = Op0;
if (ShiftAmt) {
// Perform a logical shr by shiftamt.
OpenPOWER on IntegriCloud