[llvm-branch-commits] [llvm] [AMDGPU] Fix inconsistencies in RP tracking `advance`/`reset` behavior (PR #196099)

Lucas Ramirez via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri May 8 08:17:23 PDT 2026


================
@@ -1029,8 +1029,13 @@ GCNScheduleDAGMILive::getRealRegPressure(unsigned RegionIdx) const {
   if (Regions[RegionIdx].first == Regions[RegionIdx].second)
     return llvm::getRegPressure(MRI, LiveIns[RegionIdx]);
   GCNDownwardRPTracker RPTracker(*LIS);
-  RPTracker.advance(Regions[RegionIdx].first, Regions[RegionIdx].second,
-                    &LiveIns[RegionIdx]);
+  if (!RPTracker.advance(Regions[RegionIdx].first, Regions[RegionIdx].second,
+                         &LiveIns[RegionIdx])) {
+    // Advance can produce false on a non-empty region if all MIs in the region
+    // are debug values; in such cases the maintained max pressure is invalid
+    // and the only source of pressure are the region's live-ins.
----------------
lucas-rami wrote:

It's possible for the RP tracker to compute the correct pressure when a `LiveRegSet` is provided to advance/reset, since it can just call `llvm::getRegPressure`. When a `LiveRegSet` is not provided however, the tracker must look for a `SlotIndex` at which to estimate pressure. When there are no non-debug MIs in the block, I don't see a way to derive such an index and therefore to compute the correct pressure. It felt weird to me to have this dependency on `LiveRegSet` to be able to compute the correct pressure in such cases.

https://github.com/llvm/llvm-project/pull/196099


More information about the llvm-branch-commits mailing list