[PATCH] D78191: [GlobalISel] Fix invalid combine of unmerge(merge) with intermediate cast

Dominik Montada via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 03:47:21 PDT 2020


gargaroff created this revision.
gargaroff added reviewers: arsenm, dsanders, aemerson, paquette, aditya_nandakumar.
Herald added subscribers: llvm-commits, kerbowa, rovka, nhaehnle, wdng, jvesely.
Herald added a project: LLVM.
gargaroff edited the summary of this revision.
Herald added a subscriber: tpr.

The combine for unmerge(cast(merge)) is only valid for vectors, but was
missing a corresponding check. Add a check that the operands are vectors
to avoid an invalid combine.

Without this check, the combiner would emit incorrect code for scalars
and pointers because the artifact cast (trunc/ext) only affects bits at
the end of the type, while this combine assumes that the casted bits
appear between meaningful bits.

This also uncovered a segmentation fault in the AMDGPU
InstructionSelector. The tests triggering this bug have been moved to
their own file and a check for the segmentation fault has been added.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78191

Files:
  llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
  llvm/test/CodeGen/AMDGPU/GlobalISel/artifact-combiner-unmerge-values.mir
  llvm/test/CodeGen/AMDGPU/GlobalISel/cvt_f32_ubyte-xfail.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/cvt_f32_ubyte.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-bitcast.mir
  llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-merge-values.mir
  llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-unmerge-values.mir
  llvm/test/CodeGen/AMDGPU/GlobalISel/zextload-xfail.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/zextload.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78191.257656.patch
Type: text/x-patch
Size: 150237 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200415/f93fe27f/attachment-0001.bin>


More information about the llvm-commits mailing list