aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2013-08-30 04:27:29 +0000
committerAndrew Trick <atrick@apple.com>2013-08-30 04:27:29 +0000
commitda6fc15f0fb26ebbe42ab96e0d066bbd5bdbb72e (patch)
tree90204955d891351885977e4682ad1d413a421117 /lib/CodeGen
parent4c60b8a78d811a5b16ae45f6957933fb479bab58 (diff)
downloadexternal_llvm-da6fc15f0fb26ebbe42ab96e0d066bbd5bdbb72e.tar.gz
external_llvm-da6fc15f0fb26ebbe42ab96e0d066bbd5bdbb72e.tar.bz2
external_llvm-da6fc15f0fb26ebbe42ab96e0d066bbd5bdbb72e.zip
mi-sched: improve the generic register pressure comparison.
Only compare pressure within the same set. When multiple sets are affected, we prioritize the most constrained set. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189641 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/MachineScheduler.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/CodeGen/MachineScheduler.cpp b/lib/CodeGen/MachineScheduler.cpp
index ffab5f4e66..e233d4af44 100644
--- a/lib/CodeGen/MachineScheduler.cpp
+++ b/lib/CodeGen/MachineScheduler.cpp
@@ -2182,21 +2182,19 @@ static bool tryPressure(const PressureChange &TryP,
ConvergingScheduler::SchedCandidate &TryCand,
ConvergingScheduler::SchedCandidate &Cand,
ConvergingScheduler::CandReason Reason) {
- if (TryP.isValid() && CandP.isValid()) {
- // If both candidates affect the same set, go with the smallest increase.
- if (TryP.getPSet() == CandP.getPSet()) {
- return tryLess(TryP.getUnitInc(), CandP.getUnitInc(), TryCand, Cand,
- Reason);
- }
- // If one candidate decreases and the other increases, go with it.
- if (tryLess(TryP.getUnitInc() < 0, CandP.getUnitInc() < 0, TryCand, Cand,
- Reason)) {
- return true;
- }
+ int TryRank = TryP.getPSetOrMax();
+ int CandRank = CandP.getPSetOrMax();
+ // If both candidates affect the same set, go with the smallest increase.
+ if (TryRank == CandRank) {
+ return tryLess(TryP.getUnitInc(), CandP.getUnitInc(), TryCand, Cand,
+ Reason);
+ }
+ // If one candidate decreases and the other increases, go with it.
+ // Invalid candidates have UnitInc==0.
+ if (tryLess(TryP.getUnitInc() < 0, CandP.getUnitInc() < 0, TryCand, Cand,
+ Reason)) {
+ return true;
}
- // If TryP has lower Rank, it has a higher priority.
- int TryRank = TryP.getRank();
- int CandRank = CandP.getRank();
// If the candidates are decreasing pressure, reverse priority.
if (TryP.getUnitInc() < 0)
std::swap(TryRank, CandRank);