[PATCH] D112064: [GlobalISel] Combine (build_vector_trunc x, undef) -> (bitcast x)

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 13 06:16:23 PST 2021


foad added inline comments.


================
Comment at: llvm/test/CodeGen/AMDGPU/GlobalISel/clamp-minmax-const-combine.ll:62
 ; GFX10-NEXT:    s_waitcnt_vscnt null, 0x0
-; GFX10-NEXT:    v_pk_mul_f16 v0, v0, 2.0 op_sel_hi:[1,0] clamp
+; GFX10-NEXT:    v_pk_mul_f16 v0, v0, 2.0 op_sel_hi:[1,0]
+; GFX10-NEXT:    v_pk_max_f16 v1, 0, 0
----------------
Regression here for the same reasons as in combine-fcanonicalize.mir.


================
Comment at: llvm/test/CodeGen/AMDGPU/GlobalISel/combine-fcanonicalize.mir:256
     ; CHECK-NEXT: [[FMUL:%[0-9]+]]:_(<2 x s16>) = G_FMUL [[COPY]], %two_splat
+    ; CHECK-NEXT: %zero_undef_fcan:_(<2 x s16>) = G_FCANONICALIZE %zero_undef
     ; CHECK-NEXT: [[FCANONICALIZE:%[0-9]+]]:_(<2 x s16>) = G_FCANONICALIZE [[FMUL]]
----------------
Regression here because combining `G_BUILD_VECTOR_TRUNC %zero_s32(s32), %undef(s32)` into a G_BITCAST breaks detection of a constant splat with some elements undef.

Any thoughts on how to fix this? Perhaps it was not a good idea to do this as a combine after all, despite the comment in AMDGPUInstructionSelector::selectG_BUILD_VECTOR_TRUNC?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112064/new/

https://reviews.llvm.org/D112064



More information about the llvm-commits mailing list