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

Zhou Sheng zhousheng00 at gmail.com
Thu Mar 29 22:45:46 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.709 -> 1.710
---
Log message:

Use APInt operation instead of ConstantExpr::getXX.


---
Diffs of the changes:  (+6 -6)

 InstructionCombining.cpp |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.709 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.710
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.709	Thu Mar 29 03:15:12 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Fri Mar 30 00:45:18 2007
@@ -5658,9 +5658,9 @@
               BinaryOperator::create(Op0BO->getOpcode(), YS, V1,
                                      Op0BO->getOperand(1)->getName());
             InsertNewInstBefore(X, I);  // (X + (Y << C))
-            Constant *C2 = ConstantInt::getAllOnesValue(X->getType());
-            C2 = ConstantExpr::getShl(C2, Op1);
-            return BinaryOperator::createAnd(X, C2);
+            uint32_t Op1Val = Op1->getZExtValue();
+            return BinaryOperator::createAnd(X, ConstantInt::get(
+                       APInt::getHighBitsSet(TypeBits, TypeBits-Op1Val)));
           }
           
           // Turn (Y + ((X >> C) & CC)) << C  ->  ((X & (CC << C)) + (Y << C))
@@ -5697,9 +5697,9 @@
               BinaryOperator::create(Op0BO->getOpcode(), V1, YS,
                                      Op0BO->getOperand(0)->getName());
             InsertNewInstBefore(X, I);  // (X + (Y << C))
-            Constant *C2 = ConstantInt::getAllOnesValue(X->getType());
-            C2 = ConstantExpr::getShl(C2, Op1);
-            return BinaryOperator::createAnd(X, C2);
+            uint32_t Op1Val = Op1->getZExtValue();
+            return BinaryOperator::createAnd(X, ConstantInt::get(
+                       APInt::getHighBitsSet(TypeBits, TypeBits-Op1Val)));
           }
           
           // Turn (((X >> C)&CC) + Y) << C  ->  (X + (Y << C)) & (CC << C)






More information about the llvm-commits mailing list