[llvm] r276066 - Codegen: Tail Duplication: Only duplicate into layout pred if it is a CFG Pred.

Kyle Butt via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 19 17:01:51 PDT 2016


Author: iteratee
Date: Tue Jul 19 19:01:51 2016
New Revision: 276066

URL: http://llvm.org/viewvc/llvm-project?rev=276066&view=rev
Log:
Codegen: Tail Duplication: Only duplicate into layout pred if it is a CFG Pred.

Add a check that the layout predecessor of a block is an actual CFG
predecssor of the block as well. No current code fails this check, but
upcoming patches can trigger this, and it makes sense to separate it
out.

Modified:
    llvm/trunk/lib/CodeGen/TailDuplicator.cpp

Modified: llvm/trunk/lib/CodeGen/TailDuplicator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TailDuplicator.cpp?rev=276066&r1=276065&r2=276066&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TailDuplicator.cpp (original)
+++ llvm/trunk/lib/CodeGen/TailDuplicator.cpp Tue Jul 19 19:01:51 2016
@@ -824,6 +824,8 @@ bool TailDuplicator::tailDuplicate(Machi
   // This has to check PrevBB->succ_size() because EH edges are ignored by
   // AnalyzeBranch.
   if (PrevBB->succ_size() == 1 &&
+      // Layout preds are not always CFG preds. Check.
+      *PrevBB->succ_begin() == TailBB &&
       !TII->analyzeBranch(*PrevBB, PriorTBB, PriorFBB, PriorCond, true) &&
       PriorCond.empty() && !PriorTBB && TailBB->pred_size() == 1 &&
       !TailBB->hasAddressTaken()) {




More information about the llvm-commits mailing list