This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Implement isMultiStoresCheaperThanBitsMerge hook
ClosedPublic

Authored by asb on Dec 20 2022, 8:31 AM.

Details

Summary

Grabs the same logic and reasoning from the X86 implementation of the hook. The benefit is slightly less clear for when the soft float ABI is used (i.e. there's no transfer from an FPR to a GPR), but I've opted not to gate it based on ABI - feedback welcome.

I've got no reason to believe this is a particularly meaningful optimisation (i.e. I spotted the hook and figured the X86 logic applied to RISC-V rather than seeing this issue in real code), but it still seems marginally better for these test cases.

On the off chance you want to apply locally and experiment, the base test file is in D140409 (I've not committed directly, in case people aren't keen on adding this hook).

Diff Detail

Event Timeline

asb created this revision.Dec 20 2022, 8:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 20 2022, 8:31 AM
asb requested review of this revision.Dec 20 2022, 8:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 20 2022, 8:31 AM
asb updated this revision to Diff 487414.Jan 9 2023, 6:45 AM

Rebase and ping.

reames accepted this revision.Jan 30 2023, 10:56 AM

LGTM

This looks entirely reasonable. I don't think this is worth gating on ABI. If we did gate it, we'd probably do so on the conversion cost - which would in turn indirectly dependent on ABI. We can revisit that in the future if we ever care about the non-F non-D configuration performance in this specific case.

This revision is now accepted and ready to land.Jan 30 2023, 10:56 AM
This revision was landed with ongoing or failed builds.Jan 31 2023, 4:48 AM
This revision was automatically updated to reflect the committed changes.