[llvm-branch-commits] [llvm-branch] r89391 - /llvm/branches/Apple/Leela/lib/CodeGen/PHIElimination.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Thu Nov 19 13:41:37 PST 2009
Author: stoklund
Date: Thu Nov 19 15:41:36 2009
New Revision: 89391
URL: http://llvm.org/viewvc/llvm-project?rev=89391&view=rev
Log:
89381
Modified:
llvm/branches/Apple/Leela/lib/CodeGen/PHIElimination.cpp
Modified: llvm/branches/Apple/Leela/lib/CodeGen/PHIElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/PHIElimination.cpp?rev=89391&r1=89390&r2=89391&view=diff
==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/PHIElimination.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/PHIElimination.cpp Thu Nov 19 15:41:36 2009
@@ -439,7 +439,7 @@
++NumSplits;
MachineBasicBlock *NMBB = MF->CreateMachineBasicBlock();
- MF->push_back(NMBB);
+ MF->insert(next(MachineFunction::iterator(A)), NMBB);
const unsigned NewNum = NMBB->getNumber();
DEBUG(errs() << "PHIElimination splitting critical edge:"
" BB#" << A->getNumber()
@@ -447,14 +447,14 @@
<< " -- 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();
More information about the llvm-branch-commits
mailing list