summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-10-24 05:51:01 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-10-24 05:51:01 +0000
commit8e904dee820eb219f7eb069465047a25d78ebaca (patch)
tree40e556d34a6ef14473242edc3249abe822476d6c
parentdd1d3df524f45d0f26274c4e777ebd01419ced67 (diff)
downloadbcm5719-llvm-8e904dee820eb219f7eb069465047a25d78ebaca.tar.gz
bcm5719-llvm-8e904dee820eb219f7eb069465047a25d78ebaca.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. llvm-svn: 142788
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 2da8e6fbd63..1e4bf19e849 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/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!
OpenPOWER on IntegriCloud