1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Process all dead defs after rematerializing during splitting.

llvm-svn: 127973
This commit is contained in:
Jakob Stoklund Olesen 2011-03-20 19:46:23 +00:00
parent b5c6ae67ac
commit 7f9de06cc4

View File

@ -789,30 +789,23 @@ void SplitEditor::rewriteAssigned(bool ExtendRanges) {
void SplitEditor::deleteRematVictims() {
SmallVector<MachineInstr*, 8> Dead;
for (LiveInterval::const_vni_iterator I = Edit->getParent().vni_begin(),
E = Edit->getParent().vni_end(); I != E; ++I) {
const VNInfo *VNI = *I;
// Was VNI rematted anywhere?
if (VNI->isUnused() || VNI->isPHIDef() || !Edit->didRematerialize(VNI))
continue;
unsigned RegIdx = RegAssign.lookup(VNI->def);
LiveInterval *LI = Edit->get(RegIdx);
LiveInterval::const_iterator LII = LI->FindLiveRangeContaining(VNI->def);
assert(LII != LI->end() && "Missing live range for rematted def");
for (LiveRangeEdit::iterator I = Edit->begin(), E = Edit->end(); I != E; ++I){
LiveInterval *LI = *I;
for (LiveInterval::const_iterator LII = LI->begin(), LIE = LI->end();
LII != LIE; ++LII) {
// Dead defs end at the store slot.
if (LII->end != LII->valno->def.getNextSlot())
continue;
MachineInstr *MI = LIS.getInstructionFromIndex(LII->valno->def);
assert(MI && "Missing instruction for dead def");
MI->addRegisterDead(LI->reg, &TRI);
// Is this a dead def?
if (LII->end != VNI->def.getNextSlot())
continue;
if (!MI->allDefsAreDead())
continue;
MachineInstr *MI = LIS.getInstructionFromIndex(VNI->def);
assert(MI && "Missing instruction for dead def");
MI->addRegisterDead(LI->reg, &TRI);
if (!MI->allDefsAreDead())
continue;
DEBUG(dbgs() << "All defs dead: " << *MI);
Dead.push_back(MI);
DEBUG(dbgs() << "All defs dead: " << *MI);
Dead.push_back(MI);
}
}
if (Dead.empty())