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

Jim Laskey jlaskey at apple.com
Tue Jan 2 16:11:18 PST 2007



Changes in directory llvm/lib/Transforms/Scalar:

SCCP.cpp updated: 1.145 -> 1.146
---
Log message:

Vectors are not supported by ConstantInt::getAllOnesValue.

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

 SCCP.cpp |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)


Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.145 llvm/lib/Transforms/Scalar/SCCP.cpp:1.146
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.145	Sun Dec 31 16:26:06 2006
+++ llvm/lib/Transforms/Scalar/SCCP.cpp	Tue Jan  2 18:11:03 2007
@@ -88,6 +88,7 @@
     if (LatticeValue != constant) {
       if (LatticeValue == undefined) {
         LatticeValue = constant;
+        assert(V && "Marking constant with NULL");
         ConstantVal = V;
       } else {
         assert(LatticeValue == forcedconstant && 
@@ -699,14 +700,15 @@
           // Could annihilate value.
           if (I.getOpcode() == Instruction::And)
             markConstant(IV, &I, Constant::getNullValue(I.getType()));
-          else
-            markConstant(IV, &I, ConstantInt::getAllOnesValue(I.getType()));
+          else if (Constant *Ones = ConstantInt::getAllOnesValue(I.getType())) {
+            markConstant(IV, &I, Ones);
+          }
           return;
         } else {
           if (I.getOpcode() == Instruction::And) {
             if (NonOverdefVal->getConstant()->isNullValue()) {
               markConstant(IV, &I, NonOverdefVal->getConstant());
-              return;      // X or 0 = -1
+              return;      // X and 0 = 0
             }
           } else {
             if (ConstantIntegral *CI =
@@ -1231,8 +1233,11 @@
 
       case Instruction::Or:
         // undef | X -> -1.   X could be -1.
-        markForcedConstant(LV, I, ConstantInt::getAllOnesValue(ITy));
-        return true;
+        if (Constant *Ones = ConstantInt::getAllOnesValue(ITy)) {
+          markForcedConstant(LV, I, Ones);
+          return true;
+        }
+        break;
 
       case Instruction::SDiv:
       case Instruction::UDiv:






More information about the llvm-commits mailing list