Skip to content

Commit 993681f

Browse files
lukel97tru
authored andcommitted
[RISCV] Add test case showing vmerge fold miscompile with tail policy
Reviewed By: reames Differential Revision: https://reviews.llvm.org/D158160 (cherry picked from commit 6e532f9)
1 parent 9afe667 commit 993681f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

llvm/test/CodeGen/RISCV/rvv/rvv-peephole-vmerge-vops.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,3 +1065,15 @@ define <vscale x 2 x i32> @vmerge_larger_vl_poison_passthru(<vscale x 2 x i32> %
10651065
ret <vscale x 2 x i32> %b
10661066
}
10671067

1068+
; FIXME: The vadd's new policy should be tail undisturbed since the false op of
1069+
; the vmerge moves from the the body to the tail, and we need to preserve it.
1070+
define <vscale x 2 x i32> @vmerge_larger_vl_false_becomes_tail(<vscale x 2 x i32> %false, <vscale x 2 x i32> %x, <vscale x 2 x i32> %y, <vscale x 2 x i1> %m) {
1071+
; CHECK-LABEL: vmerge_larger_vl_false_becomes_tail:
1072+
; CHECK: # %bb.0:
1073+
; CHECK-NEXT: vsetivli zero, 2, e32, m1, ta, mu
1074+
; CHECK-NEXT: vadd.vv v8, v9, v10, v0.t
1075+
; CHECK-NEXT: ret
1076+
%a = call <vscale x 2 x i32> @llvm.riscv.vadd.nxv2i32.nxv2i32(<vscale x 2 x i32> poison, <vscale x 2 x i32> %x, <vscale x 2 x i32> %y, i64 2)
1077+
%b = call <vscale x 2 x i32> @llvm.riscv.vmerge.nxv2i32.nxv2i32(<vscale x 2 x i32> poison, <vscale x 2 x i32> %false, <vscale x 2 x i32> %a, <vscale x 2 x i1> %m, i64 3)
1078+
ret <vscale x 2 x i32> %b
1079+
}

0 commit comments

Comments
 (0)