This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Fix the calculation of the offset of Zvlsseg spilling.
ClosedPublic

Authored by HsiangKai on May 4 2021, 4:34 PM.

Details

Summary

For Zvlsseg spilling, we need to convert the pseudo instructions
into multiple vector load/store instructions with appropriate offsets.
For example, for PseudoVSPILL3_M2, we need to convert it to

VS2R %v2, %base
ADDI %base, %base, (vlenb x 2)
VS2R %v4, %base
ADDI %base, %base, (vlenb x 2)
VS2R %v6, %base

We need to keep the size of the offset in the pseudo spilling instructions.
In this case, it is (vlenb x 2).

In the original implementation, we use the size of frame objects divide the
number of vectors in zvlsseg types. The size of frame objects is not
necessary exactly the same as the spilling data. It may be larger than
it. So, we change it to (VLENB x LMUL) in this patch. The calculation is
more direct and easy to understand.

Diff Detail

Event Timeline

HsiangKai created this revision.May 4 2021, 4:34 PM
HsiangKai requested review of this revision.May 4 2021, 4:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 4 2021, 4:34 PM

When would it be larger and is it easy to construct a test for it?

When would it be larger and is it easy to construct a test for it?

There is a pass called stack-slot-coloring. In this pass, it seems to reuse stack slots if possible.
I could try to create a mir test case for it.

HsiangKai updated this revision to Diff 344063.May 10 2021, 8:07 AM

Add a test case.

This revision is now accepted and ready to land.May 10 2021, 12:47 PM
This revision was landed with ongoing or failed builds.May 10 2021, 7:47 PM
This revision was automatically updated to reflect the committed changes.