[PATCH] D14308: [SimplifyCFG] Extend SimplifyResume to handle phi of trivial landing pad.

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 6 16:44:08 PST 2015


reames added inline comments.

================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:3221
@@ +3220,3 @@
+
+  // If RI->getValue() is a landing pad, check if the first instruction is
+  // the same landing pad that caused control to branch here. If RI->getValue
----------------
Given how divergent the two cases have gotten, I think we should split the two cases.  The code duplication is relatively minor compared to the simplification of the complexity.  

================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:3278
@@ +3277,3 @@
+    // to remove them all.
+    while (PhiLPInst && PhiLPInst->getBasicBlockIndex(TrivialBB) != -1) {
+      BB->removePredecessor(TrivialBB, true);
----------------
I think this can be more clearly written as:
if (PhiLPInst) 
  while (PhiLPInst->getBasicBlockIndex(TrivialBB) != -1)
      BB->removePredecessor(TrivialBB, false);

Right?


http://reviews.llvm.org/D14308





More information about the llvm-commits mailing list