From 7e8be28661b66e1c0358f1bab199ea1e377ef024 Mon Sep 17 00:00:00 2001 From: Kyle Butt Date: Mon, 10 Apr 2017 22:28:22 +0000 Subject: CodeGen: BlockPlacement: Don't always tail-duplicate with no other successor. The math works out where it can actually be counter-productive. The probability calculations correctly handle the case where the alternative is 0 probability, rely on those calculations. Includes a test case that demonstrates the problem. llvm-svn: 299892 --- llvm/lib/CodeGen/MachineBlockPlacement.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'llvm/lib/CodeGen/MachineBlockPlacement.cpp') diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp index c03ffdd3732..ffd88b7c8e3 100644 --- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp +++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp @@ -1489,11 +1489,7 @@ MachineBlockPlacement::selectBestSuccessor( if (DupProb < BestProb) break; if (canTailDuplicateUnplacedPreds(BB, Succ, Chain, BlockFilter) - // If tail duplication gives us fallthrough when we otherwise wouldn't - // have it, that is a strict gain. - && (BestSucc.BB == nullptr - || isProfitableToTailDup(BB, Succ, BestProb, Chain, - BlockFilter))) { + && (isProfitableToTailDup(BB, Succ, BestProb, Chain, BlockFilter))) { DEBUG( dbgs() << " Candidate: " << getBlockName(Succ) << ", probability: " << DupProb -- cgit v1.2.3