diff options
author | Cameron Zwarich <zwarich@apple.com> | 2013-02-10 23:29:54 +0000 |
---|---|---|
committer | Cameron Zwarich <zwarich@apple.com> | 2013-02-10 23:29:54 +0000 |
commit | 21beaf6789c4935db4a11f37a1863031b5725c90 (patch) | |
tree | b6bf728f6cd4c847fc6756c53c469b12a3dae0f5 /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | bb9ad311fb3c312dcda8cee8836dd164b5a6e5c7 (diff) | |
download | bcm5719-llvm-21beaf6789c4935db4a11f37a1863031b5725c90.tar.gz bcm5719-llvm-21beaf6789c4935db4a11f37a1863031b5725c90.zip |
Fix the unused but nearly correct method SlotIndexes::insertMBBInMaps() and add
support for updating SlotIndexes to MachineBasicBlock::SplitCriticalEdge(). This
calls renumberIndexes() every time; it should be improved to only renumber
locally.
llvm-svn: 174851
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 7e9fb20ffe8..2534a740058 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -662,6 +662,9 @@ MachineBasicBlock::SplitCriticalEdge(MachineBasicBlock *Succ, Pass *P) { " BB#" << getNumber() << " -- BB#" << NMBB->getNumber() << " -- BB#" << Succ->getNumber() << '\n'); + SlotIndexes *Indexes = P->getAnalysisIfAvailable<SlotIndexes>(); + if (Indexes) + Indexes->insertMBBInMaps(NMBB); // On some targets like Mips, branches may kill virtual registers. Make sure // that LiveVariables is properly updated after updateTerminator replaces the @@ -697,6 +700,17 @@ MachineBasicBlock::SplitCriticalEdge(MachineBasicBlock *Succ, Pass *P) { if (!NMBB->isLayoutSuccessor(Succ)) { Cond.clear(); MF->getTarget().getInstrInfo()->InsertBranch(*NMBB, Succ, NULL, Cond, dl); + + if (Indexes) { + for (instr_iterator I = NMBB->instr_begin(), E = NMBB->instr_end(); + I != E; ++I) { + // Some instructions may have been moved to NMBB by updateTerminator(), + // so we first remove any instruction that already has an index. + if (Indexes->hasIndex(I)) + Indexes->removeMachineInstrFromMaps(I); + Indexes->insertMachineInstrInMaps(I); + } + } } // Fix PHI nodes in Succ so they refer to NMBB instead of this |