[all-commits] [llvm/llvm-project] 1cb12f: [GlobalISel] Combine unmerge(unmerge()) if the res...

David Green via All-commits all-commits at lists.llvm.org
Tue Sep 24 23:04:31 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1cb12fa9edd744fe72897660541f7841401823c6
      https://github.com/llvm/llvm-project/commit/1cb12fa9edd744fe72897660541f7841401823c6
  Author: David Green <david.green at arm.com>
  Date:   2024-09-25 (Wed, 25 Sep 2024)

  Changed paths:
    M llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
    M llvm/test/CodeGen/AArch64/GlobalISel/legalize-cmp.mir
    M llvm/test/CodeGen/AArch64/GlobalISel/legalize-select.mir
    M llvm/test/CodeGen/AArch64/bswap.ll
    M llvm/test/CodeGen/AArch64/fixed-vector-deinterleave.ll
    M llvm/test/CodeGen/AArch64/fpext.ll
    M llvm/test/CodeGen/AArch64/fptoi.ll
    M llvm/test/CodeGen/AArch64/fptosi-sat-vector.ll
    M llvm/test/CodeGen/AArch64/fptoui-sat-vector.ll
    M llvm/test/CodeGen/AArch64/fptrunc.ll
    M llvm/test/CodeGen/AArch64/itofp.ll
    M llvm/test/CodeGen/AArch64/neon-perm.ll
    M llvm/test/CodeGen/AArch64/sadd_sat_vec.ll
    M llvm/test/CodeGen/AArch64/shift.ll
    M llvm/test/CodeGen/AArch64/shufflevector.ll
    M llvm/test/CodeGen/AArch64/ssub_sat_vec.ll
    M llvm/test/CodeGen/AArch64/uadd_sat_vec.ll
    M llvm/test/CodeGen/AArch64/usub_sat_vec.ll
    M llvm/test/CodeGen/AMDGPU/GlobalISel/artifact-combiner-unmerge-values.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-store-global.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-trunc.mir

  Log Message:
  -----------
  [GlobalISel] Combine unmerge(unmerge()) if the result is legal. (#109606)

This attempts to fold:
```
  %1:_(<2 x s32>), %2:_(<2 x s32>) = G_UNMERGE_VALUES %0:_(<4 x s32>)
  %3:_(s32), %4:_(s32) = G_UNMERGE_VALUES %1
```
Into a single UNMERGE:
```
  %3:_(s32), %4:_(s32), %5:_(s32), %6:_(s32) = G_UNMERGE_VALUES %0
```

This transform already exists, this patch alters it to occur when the
result UNMERGE is considered legal.

It does not try to transform where the result would be extracting a
subelement from a vector at the moment, as the code is not setup to
handle it.
```
  %1:_(s32), %2:_(s32) = G_UNMERGE_VALUES %0:_(<2 x s32>)
  %3:_(s16), %4:_(s16) = G_UNMERGE_VALUES %1
```

This helps us reduce the amount of legalization artefacts, especially
from widened vectors padded with undef.



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