From c9be25726114b43ac03a4f8f84b537c21ee2bd6d Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 22 Jun 2011 04:01:58 +0000 Subject: [PATCH] Reenable the optimization added in 133415, but change the definition of a "simple" bb to be one with only one unconditional branch and no phis. Duplicating the phis in this case is possible, but requeres liveness analysis or breaking edges. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133607 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TailDuplication.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/TailDuplication.cpp b/lib/CodeGen/TailDuplication.cpp index d16369a4ca6..6e832d99ef9 100644 --- a/lib/CodeGen/TailDuplication.cpp +++ b/lib/CodeGen/TailDuplication.cpp @@ -568,9 +568,9 @@ bool TailDuplicatePass::isSimpleBB(MachineBasicBlock *TailBB) { if (TailBB->succ_size() != 1) return false; - MachineBasicBlock::iterator I = TailBB->getFirstNonPHI(); + MachineBasicBlock::iterator I = TailBB->begin(); MachineBasicBlock::iterator E = TailBB->end(); - while (I->isDebugValue() && I != E) + while (I != E && I->isDebugValue()) ++I; if (I == E) return true; @@ -712,7 +712,7 @@ TailDuplicatePass::TailDuplicate(MachineBasicBlock *TailBB, MachineFunction &MF, DenseSet UsedByPhi; getRegsUsedByPHIs(*TailBB, &UsedByPhi); - if (0 && isSimpleBB(TailBB)) + if (isSimpleBB(TailBB)) return duplicateSimpleBB(TailBB, TDBBs, UsedByPhi, Copies); // Iterate through all the unique predecessors and tail-duplicate this