aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/MemorySSAUpdater.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/MemorySSAUpdater.cpp')
-rw-r--r--llvm/lib/Analysis/MemorySSAUpdater.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/MemorySSAUpdater.cpp b/llvm/lib/Analysis/MemorySSAUpdater.cpp
index f3ea882..fe84ca1 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();