This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Use vsetvli x0, x0 in more cases.
ClosedPublic

Authored by craig.topper on Apr 19 2023, 12:42 PM.

Details

Summary

If the AVL is a virtual register defined by a vsetvli with the same
vlmax we need and the previous vsetvli we saw in the data flow also
has that vlmax, we can use the x0, x0 form when we insert a vsetvli.

Not only does this avoid an update of the VL physical register, but
it may allow doLocalPostpass to completely remove the inserted vsetvli
by rewriting the vtype of the previous vsetvli.

Diff Detail

Event Timeline

craig.topper created this revision.Apr 19 2023, 12:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2023, 12:42 PM
craig.topper requested review of this revision.Apr 19 2023, 12:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2023, 12:42 PM

Add a test that keeps the x0, x0 form instead of the backards pass
deleting it.

craig.topper retitled this revision from [RISCV][WIP] Use vsetvli x0, x0 in more cases. to [RISCV] Use vsetvli x0, x0 in more cases..Apr 19 2023, 1:32 PM
craig.topper edited the summary of this revision. (Show Details)
reames accepted this revision.Apr 20 2023, 1:37 PM

LGTM

I will most likely try a follow up here to move this code into the analysis phase, but doing that as an NFC with separate review is probably a good idea anyways.

This revision is now accepted and ready to land.Apr 20 2023, 1:37 PM
This revision was landed with ongoing or failed builds.Apr 20 2023, 2:05 PM
This revision was automatically updated to reflect the committed changes.