summaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolutionExpander.cpp
diff options
context:
space:
mode:
authorSilviu Baranga <silviu.baranga@arm.com>2016-03-21 12:44:29 +0000
committerSilviu Baranga <silviu.baranga@arm.com>2016-03-21 12:44:29 +0000
commit872392e1a9c2787d731a83a3ec3b998da2855d86 (patch)
treeaccf5ec7836966c1c91dbc103f36b954dea8a54c /lib/Analysis/ScalarEvolutionExpander.cpp
parentbec2ec108febcc380b0a725ecd87d634b90e648d (diff)
[IndVars] Fix PR26974: make sure replaceCongruentIVs doesn't break LCSSA
Summary: replaceCongruentIVs can break LCSSA when trying to replace IV increments since it tries to replace all uses of a phi node with another phi node while both of the phi nodes are not necessarily in the processed loop. This will cause an assert in IndVars. To fix this, we add a check to make sure that the replacement maintains LCSSA. Reviewers: sanjoy Subscribers: mzolotukhin, llvm-commits Differential Revision: http://reviews.llvm.org/D18266 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263941 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r--lib/Analysis/ScalarEvolutionExpander.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp
index d083037a90f..4db3c7fb7f9 100644
--- a/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -1820,6 +1820,7 @@ unsigned SCEVExpander::replaceCongruentIVs(Loop *L, const DominatorTree *DT,
IsomorphicInc->getType());
if (OrigInc != IsomorphicInc
&& TruncExpr == SE.getSCEV(IsomorphicInc)
+ && SE.LI.replacementPreservesLCSSAForm(IsomorphicInc, OrigInc)
&& ((isa<PHINode>(OrigInc) && isa<PHINode>(IsomorphicInc))
|| hoistIVInc(OrigInc, IsomorphicInc))) {
DEBUG_WITH_TYPE(DebugType, dbgs()