aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/SCCP.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Scalar/SCCP.cpp')
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index 8b59e19..5bb75c7 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -408,10 +408,10 @@ void SCCP::UpdateInstruction(Instruction *I) {
markExecutable(Succ);
} else if (SCValue.isConstant()) {
ConstPoolVal *CPV = SCValue.getConstant();
- for (SwitchInst::dest_iterator I = SI->dest_begin(), E = SI->dest_end();
- I != E; ++I) {
- if (I->first->equals(CPV)) { // Found the right branch...
- markExecutable(I->second);
+ // Make sure to skip the "default value" which isn't a value
+ for (unsigned i = 1, E = SI->getNumSuccessors(); i != E; ++i) {
+ if (SI->getSuccessorValue(i)->equals(CPV)) {// Found the right branch...
+ markExecutable(SI->getSuccessor(i));
return;
}
}