From 3d7281b8c92eef251d4a99b80eec4600ac643b2c Mon Sep 17 00:00:00 2001 From: Kyle Butt Date: Wed, 20 Jul 2016 00:01:51 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276066 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TailDuplicator.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/CodeGen/TailDuplicator.cpp b/lib/CodeGen/TailDuplicator.cpp index f2349f28243..059c1dc5483 100644 --- a/lib/CodeGen/TailDuplicator.cpp +++ b/lib/CodeGen/TailDuplicator.cpp @@ -824,6 +824,8 @@ bool TailDuplicator::tailDuplicate(MachineFunction &MF, bool IsSimple, // 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()) {