[llvm] [AMDGPU][NFC] Print the peak pressure across an instruction in downward RP mode (PR #228291)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 1 17:59:41 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Dhruva Chakrabarti (dhruvachak)
<details>
<summary>Changes</summary>
The register pressure printer reports two columns per instruction. In upward mode, the second one is the tracker's MaxPressure. In downward mode it was the pressure after the instruction.
Report MaxPressure in both modes. This is NFC today, because the downward tracker only updates MaxPressure once at the end of advanceToNext(), so the peak and the pressure after the instruction are the same value.
Assisted-by: Cursor/Claude Opus
---
Full diff: https://github.com/llvm/llvm-project/pull/228291.diff
2 Files Affected:
- (modified) llvm/lib/Target/AMDGPU/GCNRegPressure.cpp (+2-1)
- (modified) llvm/lib/Target/AMDGPU/GCNRegPressure.h (+4-4)
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp b/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
index 8f9362e19bf85..2a4f0f2745401 100644
--- a/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
@@ -1026,8 +1026,9 @@ bool GCNRegPressurePrinter::runOnMachineFunction(MachineFunction &MF) {
while (!RPT.advanceBeforeNext()) {
GCNRegPressure RPBeforeMI = RPT.getPressure();
+ RPT.resetMaxPressure();
RPT.advanceToNext();
- RP.emplace_back(RPBeforeMI, RPT.getPressure());
+ RP.emplace_back(RPBeforeMI, RPT.getMaxPressure());
}
LiveOut = RPT.getLiveRegs();
diff --git a/llvm/lib/Target/AMDGPU/GCNRegPressure.h b/llvm/lib/Target/AMDGPU/GCNRegPressure.h
index 307b22759f352..fc8ff6c9c7b18 100644
--- a/llvm/lib/Target/AMDGPU/GCNRegPressure.h
+++ b/llvm/lib/Target/AMDGPU/GCNRegPressure.h
@@ -353,6 +353,10 @@ class GCNRPTracker {
void clearMaxPressure() { MaxPressure.clear(); }
+ const GCNRegPressure &getMaxPressure() const { return MaxPressure; }
+
+ void resetMaxPressure() { MaxPressure = CurPressure; }
+
GCNRegPressure getPressure() const { return CurPressure; }
decltype(LiveRegs) moveLiveRegs() {
@@ -387,10 +391,6 @@ class GCNUpwardRPTracker : public GCNRPTracker {
/// to reported by LIS.
bool isValid() const;
- const GCNRegPressure &getMaxPressure() const { return MaxPressure; }
-
- void resetMaxPressure() { MaxPressure = CurPressure; }
-
GCNRegPressure getMaxPressureAndReset() {
GCNRegPressure RP = MaxPressure;
resetMaxPressure();
``````````
</details>
https://github.com/llvm/llvm-project/pull/228291
More information about the llvm-commits
mailing list