Skip to content

Commit 133ab9a

Browse files
committed
[RISCV] Add test for extending AVL live range across blocks. NFC
This adds a separate test case for an existing issue fixed in #96200, where we failing to extend the live range of an AVL when inserting a vsetvli if the AVL was from a different block.
1 parent 626eef5 commit 133ab9a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.ll

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,3 +1036,22 @@ declare <vscale x 4 x i32> @llvm.riscv.vadd.mask.nxv4i32.nxv4i32(
10361036
<vscale x 4 x i1>,
10371037
i64,
10381038
i64);
1039+
1040+
; Normally a pseudo's AVL is already live in its block, so it will already be
1041+
; live where we're inserting the vsetvli, before the pseudo. In some cases the
1042+
; AVL can be from a predecessor block, so make sure we extend its live range
1043+
; across blocks.
1044+
define <vscale x 2 x i32> @cross_block_avl_extend(i64 %avl, <vscale x 2 x i32> %a, <vscale x 2 x i32> %b) {
1045+
entry:
1046+
; Get the output vl from a vsetvli
1047+
%vl = call i64 @llvm.riscv.vsetvli.i64(i64 %avl, i64 2, i64 0)
1048+
; Force a vsetvli toggle so we need to insert a new vsetvli in exit
1049+
%d = call <vscale x 2 x i32> @llvm.riscv.vadd.nxv2i32(<vscale x 2 x i32> undef, <vscale x 2 x i32> %a, <vscale x 2 x i32> %b, i64 1)
1050+
br label %exit
1051+
exit:
1052+
; The use of the vl from the vsetvli will be replaced with its %avl because
1053+
; VLMAX is the same. So %avl, which was previously only live in %entry, will
1054+
; need to be extended down toe %exit.
1055+
%c = call <vscale x 2 x i32> @llvm.riscv.vadd.nxv2i32(<vscale x 2 x i32> undef, <vscale x 2 x i32> %a, <vscale x 2 x i32> %d, i64 %vl)
1056+
ret <vscale x 2 x i32> %c
1057+
}

0 commit comments

Comments
 (0)