[llvm] [AMDGPU] Elide bitcast fold i64 imm to build_vector (PR #154115)
Janek van Oirschot via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 12 07:04:20 PDT 2025
================
@@ -136,19 +135,21 @@ define amdgpu_kernel void @vgpr_mfma_pass_av_split_crash(double %arg1, i1 %arg2,
; CHECK-NEXT: v_cndmask_b32_e64 v23, v23, 0, s[16:17]
; CHECK-NEXT: v_cndmask_b32_e64 v22, v22, 0, s[16:17]
; CHECK-NEXT: v_cndmask_b32_e64 v16, 0, 1, s[8:9]
-; CHECK-NEXT: v_mov_b32_e32 v17, v16
; CHECK-NEXT: s_and_b64 s[8:9], exec, s[16:17]
-; CHECK-NEXT: global_store_dwordx2 v20, v[16:17], s[12:13]
+; CHECK-NEXT: v_mov_b32_e32 v17, v16
; CHECK-NEXT: s_cselect_b32 s23, s23, 0
; CHECK-NEXT: s_cselect_b32 s22, s22, 0
; CHECK-NEXT: s_mov_b64 s[8:9], -1
+; CHECK-NEXT: global_store_dwordx2 v0, v[16:17], s[12:13]
; CHECK-NEXT: s_branch .LBB0_14
; CHECK-NEXT: .LBB0_13: ; in Loop: Header=BB0_2 Depth=1
; CHECK-NEXT: s_mov_b64 s[8:9], 0
; CHECK-NEXT: v_mov_b64_e32 v[22:23], 0
-; CHECK-NEXT: .LBB0_14: ; %Flow6
+; CHECK-NEXT: .LBB0_14: ; %Flow8
; CHECK-NEXT: ; in Loop: Header=BB0_2 Depth=1
-; CHECK-NEXT: v_mov_b64_e32 v[30:31], v[24:25]
+; CHECK-NEXT: v_accvgpr_write_b32 a0, v24
+; CHECK-NEXT: v_mov_b64_e32 v[16:17], 0
+; CHECK-NEXT: v_accvgpr_write_b32 a1, v25
----------------
JanekvO wrote:
This doesn't seem to be necessarily caused by this patch directly but a knock-on effect of a further constrained register with a kernel that requires agpr spilling.
After isel:
```
%149:sreg_32 = S_MOV_B32 0
%150:sreg_64 = REG_SEQUENCE %149:sreg_32, %subreg.sub0, %149:sreg_32, %subreg.sub1
%152:av_64_align2 = COPY %150:sreg_64
```
Becomes:
```
%150:vreg_64_align2 = V_MOV_B64_PSEUDO 0, implicit $exec
```
which is expected for the patch but does limit the possible agpr-spillable instructions.
The conversion seen here is the same as what previous occurred in bb4 which is at the same loop depth. Should it always emit `av_mov_b64_*` pseudo instead of the `v_mov_b64_*` pseudo?
https://github.com/llvm/llvm-project/pull/154115
More information about the llvm-commits
mailing list