GlobalISel: Combine G_UNMERGE_VALUES with G_TRUNC
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Sat, 4 Apr 2020 19:07:28 +0000 (15:07 -0400)
committerMatt Arsenault <arsenm2@gmail.com>
Sat, 9 May 2020 20:14:32 +0000 (16:14 -0400)
commitee1a69824d9a9fceea2b51616c3363c4d210af4c
tree7bad17fde13e27758b6a049a13f1dee7dbec23b7
parent16295d521e294b27106e51fac29957c1aac8ff89
GlobalISel: Combine G_UNMERGE_VALUES with G_TRUNC

G_BITCAST can be lowered with a pair of G_UNMERGE_VALUES and
G_MERGE_VALUES with different types, but G_UNMERGE_VALUES of a vector
can also be implemented with a bitcast to a scalar, which introduces
the possibility for infinite loops. Try to eliminate an illegal source
register type in the artifact combiner to avoid this from happening.

Avoids infinite looping in the legalizer in a future patch which
allows lowering G_UNMERGE_VALUES of a vector source with a G_BITCAST.
14 files changed:
llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
llvm/test/CodeGen/AArch64/GlobalISel/legalize-select.mir
llvm/test/CodeGen/AArch64/arm64-vabs.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/artifact-combiner-sext.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/artifact-combiner-unmerge-values.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-and.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-bitcast.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-or.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-select.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-sext-inreg.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-trunc.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-unmerge-values-xfail.mir [deleted file]
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-unmerge-values.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-xor.mir