[llvm] 1873c74 - [AMDGPU] Add test for early release VGPRs with spills (#178444)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 28 08:05:40 PST 2026


Author: Jay Foad
Date: 2026-01-28T16:05:35Z
New Revision: 1873c746c6a79fcfd3f5e5884b42f3843cc7c5aa

URL: https://github.com/llvm/llvm-project/commit/1873c746c6a79fcfd3f5e5884b42f3843cc7c5aa
DIFF: https://github.com/llvm/llvm-project/commit/1873c746c6a79fcfd3f5e5884b42f3843cc7c5aa.diff

LOG: [AMDGPU] Add test for early release VGPRs with spills (#178444)

Added: 
    llvm/test/CodeGen/AMDGPU/release-vgprs-spill.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/AMDGPU/release-vgprs-spill.ll b/llvm/test/CodeGen/AMDGPU/release-vgprs-spill.ll
new file mode 100644
index 0000000000000..2d204e8ef5718
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/release-vgprs-spill.ll
@@ -0,0 +1,49 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
+; RUN: opt -mtriple=amdgcn -passes=amdgpu-attributor < %s | llc -mtriple=amdgcn -mcpu=gfx1100 | FileCheck %s
+
+; This function uses scratch_store to spill some values to the stack. While
+; these stores are potentially outstanding it should not send the DEALLOC_VGPRS
+; message. FIXME.
+
+define amdgpu_kernel void @f(ptr %ptr, i32 %arg) "amdgpu-flat-work-group-size"="64,64" {
+; CHECK-LABEL: f:
+; CHECK:       ; %bb.0:
+; CHECK-NEXT:    s_load_b64 s[2:3], s[0:1], 0x24
+; CHECK-NEXT:    v_lshlrev_b32_e32 v0, 2, v0
+; CHECK-NEXT:    s_load_b32 s0, s[0:1], 0x2c
+; CHECK-NEXT:    scratch_store_b32 off, v0, off offset:4 ; 4-byte Folded Spill
+; CHECK-NEXT:    s_waitcnt lgkmcnt(0)
+; CHECK-NEXT:    global_load_b32 v0, v0, s[2:3]
+; CHECK-NEXT:    s_bitcmp0_b32 s0, 0
+; CHECK-NEXT:    s_waitcnt vmcnt(0)
+; CHECK-NEXT:    scratch_store_b32 off, v0, off ; 4-byte Folded Spill
+; CHECK-NEXT:    ;;#ASMSTART
+; CHECK-NEXT:    ; clobber
+; CHECK-NEXT:    ;;#ASMEND
+; CHECK-NEXT:    s_cbranch_scc1 .LBB0_2
+; CHECK-NEXT:  ; %bb.1: ; %true
+; CHECK-NEXT:    s_clause 0x1 ; 8-byte Folded Reload
+; CHECK-NEXT:    scratch_load_b32 v0, off, off offset:4
+; CHECK-NEXT:    scratch_load_b32 v2, off, off
+; CHECK-NEXT:    s_waitcnt vmcnt(1)
+; CHECK-NEXT:    v_add_co_u32 v0, s0, s2, v0
+; CHECK-NEXT:    s_delay_alu instid0(VALU_DEP_1)
+; CHECK-NEXT:    v_add_co_ci_u32_e64 v1, null, s3, 0, s0
+; CHECK-NEXT:    s_waitcnt vmcnt(0)
+; CHECK-NEXT:    global_store_b32 v[0:1], v2, off
+; CHECK-NEXT:  .LBB0_2: ; %false
+; CHECK-NEXT:    s_nop 0
+; CHECK-NEXT:    s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
+; CHECK-NEXT:    s_endpgm
+  %tid = call i32 @llvm.amdgcn.workitem.id.x()
+  %gep = getelementptr i32, ptr %ptr, i32 %tid
+  %val = load i32, ptr %gep
+  call void asm "; clobber", "~{v[0:31]},~{v[32:63]},~{v[64:95]},~{v[96:127]},~{v[128:159]},~{v[160:191]},~{v[192:223]},~{v[224:255]},~{memory}" ()
+  %cond = trunc i32 %arg to i1
+  br i1 %cond, label %true, label %false
+true:
+  store i32 %val, ptr %gep
+  br label %false
+false:
+  ret void
+}


        


More information about the llvm-commits mailing list