summaryrefslogtreecommitdiff
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.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index 4274b509d2..8d0b86606a 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -564,7 +564,7 @@ void SCCPSolver::getFeasibleSuccessors(TerminatorInst &TI,
return;
}
- Succs[SI->resolveSuccessorIndex(SI->findCaseValue(CI))] = true;
+ Succs[SI->findCaseValue(CI).getSuccessorIndex()] = true;
return;
}
@@ -623,14 +623,7 @@ bool SCCPSolver::isEdgeFeasible(BasicBlock *From, BasicBlock *To) {
if (CI == 0)
return !SCValue.isUndefined();
- // Make sure to skip the "default value" which isn't a value
- for (unsigned i = 0, E = SI->getNumCases(); i != E; ++i)
- if (SI->getCaseValue(i) == CI) // Found the taken branch.
- return SI->getCaseSuccessor(i) == To;
-
- // If the constant value is not equal to any of the branches, we must
- // execute default branch.
- return SI->getDefaultDest() == To;
+ return SI->findCaseValue(CI).getCaseSuccessor() == To;
}
// Just mark all destinations executable!
@@ -1495,12 +1488,12 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) {
// If the input to SCCP is actually switch on undef, fix the undef to
// the first constant.
if (isa<UndefValue>(SI->getCondition())) {
- SI->setCondition(SI->getCaseValue(0));
- markEdgeExecutable(BB, SI->getCaseSuccessor(0));
+ SI->setCondition(SI->caseBegin().getCaseValue());
+ markEdgeExecutable(BB, SI->caseBegin().getCaseSuccessor());
return true;
}
- markForcedConstant(SI->getCondition(), SI->getCaseValue(0));
+ markForcedConstant(SI->getCondition(), SI->caseBegin().getCaseValue());
return true;
}
}