[PATCH] D37575: [BasicBlock] add new function removeEdge()

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 8 05:59:56 PDT 2017


kuhar added a comment.

This actually seems a bit orthogonal to what we wanted to do with @dberlin. The idea was to see if it is possible to always preserve dominators, and to do it completely automatically. With this high-level goal in mind, I tried to hack removePredecessor (and others) to grab DominatorTree (if available) and update it internally. That would probably also deprecate the batch updater, as every update DominatorTree update would happen in lockstep with CFG update calls. The problem was however that the existing BasicBlock API doesn't really care about CFG edges and it wasn't really possible to place the DT update calls anywhere.

It looks like this patch could be the one of the first steps towards completely automatic DominatorTree updates. Another interesting thing would be to see if it would be possible to do something equivalent for addEdge -- with these 2 pieces of API in place, it would be much easier to fuzz and benchmarks the incremental DominatorTree updater.



================
Comment at: llvm/lib/IR/BasicBlock.cpp:324
+    // There are 1+ instances of To in the list of destinations.
+    bool removedDest;
+    do {
----------------
`s/removedDest/RemovedDest`


================
Comment at: llvm/lib/IR/BasicBlock.cpp:348
+    // statements that branch to To.
+    bool removedCase;
+    do {
----------------
`s/removedCase/RemovedCase`


================
Comment at: llvm/lib/IR/BasicBlock.cpp:351
+      removedCase = false;
+      for (SwitchInst::CaseIt I = SI->case_begin(), E = SI->case_end(); I != E;
+           ++I) {
----------------
Consider using auto here


================
Comment at: llvm/lib/IR/BasicBlock.cpp:387
+    // to To.
+    bool removedHandler;
+    do {
----------------
`s/removedHandler/RemovedHandler`


================
Comment at: llvm/lib/IR/BasicBlock.cpp:390
+      removedHandler = false;
+      for (CatchSwitchInst::handler_iterator I = CI->handler_begin(),
+                                             E = CI->handler_end();
----------------
Consider using auto here as well


Repository:
  rL LLVM

https://reviews.llvm.org/D37575





More information about the llvm-commits mailing list