mirror of
https://github.com/RPCSX/llvm.git
synced 2025-04-15 06:30:19 +00:00
Make the remapping of interval indices (particularly ending indices) more robust.
This is tricky business, and will probably take a few more iterations to get the last kinks out of it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54043 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fcaa13a65c
commit
d7dcbecdbc
@ -141,7 +141,7 @@ void LiveIntervals::computeNumbering() {
|
|||||||
unsigned offset = LI->start % InstrSlots::NUM;
|
unsigned offset = LI->start % InstrSlots::NUM;
|
||||||
if (offset == InstrSlots::LOAD) {
|
if (offset == InstrSlots::LOAD) {
|
||||||
std::vector<IdxMBBPair>::const_iterator I =
|
std::vector<IdxMBBPair>::const_iterator I =
|
||||||
std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), index);
|
std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), LI->start);
|
||||||
// Take the pair containing the index
|
// Take the pair containing the index
|
||||||
std::vector<IdxMBBPair>::const_iterator J =
|
std::vector<IdxMBBPair>::const_iterator J =
|
||||||
((I != OldI2MBB.end() && I->first > index) ||
|
((I != OldI2MBB.end() && I->first > index) ||
|
||||||
@ -155,11 +155,11 @@ void LiveIntervals::computeNumbering() {
|
|||||||
// Remap the ending index in the same way that we remapped the start,
|
// Remap the ending index in the same way that we remapped the start,
|
||||||
// except for the final step where we always map to the immediately
|
// except for the final step where we always map to the immediately
|
||||||
// following instruction.
|
// following instruction.
|
||||||
index = LI->end / InstrSlots::NUM;
|
index = (LI->end - 1) / InstrSlots::NUM;
|
||||||
offset = LI->end % InstrSlots::NUM;
|
offset = LI->end % InstrSlots::NUM;
|
||||||
if (offset == InstrSlots::STORE) {
|
if (offset == InstrSlots::USE) {
|
||||||
std::vector<IdxMBBPair>::const_iterator I =
|
std::vector<IdxMBBPair>::const_iterator I =
|
||||||
std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), index);
|
std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), LI->end);
|
||||||
// Take the pair containing the index
|
// Take the pair containing the index
|
||||||
std::vector<IdxMBBPair>::const_iterator J =
|
std::vector<IdxMBBPair>::const_iterator J =
|
||||||
((I != OldI2MBB.end() && I->first > index) ||
|
((I != OldI2MBB.end() && I->first > index) ||
|
||||||
@ -167,7 +167,9 @@ void LiveIntervals::computeNumbering() {
|
|||||||
|
|
||||||
LI->end = getMBBEndIdx(J->second) + 1;
|
LI->end = getMBBEndIdx(J->second) + 1;
|
||||||
} else {
|
} else {
|
||||||
LI->end = mi2iMap_[OldI2MI[index]] + offset;
|
unsigned idx = index;
|
||||||
|
while (!OldI2MI[index]) ++index;
|
||||||
|
LI->end = mi2iMap_[OldI2MI[index]] + (idx == index ? offset : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remap the VNInfo def index, which works the same as the
|
// Remap the VNInfo def index, which works the same as the
|
||||||
@ -177,7 +179,7 @@ void LiveIntervals::computeNumbering() {
|
|||||||
offset = vni->def % InstrSlots::NUM;
|
offset = vni->def % InstrSlots::NUM;
|
||||||
if (offset == InstrSlots::LOAD) {
|
if (offset == InstrSlots::LOAD) {
|
||||||
std::vector<IdxMBBPair>::const_iterator I =
|
std::vector<IdxMBBPair>::const_iterator I =
|
||||||
std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), index);
|
std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), vni->def);
|
||||||
// Take the pair containing the index
|
// Take the pair containing the index
|
||||||
std::vector<IdxMBBPair>::const_iterator J =
|
std::vector<IdxMBBPair>::const_iterator J =
|
||||||
((I != OldI2MBB.end() && I->first > index) ||
|
((I != OldI2MBB.end() && I->first > index) ||
|
||||||
@ -192,11 +194,11 @@ void LiveIntervals::computeNumbering() {
|
|||||||
// Remap the VNInfo kill indices, which works the same as
|
// Remap the VNInfo kill indices, which works the same as
|
||||||
// the end indices above.
|
// the end indices above.
|
||||||
for (size_t i = 0; i < vni->kills.size(); ++i) {
|
for (size_t i = 0; i < vni->kills.size(); ++i) {
|
||||||
index = vni->kills[i] / InstrSlots::NUM;
|
index = (vni->kills[i]-1) / InstrSlots::NUM;
|
||||||
offset = vni->kills[i] % InstrSlots::NUM;
|
offset = vni->kills[i] % InstrSlots::NUM;
|
||||||
if (OldI2MI[vni->kills[i] / InstrSlots::NUM]) {
|
if (offset == InstrSlots::USE) {
|
||||||
std::vector<IdxMBBPair>::const_iterator I =
|
std::vector<IdxMBBPair>::const_iterator I =
|
||||||
std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), index);
|
std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), vni->kills[i]);
|
||||||
// Take the pair containing the index
|
// Take the pair containing the index
|
||||||
std::vector<IdxMBBPair>::const_iterator J =
|
std::vector<IdxMBBPair>::const_iterator J =
|
||||||
((I != OldI2MBB.end() && I->first > index) ||
|
((I != OldI2MBB.end() && I->first > index) ||
|
||||||
@ -204,7 +206,10 @@ void LiveIntervals::computeNumbering() {
|
|||||||
|
|
||||||
vni->kills[i] = getMBBEndIdx(J->second) + 1;
|
vni->kills[i] = getMBBEndIdx(J->second) + 1;
|
||||||
} else {
|
} else {
|
||||||
vni->kills[i] = mi2iMap_[OldI2MI[index]] + offset;
|
unsigned idx = index;
|
||||||
|
while (!OldI2MI[index]) ++index;
|
||||||
|
vni->kills[i] = mi2iMap_[OldI2MI[index]] +
|
||||||
|
(idx == index ? offset : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user