[llvm] 6e532f9 - [RISCV] Add test case showing vmerge fold miscompile with tail policy

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 22 02:39:29 PDT 2023


Author: Luke Lau
Date: 2023-08-22T10:39:18+01:00
New Revision: 6e532f94eb0e2c9c93a3d75b4cf53bf12ab9f518

URL: https://github.com/llvm/llvm-project/commit/6e532f94eb0e2c9c93a3d75b4cf53bf12ab9f518
DIFF: https://github.com/llvm/llvm-project/commit/6e532f94eb0e2c9c93a3d75b4cf53bf12ab9f518.diff

LOG: [RISCV] Add test case showing vmerge fold miscompile with tail policy

Reviewed By: reames

Differential Revision: https://reviews.llvm.org/D158160

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/RISCV/rvv/rvv-peephole-vmerge-vops.ll b/llvm/test/CodeGen/RISCV/rvv/rvv-peephole-vmerge-vops.ll
index 3626ea6fed4534..ee26985072071e 100644
--- a/llvm/test/CodeGen/RISCV/rvv/rvv-peephole-vmerge-vops.ll
+++ b/llvm/test/CodeGen/RISCV/rvv/rvv-peephole-vmerge-vops.ll
@@ -1065,3 +1065,15 @@ define <vscale x 2 x i32> @vmerge_larger_vl_poison_passthru(<vscale x 2 x i32> %
   ret <vscale x 2 x i32> %b
 }
 
+; FIXME: The vadd's new policy should be tail undisturbed since the false op of
+; the vmerge moves from the the body to the tail, and we need to preserve it.
+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) {
+; CHECK-LABEL: vmerge_larger_vl_false_becomes_tail:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    vsetivli zero, 2, e32, m1, ta, mu
+; CHECK-NEXT:    vadd.vv v8, v9, v10, v0.t
+; CHECK-NEXT:    ret
+  %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)
+  %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)
+  ret <vscale x 2 x i32> %b
+}


        


More information about the llvm-commits mailing list