aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-05-10 23:56:54 +0000
committerChris Lattner <sabre@nondot.org>2008-05-10 23:56:54 +0000
commit3a73c9e5f9e1f9baf77b744adf3adb53639b8af5 (patch)
tree2727af66373510705467e9ba4e1dcad01c33acd9 /lib
parentc2e735359f0698582d67fda313926a6436833b05 (diff)
downloadexternal_llvm-3a73c9e5f9e1f9baf77b744adf3adb53639b8af5.zip
external_llvm-3a73c9e5f9e1f9baf77b744adf3adb53639b8af5.tar.gz
external_llvm-3a73c9e5f9e1f9baf77b744adf3adb53639b8af5.tar.bz2
Simplify code by using SwitchInst::findCaseValue instead of reimplementing it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50957 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index be071f8..6e76f4c 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -448,20 +448,8 @@ void SCCPSolver::getFeasibleSuccessors(TerminatorInst &TI,
(SCValue.isConstant() && !isa<ConstantInt>(SCValue.getConstant()))) {
// All destinations are executable!
Succs.assign(TI.getNumSuccessors(), true);
- } else if (SCValue.isConstant()) {
- Constant *CPV = SCValue.getConstant();
- // 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) == CPV) {// Found the right branch...
- Succs[i] = true;
- return;
- }
- }
-
- // Constant value not equal to any of the branches... must execute
- // default branch then...
- Succs[0] = true;
- }
+ } else if (SCValue.isConstant())
+ Succs[SI->findCaseValue(cast<ConstantInt>(SCValue.getConstant()))] = true;
} else {
assert(0 && "SCCP: Don't know how to handle this terminator!");
}