[PATCH] D37343: [CGP] Merge empty case blocks if no extra moves are added.

Balaram Makam via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 28 20:09:01 PDT 2017


bmakam added inline comments.


================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:713
 
+    if (DT && ModifiedDT) {
+      DT->recalculate(F);
----------------
efriedma wrote:
> This usage of "ModifiedDT" is weird; if the CFG is ever modified, you recompute every time you visit a basic blocK?
In some corner cases [1], the entry block is removed and dominator tree cannot be notified of this change.  In such cases we will have to recalculate the entire tree. This was primarily the reason why I was lazily computing DT earlier. Please let me know if there is a better way to handle this.
[1] test/Transforms/CodeGenPrepare/2008-11-24-RAUW-Self.ll


================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:720
+      DT->changeImmediateDominator(DestBB, NewIDom);
+      DT->eraseNode(BB);
+    }
----------------
efriedma wrote:
> New code should be using insertEdge/deleteEdge/applyUpdates to do domtree updates.
I found this to be more easy to understand, I am happy to change this to DominatorTree::UpdateTypes/applyUpdates if this is the new coding standard.


https://reviews.llvm.org/D37343





More information about the llvm-commits mailing list