[all-commits] [llvm/llvm-project] 4751d3: [AMDGPU][GlobalISel] Combine (sext (trunc (sext_in...

Pierre van Houtryve via All-commits all-commits at lists.llvm.org
Mon Mar 17 01:49:33 PDT 2025


  Branch: refs/heads/users/pierre-vh/combine-sext-trunc-sextinreg
  Home:   https://github.com/llvm/llvm-project
  Commit: 4751d38d86886106c00e9140bf0bb3a3459950cb
      https://github.com/llvm/llvm-project/commit/4751d38d86886106c00e9140bf0bb3a3459950cb
  Author: pvanhout <pierre.vanhoutryve at amd.com>
  Date:   2025-03-17 (Mon, 17 Mar 2025)

  Changed paths:
    M llvm/include/llvm/Target/GlobalISel/Combine.td
    A llvm/test/CodeGen/AMDGPU/GlobalISel/combine-sext-trunc-sextinreg.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.abs.ll

  Log Message:
  -----------
  [AMDGPU][GlobalISel] Combine (sext (trunc (sext_in_reg x)))

This is a bit of an akward pattern that can come up as a result
of legalization and then widening of i16 operations to i32 in RegBankSelect
on AMDGPU.

This quick combine avoids redundant patterns like
```
s_sext_i32_i8 s0, s0
s_sext_i32_i16 s0, s0
s_ashr_i32 s0, s0, s1
```

With this the second sext is removed as it's redundant.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list