aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-12-05 08:16:32 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-12-05 08:16:32 +0000
commitb50bb8cf197709b3f49044740044c06d8f314564 (patch)
tree99b91225cf4b94022cfe36cea8a8dd9c91964189 /lib/CodeGen/LiveIntervalAnalysis.cpp
parent60fb5eccccf0984e807276ac01e5e9286b199339 (diff)
Fix kill info for split intervals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44609 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index 5c95eb16d8..cc2298a898 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -1267,6 +1267,7 @@ addIntervalsForSpills(const LiveInterval &li,
if (!TrySplit)
return NewLIs;
+ SmallPtrSet<LiveInterval*, 4> AddedKill;
SmallVector<unsigned, 2> Ops;
if (NeedStackSlot) {
int Id = SpillMBBs.find_first();
@@ -1316,8 +1317,13 @@ addIntervalsForSpills(const LiveInterval &li,
}
// Else tell the spiller to issue a spill.
- if (!Folded)
- vrm.addSpillPoint(VReg, MI);
+ if (!Folded) {
+ LiveRange *LR = &nI.ranges[nI.ranges.size()-1];
+ bool isKill = LR->end == getStoreIndex(index);
+ vrm.addSpillPoint(VReg, isKill, MI);
+ if (isKill)
+ AddedKill.insert(&nI);
+ }
}
Id = SpillMBBs.find_next(Id);
}
@@ -1372,24 +1378,28 @@ addIntervalsForSpills(const LiveInterval &li,
// load / rematerialization for us.
if (Folded)
nI.removeRange(getLoadIndex(index), getUseIndex(index)+1);
- else {
+ else
vrm.addRestorePoint(VReg, MI);
- LiveRange *LR = &nI.ranges[nI.ranges.size()-1];
- MachineInstr *LastUse = getInstructionFromIndex(getBaseIndex(LR->end));
- int UseIdx = LastUse->findRegisterUseOperandIdx(VReg);
- assert(UseIdx != -1);
- LastUse->getOperand(UseIdx).setIsKill();
- }
}
Id = RestoreMBBs.find_next(Id);
}
- // Finalize spill weights and filter out dead intervals.
+ // Finalize intervals: add kills, finalize spill weights, and filter out
+ // dead intervals.
std::vector<LiveInterval*> RetNewLIs;
for (unsigned i = 0, e = NewLIs.size(); i != e; ++i) {
LiveInterval *LI = NewLIs[i];
if (!LI->empty()) {
LI->weight /= LI->getSize();
+ if (!AddedKill.count(LI)) {
+ LiveRange *LR = &LI->ranges[LI->ranges.size()-1];
+ MachineInstr *LastUse = getInstructionFromIndex(getBaseIndex(LR->end));
+ int UseIdx = LastUse->findRegisterUseOperandIdx(LI->reg);
+ assert(UseIdx != -1);
+ if (LastUse->getInstrDescriptor()->
+ getOperandConstraint(UseIdx, TOI::TIED_TO) == -1)
+ LastUse->getOperand(UseIdx).setIsKill();
+ }
RetNewLIs.push_back(LI);
}
}