[PATCH] D107330: [GlobalISel] Combine shr(shl x, c1), c2 to G_SBFX/G_UBFX
Dominik Montada via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 5 04:40:01 PDT 2021
gargaroff marked an inline comment as done.
gargaroff added inline comments.
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:4145
+ LLT ExtractTy = getTargetLowering().getPreferredShiftAmountTy(Ty);
+ if (!LI || !LI->isLegalOrCustom({ExtrOpcode, {Ty, ExtractTy}}))
+ return false;
----------------
foad wrote:
> Lots of combines use `isLegalOrBeforeLegalizer`, i.e. they do apply before legalization. Is there a reason you have made this one different, so it does not apply before legalization?
For that I followed the other bitfield extract combine. I'm guessing because there is only `widenScalar` implemented for `G_SBFX` and `G_UBFX`, so you wouldn't even be able to lower it if it would be illegal for your target.
Once at least the `lower` action is implemented, this check can be changed to make this combine also run before the legalizer.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107330/new/
https://reviews.llvm.org/D107330
More information about the llvm-commits
mailing list