[PATCH] D65894: [GlobalISel] Legalizer: Retry combining illegal artifacts as long as there new artifacts

Volkan Keles via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 10:52:03 PDT 2019


volkan created this revision.
volkan added reviewers: dsanders, aditya_nandakumar, qcolombet, arsenm, aemerson, paquette.
Herald added subscribers: Petar.Avramovic, hiraditya, javed.absar, rovka, nhaehnle, wdng, jvesely.
Herald added a project: LLVM.

Currently, Legalizer aborts if it’s unable to legalize artifacts. However, it’s
possible to combine them after processing the rest of the instruction because
the legalization is likely to generate more artifacts that allow ArtifactCombiner
to combine away them.

Instead, move illegal artifacts to another list called RetryList and wait until all of the
instruction in InstList are legalized. After that, check if there is any new artifacts and
try to combine them again if that’s the case. If not, abort. The idea is similar to D59339 <https://reviews.llvm.org/D59339>,
but the approach is a bit different.

This patch fixes the issue described above, but the legalizer still may be unable to handle
some cases depending on when to legalize artifacts. So, in the long run, we probably need
a different legalization strategy that handles this dependency in a better way.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65894

Files:
  llvm/lib/CodeGen/GlobalISel/Legalizer.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/legalize-unmerge-values.mir
  llvm/test/CodeGen/AArch64/GlobalISel/retry-artifact-combine.mir
  llvm/test/CodeGen/AMDGPU/GlobalISel/artifact-combiner-sext.mir
  llvm/test/CodeGen/AMDGPU/GlobalISel/artifact-combiner-zext.mir
  llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-and.mir
  llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-extract.mir
  llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-or.mir
  llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-select.mir
  llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-xor.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65894.213950.patch
Type: text/x-patch
Size: 28953 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190807/23da30ee/attachment-0001.bin>


More information about the llvm-commits mailing list