mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
Discard split intervals made empty due to folding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44565 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1234,6 +1234,7 @@ addIntervalsForSpills(const LiveInterval &li,
|
|||||||
for (unsigned i = 0, e = spills.size(); i != e; ++i) {
|
for (unsigned i = 0, e = spills.size(); i != e; ++i) {
|
||||||
int index = spills[i].index;
|
int index = spills[i].index;
|
||||||
unsigned VReg = spills[i].vreg;
|
unsigned VReg = spills[i].vreg;
|
||||||
|
LiveInterval &nI = getOrCreateInterval(VReg);
|
||||||
bool isReMat = vrm.isReMaterialized(VReg);
|
bool isReMat = vrm.isReMaterialized(VReg);
|
||||||
MachineInstr *MI = getInstructionFromIndex(index);
|
MachineInstr *MI = getInstructionFromIndex(index);
|
||||||
bool CanFold = false;
|
bool CanFold = false;
|
||||||
@ -1269,6 +1270,7 @@ addIntervalsForSpills(const LiveInterval &li,
|
|||||||
if (FoundUse > 0)
|
if (FoundUse > 0)
|
||||||
// Also folded uses, do not issue a load.
|
// Also folded uses, do not issue a load.
|
||||||
eraseRestoreInfo(Id, index, VReg, RestoreMBBs, RestoreIdxes);
|
eraseRestoreInfo(Id, index, VReg, RestoreMBBs, RestoreIdxes);
|
||||||
|
nI.removeRange(getDefIndex(index), getStoreIndex(index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1288,6 +1290,7 @@ addIntervalsForSpills(const LiveInterval &li,
|
|||||||
if (index == -1)
|
if (index == -1)
|
||||||
continue;
|
continue;
|
||||||
unsigned VReg = restores[i].vreg;
|
unsigned VReg = restores[i].vreg;
|
||||||
|
LiveInterval &nI = getOrCreateInterval(VReg);
|
||||||
MachineInstr *MI = getInstructionFromIndex(index);
|
MachineInstr *MI = getInstructionFromIndex(index);
|
||||||
bool CanFold = false;
|
bool CanFold = false;
|
||||||
Ops.clear();
|
Ops.clear();
|
||||||
@ -1326,15 +1329,23 @@ addIntervalsForSpills(const LiveInterval &li,
|
|||||||
}
|
}
|
||||||
// If folding is not possible / failed, then tell the spiller to issue a
|
// If folding is not possible / failed, then tell the spiller to issue a
|
||||||
// load / rematerialization for us.
|
// load / rematerialization for us.
|
||||||
if (!Folded)
|
if (Folded)
|
||||||
|
nI.removeRange(getLoadIndex(index), getUseIndex(index)+1);
|
||||||
|
else
|
||||||
vrm.addRestorePoint(VReg, MI);
|
vrm.addRestorePoint(VReg, MI);
|
||||||
}
|
}
|
||||||
Id = RestoreMBBs.find_next(Id);
|
Id = RestoreMBBs.find_next(Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finalize spill weights.
|
// Finalize spill weights and filter out dead intervals.
|
||||||
for (unsigned i = 0, e = NewLIs.size(); i != e; ++i)
|
std::vector<LiveInterval*> RetNewLIs;
|
||||||
NewLIs[i]->weight /= NewLIs[i]->getSize();
|
for (unsigned i = 0, e = NewLIs.size(); i != e; ++i) {
|
||||||
|
LiveInterval *LI = NewLIs[i];
|
||||||
|
if (!LI->empty()) {
|
||||||
|
LI->weight /= LI->getSize();
|
||||||
|
RetNewLIs.push_back(LI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NewLIs;
|
return RetNewLIs;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user