summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2009-11-19 19:42:16 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2009-11-19 19:42:16 +0000
commit331e6880a5cd957d08c83d4bfebc8dcf5353b47d (patch)
treedc09e7e41fce0a16b97001da42972d3c968d6bf4 /llvm/lib/CodeGen
parent31c74dbb10e178a6a410ad70806e3e7a3218e5ff (diff)
downloadbcm5719-llvm-331e6880a5cd957d08c83d4bfebc8dcf5353b47d.tar.gz
bcm5719-llvm-331e6880a5cd957d08c83d4bfebc8dcf5353b47d.zip
Place new basic blocks immediately after their predecessor when splitting
critical edges in PHIElimination. This has a huge impact on regalloc performance, and we recover almost all of the 10% compile time regression that edge splitting introduced. llvm-svn: 89381
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/PHIElimination.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/PHIElimination.cpp b/llvm/lib/CodeGen/PHIElimination.cpp
index b3802ed6725..53ab8b03ee7 100644
--- a/llvm/lib/CodeGen/PHIElimination.cpp
+++ b/llvm/lib/CodeGen/PHIElimination.cpp
@@ -439,21 +439,21 @@ MachineBasicBlock *PHIElimination::SplitCriticalEdge(MachineBasicBlock *A,
++NumSplits;
MachineBasicBlock *NMBB = MF->CreateMachineBasicBlock();
- MF->push_back(NMBB);
+ MF->insert(next(MachineFunction::iterator(A)), NMBB);
DEBUG(errs() << "PHIElimination splitting critical edge:"
" BB#" << A->getNumber()
<< " -- BB#" << NMBB->getNumber()
<< " -- BB#" << B->getNumber() << '\n');
A->ReplaceUsesOfBlockWith(B, NMBB);
- // If A may fall through to B, we may have to insert a branch.
- if (A->isLayoutSuccessor(B))
- A->updateTerminator();
+ A->updateTerminator();
- // Insert unconditional "jump B" instruction in NMBB.
+ // Insert unconditional "jump B" instruction in NMBB if necessary.
NMBB->addSuccessor(B);
- Cond.clear();
- MF->getTarget().getInstrInfo()->InsertBranch(*NMBB, B, NULL, Cond);
+ if (!NMBB->isLayoutSuccessor(B)) {
+ Cond.clear();
+ MF->getTarget().getInstrInfo()->InsertBranch(*NMBB, B, NULL, Cond);
+ }
// Fix PHI nodes in B so they refer to NMBB instead of A
for (MachineBasicBlock::iterator i = B->begin(), e = B->end();
OpenPOWER on IntegriCloud