Fix some bugs in HMEditor's moveAllOperandsInto logic.

llvm-svn: 151006
This commit is contained in:
Lang Hames 2012-02-21 00:00:36 +00:00
parent 932b0b1a13
commit 7e2ce889a0
1 changed files with 10 additions and 9 deletions

View File

@ -1025,7 +1025,7 @@ bool LiveIntervals::checkRegMaskInterference(LiveInterval &LI,
// IntervalUpdate class. // IntervalUpdate class.
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
/// HMEditor is a toolkit used by handleMove to trim or extend live intervals. // HMEditor is a toolkit used by handleMove to trim or extend live intervals.
class LiveIntervals::HMEditor { class LiveIntervals::HMEditor {
private: private:
LiveIntervals& LIS; LiveIntervals& LIS;
@ -1078,11 +1078,14 @@ public:
} }
void moveAllOperandsInto(MachineInstr* MI, MachineInstr* BundleStart, void moveAllOperandsInto(MachineInstr* MI, MachineInstr* BundleStart) {
SlotIndex OldIdx) {
if (MI == BundleStart) if (MI == BundleStart)
return; // Bundling instr with itself - nothing to do. return; // Bundling instr with itself - nothing to do.
SlotIndex OldIdx = LIS.getSlotIndexes()->getInstructionIndex(MI);
assert(LIS.getSlotIndexes()->getInstructionFromIndex(OldIdx) == MI &&
"SlotIndex <-> Instruction mapping broken for MI");
BundleRanges BR = createBundleRanges(BundleStart); BundleRanges BR = createBundleRanges(BundleStart);
RangeSet Entering, Internal, Exiting; RangeSet Entering, Internal, Exiting;
@ -1201,14 +1204,14 @@ private:
} }
for (RangeSet::iterator EI = Entering.begin(), EE = Entering.end(); for (RangeSet::iterator EI = Entering.begin(), EE = Entering.end();
EI == EE; ++EI) { EI != EE; ++EI) {
LiveInterval* LI = EI->first; LiveInterval* LI = EI->first;
LiveRange* LR = EI->second; LiveRange* LR = EI->second;
BR[LI->reg].Use = LR; BR[LI->reg].Use = LR;
} }
for (RangeSet::iterator II = Internal.begin(), IE = Internal.end(); for (RangeSet::iterator II = Internal.begin(), IE = Internal.end();
II == IE; ++II) { II != IE; ++II) {
LiveInterval* LI = II->first; LiveInterval* LI = II->first;
LiveRange* LR = II->second; LiveRange* LR = II->second;
if (LR->end.isDead()) { if (LR->end.isDead()) {
@ -1219,7 +1222,7 @@ private:
} }
for (RangeSet::iterator EI = Exiting.begin(), EE = Exiting.end(); for (RangeSet::iterator EI = Exiting.begin(), EE = Exiting.end();
EI == EE; ++EI) { EI != EE; ++EI) {
LiveInterval* LI = EI->first; LiveInterval* LI = EI->first;
LiveRange* LR = EI->second; LiveRange* LR = EI->second;
BR[LI->reg].Def = LR; BR[LI->reg].Def = LR;
@ -1350,9 +1353,7 @@ private:
} }
SlotIndex LastUse = findLastUseBefore(LI->reg, OldIdx); SlotIndex LastUse = findLastUseBefore(LI->reg, OldIdx);
// TODO: Kill flag transfer is broken. For "Into" methods NewIdx is the moveKillFlags(LI->reg, OldIdx, LastUse);
// bundle start, so we need another way to find MI.
moveKillFlags(LI->reg, NewIdx, LastUse);
if (LR->start < NewIdx) { if (LR->start < NewIdx) {
// Becoming a new entering range. // Becoming a new entering range.