[PATCH] D135044: [GlobalISel] Allow prelegalizer combiners to have access to LegalizerInfo.

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 2 15:08:10 PDT 2022


aemerson created this revision.
aemerson added reviewers: paquette, arsenm, foad.
aemerson added a project: LLVM.
Herald added subscribers: kosarev, kerbowa, atanasyan, jrtc27, hiraditya, rovka, nhaehnle, jvesely, sdardis.
Herald added a project: All.
aemerson requested review of this revision.
Herald added a subscriber: wdng.

Before, the isPreLegalize() query in CombinerHelper only checked for the
presence of a LegalizerInfo object. This is problematic when we want to have
a combine actually check for legality in a pre-legalizer combine pass, since
if we pass a LegalizerInfo object to the constructor it causes the combines to
think that we're running *post* legalizer, which isn't true.

This change fixes it to instead check an explicit bool that passes to signal
whether the pass will be run before or after legalization.

Doing so exposed a bug in the extending loads combine, which tried to check for
legality of candidate extending loads if LegalizerInfo was present. Since we
only ran it pre-legalizer and therefore with a null LegalizerInfo, it never
actually ran. Also fixes the legality checks to keep the tests passing.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135044

Files:
  llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
  llvm/lib/Target/AArch64/GISel/AArch64O0PreLegalizerCombiner.cpp
  llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerCombiner.cpp
  llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
  llvm/lib/Target/AArch64/GISel/AArch64PreLegalizerCombiner.cpp
  llvm/lib/Target/AMDGPU/AMDGPUPostLegalizerCombiner.cpp
  llvm/lib/Target/AMDGPU/AMDGPUPreLegalizerCombiner.cpp
  llvm/lib/Target/AMDGPU/AMDGPURegBankCombiner.cpp
  llvm/lib/Target/Mips/MipsPostLegalizerCombiner.cpp
  llvm/lib/Target/Mips/MipsPreLegalizerCombiner.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135044.464576.patch
Type: text/x-patch
Size: 10937 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221002/7dfef678/attachment.bin>


More information about the llvm-commits mailing list