[all-commits] [llvm/llvm-project] c0241f: [GlobalISel] combine G_TRUNC with G_MERGE_VALUES

Dominik Montada via All-commits all-commits at lists.llvm.org
Mon Mar 16 06:42:06 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c0241f150dcb0a5c6abd2955310d6cc8ef7b9f94
      https://github.com/llvm/llvm-project/commit/c0241f150dcb0a5c6abd2955310d6cc8ef7b9f94
  Author: Dominik Montada <dominik.montada at hightec-rt.com>
  Date:   2020-03-16 (Mon, 16 Mar 2020)

  Changed paths:
    M llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
    M llvm/test/CodeGen/AArch64/GlobalISel/legalize-undef.mir
    A llvm/test/CodeGen/AMDGPU/GlobalISel/artifact-combiner-trunc.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-bitcast.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-ctlz-zero-undef.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-ctlz.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-merge-values.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-unmerge-values.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-zext.mir
    M llvm/test/CodeGen/Mips/GlobalISel/legalizer/bitwise.mir
    M llvm/test/CodeGen/Mips/GlobalISel/legalizer/trunc.mir
    M llvm/test/CodeGen/Mips/GlobalISel/legalizer/zextLoad_and_sextLoad.mir
    M llvm/test/CodeGen/Mips/GlobalISel/legalizer/zext_and_sext.mir
    M llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/zextLoad_and_sextLoad.ll
    M llvm/test/CodeGen/Mips/GlobalISel/llvm-ir/zext_and_sext.ll

  Log Message:
  -----------
  [GlobalISel] combine G_TRUNC with G_MERGE_VALUES

Summary:
Truncating the result of a merge means that most likely we could have done without merge in the first place and just used the input merge inputs directly. This can be done in three cases:

1. If the truncation result is smaller than the merge source, we can use the source in the trunc directly
2. If the sizes are the same, we can replace the register or use a copy
3. If the truncation size is a multiple of the merge source size, we can build a smaller merge

This gets rid of most of the larger, hard-to-legalize merges.

Reviewers: qcolombet, aditya_nandakumar, aemerson, paquette, arsenm, Petar.Avramovic

Reviewed By: arsenm

Subscribers: sdardis, jvesely, wdng, nhaehnle, rovka, jrtc27, atanasyan, kerbowa, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D75915




More information about the All-commits mailing list