[llvm-commits] [llvm] r142788 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Nick Lewycky
nicholas at mxc.ca
Sun Oct 23 22:51:01 PDT 2011
Author: nicholas
Date: Mon Oct 24 00:51:01 2011
New Revision: 142788
URL: http://llvm.org/viewvc/llvm-project?rev=142788&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=142788&r1=142787&r2=142788&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Oct 24 00:51:01 2011
@@ -4856,7 +4856,7 @@
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!
More information about the llvm-commits
mailing list