[PATCH] D14806: MachineScheduler: Add a target hook for deciding which RegPressure sets to increase

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 24 16:24:05 PST 2015


MatzeB added a reviewer: atrick.
MatzeB added a comment.

As this method is only usefull inside the MachineScheduler, maybe a better place for it would be MachineSchedStragy?

Also adding Andy for comments/review.


================
Comment at: lib/CodeGen/MachineScheduler.cpp:2585-2602
@@ -2583,13 +2584,20 @@
+                        const MachineFunction &MF) {
   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 (tryGreater(TryP.getUnitInc() < 0, CandP.getUnitInc() < 0, TryCand, Cand,
                  Reason)) {
     return true;
   }
+
+  if (TryP.isValid())
+    TryRank = TRI->getRegPressureSetScore(MF, TryRank);
+  if (CandP.isValid())
+    CandRank =TRI->getRegPressureSetScore(MF, CandRank);
+
----------------
The "if (TryRank == CandRank)" is confusing, even more so after the rank adjustments here. I think using  unsigned TryPSet, CandPSet at first and introducing unsigned TryRank, CandRank at the place of the getPressureSetScore() calls could help.


http://reviews.llvm.org/D14806





More information about the llvm-commits mailing list