Adds the ExtensionType flag, which reflects the LoadExtType of a MaskedGatherSDNode.
Also updated SelectionDAGDumper::print_details so that details of the gather
load (is signed, is scaled & extension type) are printed.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
- Moved changes to SplitVecRes_MGATHER & SplitVecOp_MGATHER into this patch from D91092
Added DAG combines for the following:
- fold (and (masked_gather x)) -> (zext_masked_gather x)
- fold (sext_inreg (masked_gather x)) -> (sext_masked_gather x)
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
939 | nit: Capitalise to ULL seems more common in LLVM. | |
956 | nit: unnecessary curly braces. | |
5625 | I'm surprised this doesn't break anything for other targets like X86. In any case I think this fold (and same for the sext_masked_gather) should be guarded under TargetLoweringInfo::isVectorLoadExtDesirable, so that the target can inspect the operation and type, to make a suitable decision. | |
11603 | is !LegalOperations necessary here? The combine for zext_masked_gather doesn't seem to need it. | |
11604 | Is this missing a N0.hasOneUse() ? |
- Replaced calls to TLI.isLoadExtLegal with TLI.isVectorLoadExtDesirable in the masked gather combines, which also checks the type of load operation being used
- Removed unnecessary !LegalOperations from the zext_masked_gather combine and added a check for hasOneUse(), matching the sext_masked_gather combine
Hi @kmclaughlin, we just discussed this offline, just sharing my thoughts here as well.
The code-changes seem fine, but I think the patch series is in the wrong order. i.e. D91084 is an optimization for D91092. The better order I think would probably be to:
- Have https://reviews.llvm.org/D91092 as a standalone patch (you'll need to update the test and remove the reference to MGT->getExtensionType()
- Add the ExtensionType flag to MGATHER (re-adding the reference to MGT->getExtensionType() in LowerMGATHER, but the tests are probably unchanged).
- Add the DAGCombines to merge zext/sext into the mgather itself (which then requires updating the tests)
Removed isConstantSplatVectorMaskForType() & the DAG combines for s/ext_masked_gather (these will be added in a follow up patch)
Hi @sdesmalen, I've updated the series as suggested and the patches are now in the following order:
D91092 - Lower scalable masked scatters (with references to ExtensionType in LowerMGATHER removed)
D91084 - Add the ExtensionType flag to MGATHER
D92230 - DAG combines for z/sext of a masked gather, adding ExtensionType back into LowerMGATHER
Thanks for reviewing all of these patches!
nit: Capitalise to ULL seems more common in LLVM.