[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Zhou Sheng zhousheng00 at gmail.com
Thu Mar 22 20:13:48 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.676 -> 1.677
---
Log message:

Make the "KnownZero ^ TypeMask" computation just once.


---
Diffs of the changes:  (+4 -3)

 InstructionCombining.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.676 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.677
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.676	Thu Mar 22 21:39:25 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Thu Mar 22 22:13:21 2007
@@ -7136,9 +7136,10 @@
         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 @@
             return ReplaceInstUsesWith(CI, Res);
           }
           
-          unsigned ShiftAmt = (KnownZero^TypeMask).logBase2();
+          unsigned ShiftAmt = KnownZeroMask.logBase2();
           Value *In = Op0;
           if (ShiftAmt) {
             // Perform a logical shr by shiftamt.






More information about the llvm-commits mailing list