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

Pierre van Houtryve via All-commits all-commits at lists.llvm.org
Fri Mar 14 04:16:59 PDT 2025


  Branch: refs/heads/users/pierre-vh/combine-sext-trunc-sextinreg
  Home:   https://github.com/llvm/llvm-project
  Commit: 3289b2373ce2ec850a9bebb597168243d36608a6
      https://github.com/llvm/llvm-project/commit/3289b2373ce2ec850a9bebb597168243d36608a6
  Author: pvanhout <pierre.vanhoutryve at amd.com>
  Date:   2025-03-14 (Fri, 14 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