This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Teach VSETVLInsert to optimize vsetvli for ScalarMoveInstr
AbandonedPublic

Authored by Chenbing.Zheng on Feb 16 2022, 12:44 AM.

Details

Summary

VSETVLI from ScalarMove don't care different LMUL or non-zero AVL.
It provides an opportunity for our optimization.

In D116307, it shared VSETVLI of ScalarMove with previous VSETVLI as far as possible.

In this patch, we try to shared VSETVLI of single ScalarMoveInstr with next VSETVLI as far as possible。

Diff Detail

Event Timeline

Chenbing.Zheng requested review of this revision.Feb 16 2022, 12:44 AM
jacquesguan added inline comments.Feb 16 2022, 1:02 AM
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
1056

The scalar move instruction may share a VSETVLI with one or some other instruction.

1092

As the former comment, the scalar move instruction may share a VSETVLI with one or some other instructions, so in this situation, we could not only think about the scalar move instruction, other instructions may care about the LMUL.

Chenbing.Zheng added inline comments.Feb 16 2022, 1:19 AM
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
1092

Yer, if scalar move instruction share a VSETVLI with others, we do not optimize this case. Because as you said, that would cause the error. ScalarMoveVSETVLI will be nullptr in this case.

Chenbing.Zheng edited the summary of this revision. (Show Details)Feb 17 2022, 5:59 PM
Chenbing.Zheng added inline comments.Feb 17 2022, 6:03 PM
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
1056

In the case you said,the insertVSETVLI function will not be called. So ScalarMoveVSETVLI only be set if VSETVLI come from single ScalarMoveInstr.

Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2022, 5:21 PM
Chenbing.Zheng abandoned this revision.Apr 24 2022, 7:00 PM