[PATCH] D66454: [MemorySSA] Make Phi cleanups consistent.

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 13:46:01 PDT 2019


asbirlea updated this revision to Diff 216234.
asbirlea added a comment.

Make this purely a cleanup patch.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66454/new/

https://reviews.llvm.org/D66454

Files:
  lib/Analysis/MemorySSAUpdater.cpp


Index: lib/Analysis/MemorySSAUpdater.cpp
===================================================================
--- lib/Analysis/MemorySSAUpdater.cpp
+++ lib/Analysis/MemorySSAUpdater.cpp
@@ -490,8 +490,8 @@
 void MemorySSAUpdater::removeEdge(BasicBlock *From, BasicBlock *To) {
   if (MemoryPhi *MPhi = MSSA->getMemoryAccess(To)) {
     MPhi->unorderedDeleteIncomingBlock(From);
-    if (MPhi->getNumIncomingValues() == 1)
-      removeMemoryAccess(MPhi);
+    auto OperRange = MPhi->operands();
+    tryRemoveTrivialPhi(MPhi, OperRange);
   }
 }
 
@@ -507,8 +507,8 @@
       Found = true;
       return false;
     });
-    if (MPhi->getNumIncomingValues() == 1)
-      removeMemoryAccess(MPhi);
+    auto OperRange = MPhi->operands();
+    tryRemoveTrivialPhi(MPhi, OperRange);
   }
 }
 
@@ -617,8 +617,8 @@
 
   // If NewMPhi is a trivial phi, remove it. Its use in the header MPhi will be
   // replaced with the unique value.
-  if (HasUniqueIncomingValue)
-    removeMemoryAccess(NewMPhi);
+  auto OperRange = MPhi->operands();
+  tryRemoveTrivialPhi(MPhi, OperRange);
 }
 
 void MemorySSAUpdater::updateForClonedLoop(const LoopBlocksRPO &LoopBlocks,
@@ -1227,8 +1227,8 @@
       return false;
     });
     Phi->addIncoming(NewPhi, New);
-    if (onlySingleValue(NewPhi))
-      removeMemoryAccess(NewPhi);
+    auto OperRange = NewPhi->operands();
+    tryRemoveTrivialPhi(NewPhi, OperRange);
   }
 }
 
@@ -1310,8 +1310,8 @@
       if (!DeadBlocks.count(Succ))
         if (MemoryPhi *MP = MSSA->getMemoryAccess(Succ)) {
           MP->unorderedDeleteIncomingBlock(BB);
-          if (MP->getNumIncomingValues() == 1)
-            removeMemoryAccess(MP);
+          auto OperRange = MP->operands();
+          tryRemoveTrivialPhi(MP, OperRange);
         }
     // Drop all references of all accesses in BB
     if (MemorySSA::AccessList *Acc = MSSA->getWritableBlockAccesses(BB))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66454.216234.patch
Type: text/x-patch
Size: 1887 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190820/3361e9dc/attachment.bin>


More information about the llvm-commits mailing list