diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-08-16 21:12:35 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-08-16 21:12:35 +0000 |
commit | 1fc291f0d3681e062daed186a934c0bf0c59224b (patch) | |
tree | 961561f6d17169134de9f048e18dec897979f435 /lib/Transforms/Scalar/SCCP.cpp | |
parent | c2408d3ce5fcd1fd4861772fdbe3b6447836e254 (diff) | |
download | external_llvm-1fc291f0d3681e062daed186a934c0bf0c59224b.zip external_llvm-1fc291f0d3681e062daed186a934c0bf0c59224b.tar.gz external_llvm-1fc291f0d3681e062daed186a934c0bf0c59224b.tar.bz2 |
Minor bug in SCCP found by inspection. (I don't think it's possible to hit this with a normal pass pipeline, but fixing for completeness.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137755 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/SCCP.cpp')
-rw-r--r-- | lib/Transforms/Scalar/SCCP.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 59d96be..accfbee 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -582,6 +582,10 @@ void SCCPSolver::getFeasibleSuccessors(TerminatorInst &TI, } if (SwitchInst *SI = dyn_cast<SwitchInst>(&TI)) { + if (TI.getNumSuccessors() < 2) { + Succs[0] = true; + return; + } LatticeVal SCValue = getValueState(SI->getCondition()); ConstantInt *CI = SCValue.getConstantInt(); @@ -642,6 +646,9 @@ bool SCCPSolver::isEdgeFeasible(BasicBlock *From, BasicBlock *To) { return true; if (SwitchInst *SI = dyn_cast<SwitchInst>(TI)) { + if (SI->getNumSuccessors() < 2) + return true; + LatticeVal SCValue = getValueState(SI->getCondition()); ConstantInt *CI = SCValue.getConstantInt(); |