[llvm] [AMDGPU] Improved register pressure estimates for rescheduling (PR #213116)

Lucas Ramirez via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 04:57:52 PDT 2026


================
@@ -1213,3 +1214,83 @@ LLVM_DUMP_METHOD void llvm::dumpMaxRegPressure(MachineFunction &MF,
   }
 }
 #endif
+
+unsigned llvm::estimateGreedyVGPRPressure(
+    MachineBasicBlock::const_iterator RegionBegin,
+    MachineBasicBlock::const_iterator RegionEnd,
+    const GCNRPTracker::LiveRegSet &LiveIns, LiveIntervals &LIS,
+    const MachineRegisterInfo &MRI, const SIRegisterInfo &TRI) {
+
+  SmallVector<LiveInterval *> RegionIntervals;
+  SmallPtrSet<LiveInterval *, 32> Seen;
----------------
lucas-rami wrote:

Can you combine both into a `[Small]SetVector<LiveInterval*>`? Also 32 feels like a "big" value for a "small" version, mostly because contain queries will perform a linear scan for a set up to that size. I suppose we will have more than 32 registers in the majority of cases so we probably don't need the small stack allocation behavior.

You can also reserve enough space for `LiveIns.size()` elements right away.

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


More information about the llvm-commits mailing list