[llvm] AMDGPU: Delete redundant recursive copy handling code (PR #157032)

Brox Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 26 08:36:46 PDT 2025


================
@@ -207,3 +210,34 @@ body:             |
     $vgpr0 = COPY %4
     S_ENDPGM 0, implicit $vgpr0
 ...
+
+# Make sure the immediate materialized by the v_mov_b16 isn't
+# incorrectly folded into the bfi as 0.
+
+# FIXME: %4:vgpr_32 = COPY %3 is a direct copy from v16 to v32 and
+# should probably fail the verifier
+---
+name:            mov_v16_copy_v32_fold_b32_regression
+tracksRegLiveness: true
+body:             |
+  bb.0:
+    liveins: $vgpr0, $vgpr1
+
+    ; CHECK-LABEL: name: mov_v16_copy_v32_fold_b32_regression
+    ; CHECK: liveins: $vgpr0, $vgpr1
+    ; CHECK-NEXT: {{  $}}
+    ; CHECK-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr1
+    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr0
+    ; CHECK-NEXT: [[V_MOV_B16_t16_e64_:%[0-9]+]]:vgpr_16 = V_MOV_B16_t16_e64 0, 15360, 0, implicit $exec
+    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[V_MOV_B16_t16_e64_]]
+    ; CHECK-NEXT: [[V_BFI_B32_e64_:%[0-9]+]]:vgpr_32 = V_BFI_B32_e64 32767, [[COPY2]], [[COPY1]], implicit $exec
+    ; CHECK-NEXT: $vgpr0 = COPY [[V_BFI_B32_e64_]]
+    ; CHECK-NEXT: SI_RETURN implicit $vgpr0
+    %0:vgpr_32 = COPY $vgpr1
+    %1:vgpr_32 = COPY $vgpr0
+    %3:vgpr_16 = V_MOV_B16_t16_e64 0, 15360, 0, implicit $exec
+    %4:vgpr_32 = COPY %3
----------------
broxigarchen wrote:

Sorry this PR got burried in my mailbox. Hi Matt can you share the test which generates this IR?

I've recently merged several patches to address this illegal COPY issue, so this problem might have gone.

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


More information about the llvm-commits mailing list