diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-10-24 05:51:01 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-10-24 05:51:01 +0000 |
commit | 5bef0eb1de5f52662de7b4808bee5e9d643b04db (patch) | |
tree | 8744209eb4d22df0fdeb50f706d27db22b80b78c /lib/Analysis/ScalarEvolution.cpp | |
parent | 4a3935c27e5315081844a5b7ae1f7097efc234b0 (diff) |
PHI nodes not in the loop header aren't part of the loop iteration initial
state. Furthermore, they might not have two operands. This fixes the underlying
issue behind the crashes introduced in r142781.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142788 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 2da8e6fbd6..1e4bf19e84 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -4856,7 +4856,7 @@ ScalarEvolution::getConstantEvolutionLoopExitValue(PHINode *PN, for (DenseMap<Instruction *, Constant *>::const_iterator I = CurrentIterVals.begin(), E = CurrentIterVals.end(); I != E; ++I){ PHINode *PHI = dyn_cast<PHINode>(I->first); - if (!PHI || PHI == PN) continue; + if (!PHI || PHI == PN || PHI->getParent() != Header) continue; Constant *&NextPHI = NextIterVals[PHI]; if (NextPHI) continue; // Already computed! |