This is an archive of the discontinued LLVM Phabricator instance.

[SDAG] Refine MMO size when converting masked load/store to normal load/store
ClosedPublic

Authored by dmgreen on Nov 25 2021, 4:27 AM.

Details

Summary

After D113888 / 32b6c17b29079e7d the MMO size of a masked loads/store is unknown. When we are converting back to a standard load/store because the mask is known all ones, we can refine that to the correct size from the size of the vector being loaded/stored.

Diff Detail

Event Timeline

dmgreen created this revision.Nov 25 2021, 4:27 AM
dmgreen requested review of this revision.Nov 25 2021, 4:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 25 2021, 4:27 AM

@dmgreen please can you rebase?

dmgreen updated this revision to Diff 391078.Dec 1 2021, 10:48 AM

Rebase over formatting.

craig.topper added inline comments.Dec 1 2021, 2:41 PM
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
10126–10127

Can we just one of the other signatures of getLoad and let it rebuild the MMO? Like this one

SDValue SelectionDAG::getLoad(EVT VT, const SDLoc &dl, SDValue Chain,            
                              SDValue Ptr, MachinePointerInfo PtrInfo,           
                              MaybeAlign Alignment,                              
                              MachineMemOperand::Flags MMOFlags,                 
                              const AAMDNodes &AAInfo, const MDNode *Ranges)

Or is there a risk that MemVT and VT don't match?

dmgreen added inline comments.Dec 2 2021, 3:44 AM
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
10126–10127

Yeah sounds good. We check that the masked load is non-extending, so I believe it should be OK.

dmgreen updated this revision to Diff 391272.Dec 2 2021, 3:46 AM

Update to use a different getLoad/setStore signature.

RKSimon added inline comments.Dec 2 2021, 4:32 AM
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
10068

(style) drop the braces?

dmgreen updated this revision to Diff 392381.Dec 7 2021, 6:51 AM

Remove superfluous brackets. Thanks

RKSimon accepted this revision.Dec 7 2021, 7:12 AM

LGTM

This revision is now accepted and ready to land.Dec 7 2021, 7:12 AM
This revision was landed with ongoing or failed builds.Dec 8 2021, 2:13 AM
This revision was automatically updated to reflect the committed changes.