[llvm-branch-commits] [llvm] AMDGPU/GlobalISel: Bitcasting G_TRUNC combine (PR #217634)

Petar Avramovic via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Sep 2 03:04:10 PDT 2026


================
@@ -255,6 +255,17 @@ def combine_or_s64_s32 : GICombineRule<
          (G_OR $or, $x_lo, $y),
          (G_MERGE_VALUES $dst, $or, $x_hi))>;
 
+// (bitcast (trunc i32:$src)) -> (trunc i32:$src) with the bitcast result type.
+// Both are scalars of the same size, so only the LLT kind differs; keeping the
+// trunc alone lets matchers that look through a trunc chain still fire.
+def bitcast_of_trunc : GICombineRule<
----------------
petar-avramovic wrote:

Right, but what's the alternative then? new artifact like opcode G_BITCASTING_TRUNC G_BITCASTING_ANYEXT?

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


More information about the llvm-branch-commits mailing list