[PATCH] D22317: Codegen: Tail Merge: Be less aggressive with special cases.

Kyle Butt via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 18:01:18 PDT 2016


iteratee added inline comments.

================
Comment at: lib/CodeGen/BranchFolding.cpp:623
@@ -621,1 +622,3 @@
+  // trading a conditional branch for an unconditional one.
+  if ((MBB1 == PredBB || MBB2 == PredBB) && MBB1->succ_size() == 1) {
     MachineBasicBlock::iterator I;
----------------
I think in this case the comment is just wrong. A simple count shows that even for fallthrough if the branch was conditional, we trade a certain uncond-branch to a cond-branch for a cond-branch and an uncond-branch. In the first case, we always execute both branches. In the second, we may not execute the uncond-branch.

================
Comment at: lib/CodeGen/BranchFolding.cpp:646
@@ -640,2 +645,3 @@
   if (SuccBB && MBB1 != PredBB && MBB2 != PredBB &&
+      (MBB1->succ_size() == 1 || !AfterPlacement) &&
       !MBB1->back().isBarrier() &&
----------------
I've made this one layout mode dependent, because there's a much weaker case for keeping it overall.


https://reviews.llvm.org/D22317





More information about the llvm-commits mailing list