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

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 18:04:56 PST 2015


majnemer added inline comments.

================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:3242
@@ +3241,3 @@
+    // Check incoming blocks to see if any of them are trivial.
+    for (unsigned i = 0; i < PhiLPInst->getNumIncomingValues(); i++) {
+      auto *IncomingBB = PhiLPInst->getIncomingBlock(i);
----------------
Please do not evaluate `getNumIncomingValues` each time through the loop, consider writing this like:
  for (unsigned Idx = 0, End = PhiLPInst->getNumIncomingValues(); Idx != End; ++Idx) {

================
Comment at: lib/Transforms/Utils/SimplifyCFG.cpp:3295
@@ +3294,3 @@
+  // haven't already deleted it above when deleting the landing pad blocks.
+  if (BB && pred_begin(BB) == pred_end(BB)) {
+    BB->eraseFromParent();
----------------
Isn't this `BB && pred_empty(BB)` ?  Also, the braces are superfluous.

================
Comment at: test/Transforms/SimplifyCFG/bug-25299.ll:1
@@ +1,2 @@
+; RUN: opt < %s -simplifycfg -disable-output
+
----------------
No FileCheck?


http://reviews.llvm.org/D14308





More information about the llvm-commits mailing list