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

Zhou Sheng zhousheng00 at gmail.com
Wed Apr 18 22:39:35 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.748 -> 1.749
ScalarReplAggregates.cpp updated: 1.84 -> 1.85
---
Log message:

Make use of ConstantInt::isZero instead of ConstantInt::isNullValue.


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

 InstructionCombining.cpp |    8 ++++----
 ScalarReplAggregates.cpp |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.748 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.749
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.748	Sat Apr 14 20:02:18 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Thu Apr 19 00:39:12 2007
@@ -2224,7 +2224,7 @@
       // 0 - (X sdiv C)  -> (X sdiv -C)
       if (Op1I->getOpcode() == Instruction::SDiv)
         if (ConstantInt *CSI = dyn_cast<ConstantInt>(Op0))
-          if (CSI->isNullValue())
+          if (CSI->isZero())
             if (Constant *DivRHS = dyn_cast<Constant>(Op1I->getOperand(1)))
               return BinaryOperator::createSDiv(Op1I->getOperand(0),
                                                ConstantExpr::getNeg(DivRHS));
@@ -2268,7 +2268,7 @@
   switch (pred) {
     case ICmpInst::ICMP_SLT: 
       // True if LHS s< RHS and RHS == 0
-      return RHS->isNullValue();
+      return RHS->isZero();
     case ICmpInst::ICMP_SLE: 
       // True if LHS s<= RHS and RHS == -1
       return RHS->isAllOnesValue();
@@ -2303,7 +2303,7 @@
             return BinaryOperator::createMul(SI->getOperand(0),
                                              ConstantExpr::getShl(CI, ShOp));
 
-      if (CI->isNullValue())
+      if (CI->isZero())
         return ReplaceInstUsesWith(I, Op1);  // X * 0  == 0
       if (CI->equalsInt(1))                  // X * 1  == X
         return ReplaceInstUsesWith(I, Op0);
@@ -8131,7 +8131,7 @@
     // input pointer, it just changes its type.
     if (AllZeroIndices) {
       if (ConstantInt *CI = dyn_cast<ConstantInt>(GEP.getOperand(i)))
-        AllZeroIndices = CI->isNullValue();
+        AllZeroIndices = CI->isZero();
       else
         AllZeroIndices = false;
     }


Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.84 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.85
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.84	Wed Apr 11 10:45:25 2007
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp	Thu Apr 19 00:39:12 2007
@@ -834,7 +834,7 @@
       } else if (GEP->getNumOperands() == 3 && 
                  isa<ConstantInt>(GEP->getOperand(1)) &&
                  isa<ConstantInt>(GEP->getOperand(2)) &&
-                 cast<Constant>(GEP->getOperand(1))->isNullValue()) {
+                 cast<ConstantInt>(GEP->getOperand(1))->isZero()) {
         // We are stepping into an element, e.g. a structure or an array:
         // GEP Ptr, int 0, uint C
         const Type *AggTy = PTy->getElementType();






More information about the llvm-commits mailing list