Changes because the Terminator::getSuccessor function now FAILS if successor
IDX is out of range instead of returning null.
llvm-svn: 2332
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp
index fd3daa5..51a827d 100644
--- a/llvm/lib/Transforms/Scalar/SCCP.cpp
+++ b/llvm/lib/Transforms/Scalar/SCCP.cpp
@@ -397,8 +397,8 @@
void SCCP::visitSwitchInst(SwitchInst *SI) {
InstVal &SCValue = getValueState(SI->getCondition());
if (SCValue.isOverdefined()) { // Overdefined condition? All dests are exe
- for(unsigned i = 0; BasicBlock *Succ = SI->getSuccessor(i); ++i)
- markExecutable(Succ);
+ for(unsigned i = 0, E = SI->getNumSuccessors(); i != E; ++i)
+ markExecutable(SI->getSuccessor(i));
} else if (SCValue.isConstant()) {
Constant *CPV = SCValue.getConstant();
// Make sure to skip the "default value" which isn't a value