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

Chris Lattner lattner at cs.uiuc.edu
Mon Jan 12 13:10:09 PST 2004


Changes in directory llvm/lib/Transforms/Scalar:

SCCP.cpp updated: 1.87 -> 1.88

---
Log message:

Don't use ConstantExpr::getShift anymore


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

Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.87 llvm/lib/Transforms/Scalar/SCCP.cpp:1.88
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.87	Mon Jan 12 11:43:40 2004
+++ llvm/lib/Transforms/Scalar/SCCP.cpp	Mon Jan 12 13:08:43 2004
@@ -596,19 +596,11 @@
               Result.markOverdefined();
               break;  // Cannot fold this operation over the PHI nodes!
             } else if (In1.isConstant() && In2.isConstant()) {
-              Constant *Val = 0;
-              if (isa<BinaryOperator>(I))
-                Val = ConstantExpr::get(I.getOpcode(), In1.getConstant(),
-                                           In2.getConstant());
-              else {
-                assert(isa<ShiftInst>(I) &&
-                       "Can only handle binops and shifts here!");
-                Val = ConstantExpr::getShift(I.getOpcode(), In1.getConstant(),
-                                             In2.getConstant());
-              }
+              Constant *V = ConstantExpr::get(I.getOpcode(), In1.getConstant(),
+                                              In2.getConstant());
               if (Result.isUndefined())
-                Result.markConstant(Val);
-              else if (Result.isConstant() && Result.getConstant() != Val) {
+                Result.markConstant(V);
+              else if (Result.isConstant() && Result.getConstant() != V) {
                 Result.markOverdefined();
                 break;
               }
@@ -652,17 +644,8 @@
 
     markOverdefined(IV, &I);
   } else if (V1State.isConstant() && V2State.isConstant()) {
-    Constant *Result = 0;
-    if (isa<BinaryOperator>(I))
-      Result = ConstantExpr::get(I.getOpcode(), V1State.getConstant(),
-                                 V2State.getConstant());
-    else {
-      assert (isa<ShiftInst>(I) && "Can only handle binops and shifts here!");
-      Result = ConstantExpr::getShift(I.getOpcode(), V1State.getConstant(),
-                                      V2State.getConstant());
-    }
-      
-    markConstant(IV, &I, Result);      // This instruction constant folds!
+    markConstant(IV, &I, ConstantExpr::get(I.getOpcode(), V1State.getConstant(),
+                                           V2State.getConstant()));
   }
 }
 





More information about the llvm-commits mailing list