[llvm-commits] [llvm] r115665 - in /llvm/trunk/lib/CodeGen: SplitKit.cpp SplitKit.h
Jakob Stoklund Olesen
stoklund at 2pi.dk
Tue Oct 5 13:36:25 PDT 2010
Author: stoklund
Date: Tue Oct 5 15:36:25 2010
New Revision: 115665
URL: http://llvm.org/viewvc/llvm-project?rev=115665&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/SplitKit.cpp
llvm/trunk/lib/CodeGen/SplitKit.h
Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=115665&r1=115664&r2=115665&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SplitKit.cpp (original)
+++ llvm/trunk/lib/CodeGen/SplitKit.cpp Tue Oct 5 15:36:25 2010
@@ -521,7 +521,7 @@
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 @@
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 @@
// 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');
}
Modified: llvm/trunk/lib/CodeGen/SplitKit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.h?rev=115665&r1=115664&r2=115665&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SplitKit.h (original)
+++ llvm/trunk/lib/CodeGen/SplitKit.h Tue Oct 5 15:36:25 2010
@@ -161,11 +161,6 @@
// values not present (unknown/unmapped).
ValueMap valueMap_;
- // extendTo - Find the last li_ value defined in MBB at or before Idx. The
- // parentli is assumed to be live at Idx. Extend the live range to include
- // Idx. Return the found VNInfo, or NULL.
- VNInfo *extendTo(MachineBasicBlock *MBB, SlotIndex Idx);
-
public:
LiveIntervalMap(LiveIntervals &lis,
const LiveInterval &parentli)
@@ -194,6 +189,11 @@
/// mapped value.
VNInfo *mapValue(const VNInfo *ParentVNI, SlotIndex Idx, bool *simple = 0);
+ // extendTo - Find the last li_ value defined in MBB at or before Idx. The
+ // parentli is assumed to be live at Idx. Extend the live range to include
+ // Idx. Return the found VNInfo, or NULL.
+ VNInfo *extendTo(MachineBasicBlock *MBB, SlotIndex Idx);
+
/// isMapped - Return true is ParentVNI is a known mapped value. It may be a
/// simple 1-1 mapping or a complex mapping to later defs.
bool isMapped(const VNInfo *ParentVNI) const {
More information about the llvm-commits
mailing list