PromoteIntRes_MLOAD always sets the extension type to EXTLOAD, which
results in a sign-extended load. If the type returned by getExtensionType()
for the load being promoted is something other than NON_EXTLOAD, we
should instead pass this to getMaskedLoad() as the extension type.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Hey @kmclaughlin,
Thank you for adding me as a reviewer of the patch.
Do we know what was the logic to set ExtType to ISD::EXTLOAD?
I don't see that on other parts of the legalisation for Masked load.
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | ||
---|---|---|
791 | As we are replacing ExtType, do we need to pass isExpanding? |
Hi @CarolineConcatto, thank you for taking a look at this. We are promoting the masked load by extending the return type, which is why we need to set ExtType when we create the new masked load with the promoted type. The original masked load which had an illegal return type may not have been extending, e.g.
nxv2i16,ch = masked_load<(load (s32) from %ir.in, align 2)> t0, t2, undef:i64, t4, undef:nxv2i16 -> nxv2i64,ch = masked_load<(load (s32) from %ir.in, align 2), anyext from nxv2i16> t0, t2, undef:i64, t4, undef:nxv2i64
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | ||
---|---|---|
791 | I think we should be passing isExpandingLoad here, I can see in PromoteIntOp_MSTORE we similarly pass N->isCompressingStore() |
LGTM, moi aussi!
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | ||
---|---|---|
796 | nit: Perhaps just address the formatting issue before merging? Thanks! |
As we are replacing ExtType, do we need to pass isExpanding?
I can see in void DAGTypeLegalizer::SplitVecRes_MLOAD and DAGTypeLegalizer::WidenVecRes_MLOAD
they have a
XLD->isExpandingLoad()