summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff options
context:
space:
mode:
authorMichael Zolotukhin <mzolotukhin@apple.com>2016-09-27 21:03:45 +0000
committerMichael Zolotukhin <mzolotukhin@apple.com>2016-09-27 21:03:45 +0000
commit1a554be3b609959bd0611c5cb3a48c352ba3ebc3 (patch)
treee801898b5bdbee320884d6377a81c403c279c833 /llvm/lib/Transforms/Utils/LoopSimplify.cpp
parent699fc5b19146214ec483e0e5cb33084b737be26f (diff)
downloadbcm5719-llvm-1a554be3b609959bd0611c5cb3a48c352ba3ebc3.tar.gz
bcm5719-llvm-1a554be3b609959bd0611c5cb3a48c352ba3ebc3.zip
[LoopSimplify] When simplifying phis in loop-simplify, do it only if it preserves LCSSA form.
llvm-svn: 282541
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopSimplify.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopSimplify.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
index 26b59ad57df..36e2fea63dc 100644
--- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
@@ -622,8 +622,10 @@ ReprocessLoop:
(PN = dyn_cast<PHINode>(I++)); )
if (Value *V = SimplifyInstruction(PN, DL, nullptr, DT, AC)) {
if (SE) SE->forgetValue(PN);
- PN->replaceAllUsesWith(V);
- PN->eraseFromParent();
+ if (!PreserveLCSSA || LI->replacementPreservesLCSSAForm(PN, V)) {
+ PN->replaceAllUsesWith(V);
+ PN->eraseFromParent();
+ }
}
// If this loop has multiple exits and the exits all go to the same
OpenPOWER on IntegriCloud