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

Chris Lattner lattner at cs.uiuc.edu
Sat Oct 16 11:09:52 PDT 2004



Changes in directory llvm/lib/Transforms/Scalar:

SCCP.cpp updated: 1.103 -> 1.104
---
Log message:

Handle undef values as undefined on the constant lattice
ignore unreachable instructions


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

Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.103 llvm/lib/Transforms/Scalar/SCCP.cpp:1.104
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.103	Sat Oct  9 14:30:36 2004
+++ llvm/lib/Transforms/Scalar/SCCP.cpp	Sat Oct 16 13:09:41 2004
@@ -174,9 +174,11 @@
   inline InstVal &getValueState(Value *V) {
     hash_map<Value*, InstVal>::iterator I = ValueState.find(V);
     if (I != ValueState.end()) return I->second;  // Common case, in the map
-      
-    if (Constant *CPV = dyn_cast<Constant>(V)) {  // Constants are constant
-      ValueState[CPV].markConstant(CPV);
+
+    if (isa<UndefValue>(V)) {
+      // Nothing to do, remain undefined.
+    } else if (Constant *CPV = dyn_cast<Constant>(V)) {
+      ValueState[CPV].markConstant(CPV);          // Constants are constant
     } else if (isa<Argument>(V)) {                // Arguments are overdefined
       ValueState[V].markOverdefined();
     }
@@ -236,6 +238,7 @@
     visitTerminatorInst(I);
   }
   void visitUnwindInst    (TerminatorInst &I) { /*returns void*/ }
+  void visitUnreachableInst(TerminatorInst &I) { /*returns void*/ }
   void visitAllocationInst(Instruction &I) { markOverdefined(&I); }
   void visitVANextInst    (Instruction &I) { markOverdefined(&I); }
   void visitVAArgInst     (Instruction &I) { markOverdefined(&I); }






More information about the llvm-commits mailing list