[PATCH] D22696: [CodeGenPrep] Skip merging empty case blocks

David Li via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 7 10:52:35 PST 2016


davidxl added inline comments.


================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:383
+/// Find a destination block from BB if BB is mergeable empty block.
+BasicBlock *CodeGenPrepare::findDestBlockIfMergeableEmptyBlock(BasicBlock *BB) {
+  // If this block doesn't end with an uncond branch, ignore it.
----------------
Nit: If --> Of


================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:466
+  BasicBlock *Pred = BB->getUniquePredecessor();
+  if (Pred && BB->getTerminator() == BB->getFirstNonPHI() &&
+      (isa<SwitchInst>(Pred->getTerminator()) ||
----------------
Use early return to reduce nesting level.


================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:487
+
+    // Find other incoming blocks from which all the incoming values are same as
+    // the one from BB.
----------------
Find all other incoming blocks from which incoming values of all PHIs in DestBB are the same as the ones from BB.


https://reviews.llvm.org/D22696





More information about the llvm-commits mailing list