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

David Li via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 18:09:44 PDT 2016


davidxl accepted this revision.
davidxl added a comment.
This revision is now accepted and ready to land.

lgtm with more suggested restriction.


================
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;
----------------
iteratee wrote:
> 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.
Add AfterPlacement check here as well, and also add a FIXME comment to revisit making it more general later.


https://reviews.llvm.org/D22317





More information about the llvm-commits mailing list