aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-10-16 18:09:41 +0000
committerChris Lattner <sabre@nondot.org>2004-10-16 18:09:41 +0000
commit5d356a7c82046b5610c59545b6fbc82ca5e5da76 (patch)
treeeb80f52d56fde9dc20bf242aa08e97ef32f0087c
parentb2f59a2af7a94acf85c8b18af5c63f155df94f84 (diff)
Handle undef values as undefined on the constant lattice
ignore unreachable instructions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17044 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index 7921a235d2..aa57159b6e 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -174,9 +174,11 @@ private:
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 @@ private:
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); }