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

Kyle Butt via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 17:40:21 PDT 2016

iteratee marked an inline comment as done.

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
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.


More information about the llvm-commits mailing list