diff options
author | Alina Sbirlea <asbirlea@google.com> | 2019-03-29 21:16:31 +0000 |
---|---|---|
committer | Alina Sbirlea <asbirlea@google.com> | 2019-03-29 21:16:31 +0000 |
commit | e589067e618ffeaa59c3d1a6214ce536141a11d5 (patch) | |
tree | 437d75ccf2d6f6a00922316c8c6ab079ea579cc0 /llvm/lib/Analysis/MemorySSAUpdater.cpp | |
parent | ba708619ad2399601da002b1b49ce60874cb6446 (diff) | |
download | bcm5719-llvm-e589067e618ffeaa59c3d1a6214ce536141a11d5.tar.gz bcm5719-llvm-e589067e618ffeaa59c3d1a6214ce536141a11d5.zip |
[MemorySSA] Don't optimize incomplete phis.
Summary:
MemoryPhis cannot be optimized out until they are complete.
Resolves PR41254.
Reviewers: george.burgess.iv
Subscribers: sanjoy, jlebar, Prazek, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59966
llvm-svn: 357315
Diffstat (limited to 'llvm/lib/Analysis/MemorySSAUpdater.cpp')
-rw-r--r-- | llvm/lib/Analysis/MemorySSAUpdater.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/MemorySSAUpdater.cpp b/llvm/lib/Analysis/MemorySSAUpdater.cpp index f3ea8827370..fe84ca1207e 100644 --- a/llvm/lib/Analysis/MemorySSAUpdater.cpp +++ b/llvm/lib/Analysis/MemorySSAUpdater.cpp @@ -309,8 +309,15 @@ void MemorySSAUpdater::insertDef(MemoryDef *MD, bool RenameUses) { IDFs.calculate(IDFBlocks); SmallVector<AssertingVH<MemoryPhi>, 4> NewInsertedPHIs; for (auto *BBIDF : IDFBlocks) - if (!MSSA->getMemoryAccess(BBIDF)) - NewInsertedPHIs.push_back(MSSA->createMemoryPhi(BBIDF)); + if (!MSSA->getMemoryAccess(BBIDF)) { + auto *MPhi = MSSA->createMemoryPhi(BBIDF); + NewInsertedPHIs.push_back(MPhi); + // Add the phis created into the IDF blocks to NonOptPhis, so they are + // not optimized out as trivial by the call to getPreviousDefFromEnd + // below. Once they are complete, all these Phis are added to the + // FixupList, and removed from NonOptPhis inside fixupDefs(). + NonOptPhis.insert(MPhi); + } for (auto &MPhi : NewInsertedPHIs) { auto *BBIDF = MPhi->getBlock(); |