If a vsetvli instruction is not compatible with the next vector instruction, and there is no other things that may update or use VL/VTYPE, we could merge it with the next vsetvli instruction that should be insert for the vector instruction.
This commit only merge VTYPE with the former vsetvli instruction which has the same VL.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | ||
---|---|---|
636 | Could this be a property of VSETVLIInfo somehow? It seems odd to track two separate bits of state. If not I think the variable needs a better name. | |
678 | Is this path not setting VSetMI by inserting a VSETVLI? | |
llvm/test/CodeGen/RISCV/rvv/vsetvli-insert.ll | ||
2 | It would be helpful if the test case was pre-committed so we can better see the changes introduced by this patch. |
Add field MI to class VSETVLIInfo for recording the merge target VSET(I)VLI.
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | ||
---|---|---|
636 | Done, thanks. |
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | ||
---|---|---|
636 | Putting it in VSETVLIINfo allocates space for every basic block as part of the global analysis. But it is only used in the function that runs after the global analysis is done. From that perspective I'm not sure it makes sense to be in the class. | |
690 | What if the original vsetvli had a smaller vlmax than the instruction we're inserting for. Won't we lose the clipping that should have existed? | |
llvm/test/CodeGen/RISCV/rvv/vsetvli-insert.ll | ||
13 | What if a0 is used by another instruction or a pointer increment? This changes VLMAX which changes where AVL gets clipped, potentially breaking the other uses. |
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | ||
---|---|---|
690 | Yes, so we can only merge vsetvli only if those two vsetvli have the same AVL and the same VLMAX or we can confirm that the first vsetvli's result won't be used. |
Remove MI from VSETVLIInfo, add constraints that should have the same VLMAX for merging vsetvli.
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | ||
---|---|---|
678 | No need to set it here, CurInfo is definitely not from an explicit VSET(I)VLI of this MBB. |
llvm/test/CodeGen/RISCV/rvv/vsetvli-insert.ll | ||
---|---|---|
13 | A new condition added for checking if is a virtual register. |
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | ||
---|---|---|
689 | Is the hasSameAVL case tested? Both the tests use the output of the vsetvli intrinsic as the AVL for the instruction. |
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | ||
---|---|---|
689 | Done, thanks. |
Could this be a property of VSETVLIInfo somehow? It seems odd to track two separate bits of state.
If not I think the variable needs a better name.