aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-10-24 05:51:01 +0000
committerStephen Hines <srhines@google.com>2011-11-14 09:11:06 -0800
commitb8c3ab1f5380d3d3069872d289fdb6c99aecb981 (patch)
tree04c12d09b1e4417d22030b459e6492a1dd06fca8 /lib/Analysis/ScalarEvolution.cpp
parentcc4c43f648a8021c7dc410a090559e9733fc0bbb (diff)
downloadexternal_llvm-b8c3ab1f5380d3d3069872d289fdb6c99aecb981.tar.gz
external_llvm-b8c3ab1f5380d3d3069872d289fdb6c99aecb981.tar.bz2
external_llvm-b8c3ab1f5380d3d3069872d289fdb6c99aecb981.zip
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.cpp2
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!