aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2009-11-18 22:52:37 +0000
committerBob Wilson <bob.wilson@apple.com>2009-11-18 22:52:37 +0000
commit60f34b9fb0323688e93cf347d63b56327d6250f8 (patch)
tree7e492eb4f7345b2c2cad5fa1fba89b8171d60f71 /lib/CodeGen/BranchFolding.cpp
parent79d621035ebe620261dd8139a0882f62edabbfdb (diff)
Tail duplication still needs to iterate. Duplicating new instructions onto
the tail of a block may make that block a new candidate for duplication. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89264 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/BranchFolding.cpp')
-rw-r--r--lib/CodeGen/BranchFolding.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
index af5fbd1202..871d6dc576 100644
--- a/lib/CodeGen/BranchFolding.cpp
+++ b/lib/CodeGen/BranchFolding.cpp
@@ -197,7 +197,6 @@ bool BranchFolder::OptimizeFunction(MachineFunction &MF,
MadeChange |= OptimizeImpDefsBlock(MBB);
}
-
bool MadeChangeThisIteration = true;
while (MadeChangeThisIteration) {
MadeChangeThisIteration = false;
@@ -206,10 +205,15 @@ bool BranchFolder::OptimizeFunction(MachineFunction &MF,
MadeChange |= MadeChangeThisIteration;
}
- // Do tail duplication once after tail merging is done. Otherwise it is
+ // Do tail duplication after tail merging is done. Otherwise it is
// tough to avoid situations where tail duplication and tail merging undo
// each other's transformations ad infinitum.
- MadeChange |= TailDuplicateBlocks(MF);
+ MadeChangeThisIteration = true;
+ while (MadeChangeThisIteration) {
+ MadeChangeThisIteration = false;
+ MadeChangeThisIteration |= TailDuplicateBlocks(MF);
+ MadeChange |= MadeChangeThisIteration;
+ }
// See if any jump tables have become mergable or dead as the code generator
// did its thing.