[llvm] [AMDGPU][WIP] Optimize SGPR spills (PR #93668)

Vikash Gupta via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 3 03:47:09 PDT 2024


================
@@ -10098,7 +10098,7 @@ define amdgpu_kernel void @test_limited_sgpr(ptr addrspace(1) %out, ptr addrspac
 ; GFX6-NEXT:    s_mov_b64 s[4:5], s[2:3]
 ; GFX6-NEXT:    v_lshlrev_b32_e32 v5, 8, v0
 ; GFX6-NEXT:    buffer_load_dwordx4 v[0:3], v[5:6], s[4:7], 0 addr64 offset:240
-; GFX6-NEXT:    s_mov_b32 s2, 0x84400
+; GFX6-NEXT:    s_mov_b32 s2, 0x86a00
----------------
vg0204 wrote:

I found it. As when you call StackSlotColoring pass eventhough no stack slot usage is done, it also effectively re-assigns the FI to allocated stack slot. As a result, during PEI when actual offset is assigned they also differ. In this patch, the additional invocation of StackSlotColoring pass before SILowerSGPRSpills is just doing re-assignment of FI (with no effective slot re-usage) resulting in different offset assignment. But in overall, no change in stack memory usage (as no scope found for this optimization in this example). 

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


More information about the llvm-commits mailing list