diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-10-05 20:36:25 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-10-05 20:36:25 +0000 |
commit | b0cedd5f96b4c3377e65c347c129bf19567c49bc (patch) | |
tree | 87a1f0ad9fa7a5c9d1780e766bdaa711eb96c458 /llvm/lib/CodeGen/SplitKit.cpp | |
parent | c1526595b3a8144f1283404b8738c0c7940659f6 (diff) | |
download | llvm-b0cedd5f96b4c3377e65c347c129bf19567c49bc.zip llvm-b0cedd5f96b4c3377e65c347c129bf19567c49bc.tar.gz llvm-b0cedd5f96b4c3377e65c347c129bf19567c49bc.tar.bz2 |
Don't use nextIndex to check for live out of instruction.
Insert copy after defining instruction.
Fix LiveIntervalMap::extendTo to properly handle live segments starting before
the current basic block.
Make sure the open live range is extended to the inserted copy's use slot.
llvm-svn: 115665
Diffstat (limited to 'llvm/lib/CodeGen/SplitKit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SplitKit.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/SplitKit.cpp b/llvm/lib/CodeGen/SplitKit.cpp index 048f6ab..0621945 100644 --- a/llvm/lib/CodeGen/SplitKit.cpp +++ b/llvm/lib/CodeGen/SplitKit.cpp @@ -521,7 +521,7 @@ VNInfo *LiveIntervalMap::extendTo(MachineBasicBlock *MBB, SlotIndex Idx) { if (I == li_->begin()) return 0; --I; - if (I->start < lis_.getMBBStartIdx(MBB)) + if (I->end <= lis_.getMBBStartIdx(MBB)) return 0; if (I->end <= Idx) I->end = Idx.getNextSlot(); @@ -703,23 +703,20 @@ void SplitEditor::leaveIntvAfter(SlotIndex Idx) { assert(openli_.getLI() && "openIntv not called before leaveIntvAfter"); // The interval must be live beyond the instruction at Idx. - SlotIndex EndIdx = Idx.getNextIndex().getBaseIndex(); - VNInfo *ParentVNI = curli_->getVNInfoAt(EndIdx); + VNInfo *ParentVNI = curli_->getVNInfoAt(Idx.getBoundaryIndex()); if (!ParentVNI) { DEBUG(dbgs() << " leaveIntvAfter " << Idx << ": not live\n"); return; } - MachineInstr *MI = lis_.getInstructionFromIndex(Idx); - assert(MI && "leaveIntvAfter called with invalid index"); - - VNInfo *VNI = dupli_.defByCopyFrom(openli_.getLI()->reg, ParentVNI, - *MI->getParent(), MI); + MachineBasicBlock::iterator MII = lis_.getInstructionFromIndex(Idx); + MachineBasicBlock *MBB = MII->getParent(); + VNInfo *VNI = dupli_.defByCopyFrom(openli_.getLI()->reg, ParentVNI, *MBB, + llvm::next(MII)); // Finally we must make sure that openli is properly extended from Idx to the // new copy. - openli_.mapValue(ParentVNI, VNI->def.getUseIndex()); - + openli_.addSimpleRange(Idx.getBoundaryIndex(), VNI->def, ParentVNI); DEBUG(dbgs() << " leaveIntvAfter " << Idx << ": " << *openli_.getLI() << '\n'); } @@ -744,8 +741,7 @@ void SplitEditor::leaveIntvAtTop(MachineBasicBlock &MBB) { // Finally we must make sure that openli is properly extended from Start to // the new copy. - openli_.mapValue(ParentVNI, VNI->def.getUseIndex()); - + openli_.addSimpleRange(Start, VNI->def, ParentVNI); DEBUG(dbgs() << " leaveIntvAtTop at " << Start << ": " << *openli_.getLI() << '\n'); } |