[llvm] [AMDGPU] Refresh RegisterClassInfo after reserving WWM registers (PR #221849)
Christudasan Devadasan via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 7 23:36:14 PDT 2026
================
@@ -0,0 +1,121 @@
+; RUN: llc -mtriple=amdgpu9.50-amd-amdhsa < %s \
+; RUN: | FileCheck %s --implicit-check-not='v_mov_b32_e32 v23,'
+; RUN: llc -enable-new-pm -mtriple=amdgpu9.50-amd-amdhsa < %s \
+; RUN: | FileCheck %s --implicit-check-not='v_mov_b32_e32 v23,'
+
+; The "amdgpu-num-vgpr"="24" attribute leaves v0..v23 addressable and the WWM
+; allocator takes v23 for the SGPR spill lanes. AMDGPUReserveWWMRegs used to
+; reserve it without refreshing the shared RegisterClassInfo, so
+; AMDGPURewriteAGPRCopyMFMA was still offered v23 and its spill slot elimination
+; assigned it: an assertion in VirtRegMap with assertions on, a silent clobber
+; of the spilled SGPRs without.
+;
+; The implicit-check-not is what catches that clobber without assertions. The
+; MFMA and ScratchSize checks stop the test passing vacuously if the rewrite
+; stops running or the kernel stops spilling.
+
+; CHECK-LABEL: {{^}}reserved_wwm_vgpr_not_in_alloc_order:
----------------
cdevadas wrote:
The handpicked check lines are hard to maintain. We should autogenerate the check lines. However, I see your temptation to check only specific lines.
I would have auto-generated it.
https://github.com/llvm/llvm-project/pull/221849
More information about the llvm-commits
mailing list