aboutsummaryrefslogtreecommitdiff
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
commitf62cc9f9e5ddd95adcb0f7317ef4458bbdbebffd (patch)
tree486a24a6b5976080062188d23a1cf6b9ad49b875
parent9c636fe6f2e8dfb7502e3d60dfe29f3cfd5b19e6 (diff)
Make the "KnownZero ^ TypeMask" computation just once.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35276 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 6d4a8ddb26..9713bc8a37 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/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.