[PATCH] D20379: Codegen: Fix broken assumption in Tail Merge.

Haicheng Wu via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 07:25:39 PDT 2016


haicheng added inline comments.

================
Comment at: lib/CodeGen/BranchFolding.cpp:1219
@@ -1214,3 +1218,3 @@
       // jump to a landing pad, and so can safely jump to the fallthrough?
-    } else {
+    } else if (MBB->isSuccessor(&*FallThrough)) {
       // Rewrite all predecessors of the old block to go to the fallthrough
----------------
iteratee wrote:
> haicheng wrote:
> > I think we can enter here only if MBB is empty which means MBB does not have any branch.  In this case,  I think MBB has nowhere to go but fallthrough to FallThrough and this check is not necessary.
> This is actually what caused me to look into fallthrough in this file. An empty unreachable block has no successors, and replacing it with its layout successor can create invalid cfg edges.
That makes sense.  Do you want to add a comment to explain this?  Do you also want to create a test case for this?  I think you don't have any test case yet to show what you want to fix.


http://reviews.llvm.org/D20379





More information about the llvm-commits mailing list