[PATCH] D100163: [MSSA] Rename uses in IDF regardless of new def position in basic block.

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 9 00:00:40 PDT 2021


asbirlea created this revision.
Herald added subscribers: george.burgess.iv, hiraditya, Prazek.
asbirlea requested review of this revision.
Herald added a project: LLVM.

When inserting a new def and renaming of uses is asked, always compute
IDF and do the renaming for the blocks with Phis in that IDF.
Resolves PR49859.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100163

Files:
  llvm/lib/Analysis/MemorySSAUpdater.cpp


Index: llvm/lib/Analysis/MemorySSAUpdater.cpp
===================================================================
--- llvm/lib/Analysis/MemorySSAUpdater.cpp
+++ llvm/lib/Analysis/MemorySSAUpdater.cpp
@@ -363,14 +363,11 @@
     // place, compute IDF and place phis.
     SmallPtrSet<BasicBlock *, 2> DefiningBlocks;
 
-    // If this is the last Def in the block, also compute IDF based on MD, since
-    // this may a new Def added, and we may need additional Phis.
-    auto Iter = MD->getDefsIterator();
-    ++Iter;
-    auto IterEnd = MSSA->getBlockDefs(MD->getBlock())->end();
-    if (Iter == IterEnd)
-      DefiningBlocks.insert(MD->getBlock());
-
+    // If this is the last Def in the block, we may need additional Phis.
+    // Compute IDF in all cases, as renaming needs to be done even when MD is
+    // not the last access, because it can introduce a new access past which a
+    // previous access was optimized; that access needs to be reoptimized.
+    DefiningBlocks.insert(MD->getBlock());
     for (const auto &VH : InsertedPHIs)
       if (const auto *RealPHI = cast_or_null<MemoryPhi>(VH))
         DefiningBlocks.insert(RealPHI->getBlock());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100163.336324.patch
Type: text/x-patch
Size: 1166 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210409/9530f16b/attachment.bin>


More information about the llvm-commits mailing list