[llvm] f6bff8d - [MSSA] Rename uses in IDF regardless of new def position in basic block.

Alina Sbirlea via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 9 12:33:02 PDT 2021


Author: Alina Sbirlea
Date: 2021-04-09T12:32:37-07:00
New Revision: f6bff8d15778e642ff888075a75480c5201866c2

URL: https://github.com/llvm/llvm-project/commit/f6bff8d15778e642ff888075a75480c5201866c2
DIFF: https://github.com/llvm/llvm-project/commit/f6bff8d15778e642ff888075a75480c5201866c2.diff

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

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.

Differential Revision: https://reviews.llvm.org/D100163

Added: 
    

Modified: 
    llvm/lib/Analysis/MemorySSAUpdater.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/MemorySSAUpdater.cpp b/llvm/lib/Analysis/MemorySSAUpdater.cpp
index 0b4f2654086ce..faaafae543fab 100644
--- a/llvm/lib/Analysis/MemorySSAUpdater.cpp
+++ b/llvm/lib/Analysis/MemorySSAUpdater.cpp
@@ -363,14 +363,11 @@ void MemorySSAUpdater::insertDef(MemoryDef *MD, bool RenameUses) {
     // 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());


        


More information about the llvm-commits mailing list