summaryrefslogtreecommitdiffstats
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
commit646354bae1a7dfc790ba9002b2beacc3ffd3f266 (patch)
tree67e5892d3f45d7e0a6b1b1abed2ea2e6d5faa048
parent6ac3ef950d7d39fd70a8e4d348db7c9ccbad4190 (diff)
downloadbcm5719-llvm-646354bae1a7dfc790ba9002b2beacc3ffd3f266.tar.gz
bcm5719-llvm-646354bae1a7dfc790ba9002b2beacc3ffd3f266.zip
Handle undef values as undefined on the constant lattice
ignore unreachable instructions llvm-svn: 17044
-rw-r--r--llvm/lib/Transforms/Scalar/SCCP.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp
index 7921a235d26..aa57159b6e3 100644
--- a/llvm/lib/Transforms/Scalar/SCCP.cpp
+++ b/llvm/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); }
OpenPOWER on IntegriCloud