[llvm] [RISCV] Return nullptr for PHI defs in VSETVLIInfo::getAVLDefMI (PR #97395)
Pengcheng Wang via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 2 02:17:19 PDT 2024
================
@@ -1062,3 +1062,30 @@ exit:
%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)
ret <vscale x 2 x i32> %c
}
+
+define void @vlmax_avl_phi(i1 %cmp, ptr %p) {
+; CHECK-LABEL: vlmax_avl_phi:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: andi a0, a0, 1
+; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
+; CHECK-NEXT: vmv.v.i v8, 0
+; CHECK-NEXT: vsetivli zero, 1, e8, m1, ta, ma
+; CHECK-NEXT: vse8.v v8, (a1)
+; CHECK-NEXT: ret
+entry:
+ br i1 %cmp, label %foo, label %bar
+
+foo:
+ %vl.foo = tail call i64 @llvm.riscv.vsetvlimax.i64(i64 0, i64 0)
+ br label %exit
+
+bar:
+ %vl.bar = tail call i64 @llvm.riscv.vsetvlimax.i64(i64 0, i64 0)
----------------
wangpc-pp wrote:
Can we have a test that `%vl.foo` and `vl.bar` are not equal?
https://github.com/llvm/llvm-project/pull/97395
More information about the llvm-commits
mailing list