[PATCH] D83421: [RFC] MemorySSAUpdater: Simplify applyUpdates

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 8 13:14:21 PDT 2020


nhaehnle created this revision.
nhaehnle added reviewers: asbirlea, kuhar.
Herald added subscribers: george.burgess.iv, hiraditya, Prazek.
Herald added a project: LLVM.

The alternative constructor of DominatorTree does not actually compute
a dominator tree that is any different from the standard constructor,
and callers of MemorySSAUpdater::applyUpdates have already applied
updates to the dominator tree.

Change-Id: I311b6e019763b26996e5181f4d43ccedb67d6e88


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83421

Files:
  llvm/lib/Analysis/MemorySSAUpdater.cpp


Index: llvm/lib/Analysis/MemorySSAUpdater.cpp
===================================================================
--- llvm/lib/Analysis/MemorySSAUpdater.cpp
+++ llvm/lib/Analysis/MemorySSAUpdater.cpp
@@ -792,20 +792,8 @@
       DeleteUpdates.push_back({DT.Delete, Update.getFrom(), Update.getTo()});
   }
 
-  if (!DeleteUpdates.empty()) {
-    // Update for inserted edges: use newDT and snapshot CFG as if deletes had
-    // not occurred.
-    // FIXME: This creates a new DT, so it's more expensive to do mix
-    // delete/inserts vs just inserts. We can do an incremental update on the DT
-    // to revert deletes, than re-delete the edges. Teaching DT to do this, is
-    // part of a pending cleanup.
-    DominatorTree NewDT(DT, DeleteUpdates);
-    GraphDiff<BasicBlock *> GD(DeleteUpdates, /*ReverseApplyUpdates=*/true);
-    applyInsertUpdates(InsertUpdates, NewDT, &GD);
-  } else {
-    GraphDiff<BasicBlock *> GD;
-    applyInsertUpdates(InsertUpdates, DT, &GD);
-  }
+  GraphDiff<BasicBlock *> GD(DeleteUpdates, /*ReverseApplyUpdates=*/true);
+  applyInsertUpdates(InsertUpdates, DT, &GD);
 
   // Update for deleted edges
   for (auto &Update : DeleteUpdates)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83421.276537.patch
Type: text/x-patch
Size: 1178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200708/82c77891/attachment.bin>


More information about the llvm-commits mailing list