[PATCH] D42114: Teach ConstantFoldTerminator to preserve DomTree

Jakub Kuderski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 10:33:15 PST 2018


kuhar added inline comments.


================
Comment at: lib/Transforms/Utils/Local.cpp:129
+      if (DT)
+        DT->deleteEdge(BB, OldDest);
       return true;
----------------
Can Dest1 and Dest2 be the same BB? If so, a check for that would be needed before removing the edge. LLVM IR forms a multigraph, while the DomTree updater API treats it more like a normal graph, and we have to check for multiedges.


================
Comment at: lib/Transforms/Utils/Local.cpp:205
+        if (DT) {
+          Updates.push_back({DominatorTree::Delete, SI->getParent(),
+                DefaultDest});
----------------
Same as above: are we sure that this is the only edge from SI->getParent() to DefaultDest?


https://reviews.llvm.org/D42114





More information about the llvm-commits mailing list