Move the code that uses SCEVs prior to creating the new loops.
[oota-llvm.git] / lib / Analysis / SparsePropagation.cpp
index 035bceaf2706425e25dac11a974000435c13a6e4..c819666ee44445780b975edd2810b3bba4f253f6 100644 (file)
@@ -194,8 +194,8 @@ void SparseSolver::getFeasibleSuccessors(TerminatorInst &TI,
     Succs.assign(TI.getNumSuccessors(), true);
     return;
   }
-  
-  Succs[SI.findCaseValue(cast<ConstantInt>(C))] = true;
+  SwitchInst::CaseIt Case = SI.findCaseValue(cast<ConstantInt>(C));
+  Succs[Case.getSuccessorIndex()] = true;
 }