[PATCH] D76598: [GlobalISel] support narrow G_IMPLICIT_DEF for DstSize % NarrowSize != 0

Dominik Montada via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 23 04:53:40 PDT 2020


gargaroff created this revision.
gargaroff added reviewers: dsanders, aemerson, volkan, arsenm, aditya_nandakumar.
Herald added subscribers: llvm-commits, hiraditya, rovka, wdng.
Herald added a project: LLVM.

When narrowing G_IMPLICIT_DEF where the original size is not a multiple
of the narrow size, emit a smaller G_IMPLICIT_DEF and use G_ANYEXT.
If the destination is a vector, use G_BITCAST to cast to the correct
type.

To prevent a potential endless loop in the legalizer, the condition
to combine G_ANYEXT(G_IMPLICIT_DEF) is changed from isInstUnsupported
to !isInstLegal, since in this case the combine is only valid if
consequent legalization of the newly combined G_IMPLICIT_DEF does not
introduce G_ANYEXT due to narrowing.

Although this legalization for G_IMPLICIT_DEF would also be valid for
the general case, it actually caused a lot of code regressions when
tried due to superfluous COPYs and combines not getting hit anymore.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76598

Files:
  llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
  llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
  llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76598.251989.patch
Type: text/x-patch
Size: 5063 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200323/deae4006/attachment-0001.bin>


More information about the llvm-commits mailing list