This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Use non-strided load if VL=1 for optimized zero stride loads
ClosedPublic

Authored by luke on Apr 5 2023, 5:47 AM.

Details

Summary

When optimizing vmv.s.x/vmv.v.x's of scalar loads, if VL is known to be
1 then we don't need to perform a stride of x0, and can just do a
regular load.

Diff Detail

Event Timeline

luke created this revision.Apr 5 2023, 5:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 5 2023, 5:47 AM
luke requested review of this revision.Apr 5 2023, 5:47 AM
luke added inline comments.
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
2076–2081

Could VM_S_X_VL nodes be lowered to non-strided loads with VL=1? Since only the first lane needs to be written to.

craig.topper added inline comments.Apr 5 2023, 9:57 AM
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
2088–2099

Does this simplify to bool IsStrided = !isOneConstant(VL)?

craig.topper accepted this revision.Apr 5 2023, 3:46 PM

LGTM other than the suggestion of how to simplify IsStrided calculation.

This revision is now accepted and ready to land.Apr 5 2023, 3:46 PM
luke updated this revision to Diff 511351.Apr 6 2023, 3:20 AM

Simplify IsStrided

luke marked an inline comment as done.Apr 6 2023, 3:21 AM
This revision was landed with ongoing or failed builds.Apr 6 2023, 3:22 AM
This revision was automatically updated to reflect the committed changes.