[PATCH] D18226: Codegen: Tail-duplicate during placement.

Kyle Butt via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 18:33:18 PDT 2016

iteratee added a comment.

I'll handle the 2 comment changes you asked for before I upload a new patch, but please take a look at the comments I added. I wrote them before I saw your comments, because I was thinking through some cases.

Comment at: lib/CodeGen/BranchFolding.cpp:608
@@ -601,1 +607,3 @@
+                  DenseMap<const MachineBasicBlock *, int> &FuncletMembership,
+                  bool AfterPlacement) {
   // It is never profitable to tail-merge blocks from two different funclets.
davidxl wrote:
> I think it is cleaner to check at the beginning if anyone of MBB1 or MBB2 need to be skipped (either be the taildupped block or a block tail-dupped into), and return false if so. The set of skipped blocks can be passed into the BF by block placement.
See below for the discussion about this, but I don't think passing in the set of blocks is the right choice.

Comment at: lib/CodeGen/BranchFolding.cpp:629
@@ +628,3 @@
+  // unless the other block has its own fallthrough.
+  if ((MBB1 == PredBB && !MBB2->canFallThrough())
+       || (MBB2 == PredBB && !MBB1->canFallThrough())) {
davidxl wrote:
> Is this change related?
Yes, but I plan to split it out into a separate patch.


More information about the llvm-commits mailing list