[AMDGPU] Free reserved VGPR if no SGPR spill
I met some code generation behavior change when I tried to remove the hasStackObject() check when reserving VGPR for SGPR spill. For example, the function `callee_no_stack_no_fp_elim_all` in the lit test file `callee-frame-setup.ll`. The generated code changed from: ``` s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) s_mov_b32 s4, s33 s_mov_b32 s33, s32 s_mov_b32 s33, s4 s_setpc_b64 s[30:31] ``` into something like: ``` s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) v_writelane_b32 v63, s33, 0 s_mov_b32 s33, s32 v_readlane_b32 s33, v63, 0 s_setpc_b64 s[30:31] ``` I think we still prefer the old version where only scalar instructions are needed. The idea here is free the reserved VGPR if no SGPR spills. So we will very likely to use a free SGPR for fp/sp spill. Reviewed by: arsenm Differential Revision: https://reviews.llvm.org/D98344
Loading
Please register or sign in to comment