diff options
author | Andrew Trick <atrick@apple.com> | 2013-07-25 07:26:32 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2013-07-25 07:26:32 +0000 |
commit | 4b43ed53b6b4aec95d7c7003e70cb74ac58886e7 (patch) | |
tree | e2022447f7090d024f13d9b953882c81d1bcd92f /lib/CodeGen/RegisterPressure.cpp | |
parent | bba663e30a61b138c8f76632f8cacf00d7b0649a (diff) | |
download | llvm-4b43ed53b6b4aec95d7c7003e70cb74ac58886e7.tar.gz llvm-4b43ed53b6b4aec95d7c7003e70cb74ac58886e7.tar.bz2 llvm-4b43ed53b6b4aec95d7c7003e70cb74ac58886e7.tar.xz |
MI Sched: track register pressure by importance of the set, not weight of the units.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187109 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegisterPressure.cpp')
-rw-r--r-- | lib/CodeGen/RegisterPressure.cpp | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/lib/CodeGen/RegisterPressure.cpp b/lib/CodeGen/RegisterPressure.cpp index 014165978d..4175a4ff85 100644 --- a/lib/CodeGen/RegisterPressure.cpp +++ b/lib/CodeGen/RegisterPressure.cpp @@ -553,9 +553,10 @@ static void computeExcessPressureDelta(ArrayRef<unsigned> OldPressureVec, else if (Limit > PNew) PDiff = Limit - POld; // Just obeyed limit. - if (std::abs(PDiff) > std::abs(ExcessUnits)) { + if (PDiff) { ExcessUnits = PDiff; PSetID = i; + break; } } Delta.Excess.PSetID = PSetID; @@ -583,23 +584,28 @@ static void computeMaxPressureDelta(ArrayRef<unsigned> OldMaxPressureVec, if (PNew == POld) // No change in this set in the common case. continue; - while (CritIdx != CritEnd && CriticalPSets[CritIdx].PSetID < i) - ++CritIdx; + if (!Delta.CriticalMax.isValid()) { + while (CritIdx != CritEnd && CriticalPSets[CritIdx].PSetID < i) + ++CritIdx; - if (CritIdx != CritEnd && CriticalPSets[CritIdx].PSetID == i) { - int PDiff = (int)PNew - (int)CriticalPSets[CritIdx].UnitIncrease; - if (PDiff > Delta.CriticalMax.UnitIncrease) { - Delta.CriticalMax.PSetID = i; - Delta.CriticalMax.UnitIncrease = PDiff; + if (CritIdx != CritEnd && CriticalPSets[CritIdx].PSetID == i) { + int PDiff = (int)PNew - (int)CriticalPSets[CritIdx].UnitIncrease; + if (PDiff > 0) { + Delta.CriticalMax.PSetID = i; + Delta.CriticalMax.UnitIncrease = PDiff; + } } } - - // Find the greatest increase above MaxPressureLimit. + // Find the first increase above MaxPressureLimit. // (Ignores negative MDiff). - int MDiff = (int)PNew - (int)MaxPressureLimit[i]; - if (MDiff > Delta.CurrentMax.UnitIncrease) { - Delta.CurrentMax.PSetID = i; - Delta.CurrentMax.UnitIncrease = MDiff; + if (!Delta.CurrentMax.isValid()) { + int MDiff = (int)PNew - (int)MaxPressureLimit[i]; + if (MDiff > 0) { + Delta.CurrentMax.PSetID = i; + Delta.CurrentMax.UnitIncrease = MDiff; + if (CritIdx == CritEnd || Delta.CriticalMax.isValid()) + break; + } } } } |