aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-12-08 00:13:17 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-12-08 00:13:17 +0000
commitb771eb6d69bf86a62d336d9bbe22b6b5757f1984 (patch)
tree6bb3b5ad2515ed20b7b8e5113748b50add36bc96 /llvm/lib/Analysis/ScalarEvolutionExpander.cpp
parent411fdcd460312b4b441bda60c138d9877f2d426e (diff)
downloadllvm-b771eb6d69bf86a62d336d9bbe22b6b5757f1984.zip
llvm-b771eb6d69bf86a62d336d9bbe22b6b5757f1984.tar.gz
llvm-b771eb6d69bf86a62d336d9bbe22b6b5757f1984.tar.bz2
[SCEVExpander] Have hoistIVInc preserve LCSSA
Summary: (Note: the problematic invocation of hoistIVInc that caused PR24804 came from IndVarSimplify, not from SCEVExpander itself) Fixes PR24804. Test case by David Majnemer. Reviewers: hfinkel, majnemer, atrick, mzolotukhin Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15058 llvm-svn: 254976
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolutionExpander.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
index 8c5805e..abfcfba 100644
--- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -933,6 +933,9 @@ bool SCEVExpander::hoistIVInc(Instruction *IncV, Instruction *InsertPos) {
!SE.DT.dominates(InsertPos->getParent(), IncV->getParent()))
return false;
+ if (!SE.LI.movementPreservesLCSSAForm(IncV, InsertPos))
+ return false;
+
// Check that the chain of IV operands leading back to Phi can be hoisted.
SmallVector<Instruction*, 4> IVIncs;
for(;;) {