1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

RegisterPressure: Remove 0 entries from PressureChange

This should not change behaviour because as far as I can see all code
reading the pressure changes has no effect if the PressureInc is 0.
Removing these entries however does avoid unnecessary computation, and
results in a more stable debug output. I want the stable debug output to
check that some upcoming changes are indeed NFC and identical even at
the debug output level.

llvm-svn: 250595
This commit is contained in:
Matthias Braun 2015-10-17 00:35:59 +00:00
parent 3a6238ae8f
commit 24b9e3b760

View File

@ -79,8 +79,8 @@ void RegPressureTracker::dump() const {
void PressureDiff::dump(const TargetRegisterInfo &TRI) const {
for (const PressureChange &Change : *this) {
if (!Change.isValid() || Change.getUnitInc() == 0)
continue;
if (!Change.isValid())
break;
dbgs() << " " << TRI.getRegPressureSetName(Change.getPSet())
<< " " << Change.getUnitInc();
}
@ -401,10 +401,20 @@ void PressureDiff::addPressureChange(unsigned RegUnit, bool IsDec,
if (!I->isValid() || I->getPSet() != *PSetI) {
PressureChange PTmp = PressureChange(*PSetI);
for (PressureDiff::iterator J = I; J != E && PTmp.isValid(); ++J)
std::swap(*J,PTmp);
std::swap(*J, PTmp);
}
// Update the units for this pressure set.
I->setUnitInc(I->getUnitInc() + Weight);
unsigned NewUnitInc = I->getUnitInc() + Weight;
if (NewUnitInc != 0) {
I->setUnitInc(NewUnitInc);
} else {
// Remove entry
PressureDiff::iterator J;
for (J = std::next(I); J != E && J->isValid(); ++J, ++I)
*I = *J;
if (J != E)
*I = *J;
}
}
}