You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[RISCV] Fix vmerge.vvm/vmv.v.v getting folded into ops with mismatching EEW
As noted in https://github.com/llvm/llvm-project/pull/100367/files#r1695448771, we currently fold in vmerge.vvms and vmv.v.vs into their ops even if the EEW is different. This is incorrect if we end up changing the mask or AVL of the op.
This gets the op's EEW via its simple value type for now since there doesn't seem to be any existing information about the EEW size of instructions. We'll probably need to encode this at some point if we want to be able to access it at the MachineInstr level in #100367
Copy file name to clipboardExpand all lines: llvm/test/CodeGen/RISCV/rvv/rvv-peephole-vmerge-vops.ll
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1200,8 +1200,10 @@ define <vscale x 2 x i32> @true_mask_vmerge_implicit_passthru(<vscale x 2 x i32>
1200
1200
define <vscale x 2 x i32> @unfoldable_mismatched_sew_mask(<vscale x 2 x i32> %passthru, <vscale x 1 x i64> %x, <vscale x 1 x i64> %y, <vscale x 2 x i1> %mask, i64%avl) {
1201
1201
; CHECK-LABEL: unfoldable_mismatched_sew_mask:
1202
1202
; CHECK: # %bb.0:
1203
-
; CHECK-NEXT: vsetvli zero, a0, e64, m1, tu, mu
1204
-
; CHECK-NEXT: vadd.vv v8, v9, v10, v0.t
1203
+
; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1204
+
; CHECK-NEXT: vadd.vv v9, v9, v10
1205
+
; CHECK-NEXT: vsetvli zero, a0, e32, m1, tu, ma
1206
+
; CHECK-NEXT: vmerge.vvm v8, v8, v9, v0
1205
1207
; CHECK-NEXT: ret
1206
1208
%a = call <vscale x 1 x i64> @llvm.riscv.vadd.nxv1i64.nxv1i64(<vscale x 1 x i64> poison, <vscale x 1 x i64> %x, <vscale x 1 x i64> %y, i64%avl)
1207
1209
%a.bitcast = bitcast <vscale x 1 x i64> %ato <vscale x 2 x i32>
@@ -1218,8 +1220,10 @@ define <vscale x 2 x i32> @unfoldable_mismatched_sew_mask(<vscale x 2 x i32> %pa
1218
1220
define <vscale x 2 x i32> @unfoldable_mismatched_sew_avl(<vscale x 2 x i32> %passthru, <vscale x 1 x i64> %x, <vscale x 1 x i64> %y) {
1219
1221
; CHECK-LABEL: unfoldable_mismatched_sew_avl:
1220
1222
; CHECK: # %bb.0:
1221
-
; CHECK-NEXT: vsetivli zero, 3, e64, m1, tu, ma
1222
-
; CHECK-NEXT: vadd.vv v8, v9, v10
1223
+
; CHECK-NEXT: vsetivli zero, 5, e64, m1, ta, ma
1224
+
; CHECK-NEXT: vadd.vv v9, v9, v10
1225
+
; CHECK-NEXT: vsetivli zero, 3, e32, m1, tu, ma
1226
+
; CHECK-NEXT: vmv.v.v v8, v9
1223
1227
; CHECK-NEXT: ret
1224
1228
%a = call <vscale x 1 x i64> @llvm.riscv.vadd.nxv1i64.nxv1i64(<vscale x 1 x i64> poison, <vscale x 1 x i64> %x, <vscale x 1 x i64> %y, i645)
1225
1229
%a.bitcast = bitcast <vscale x 1 x i64> %ato <vscale x 2 x i32>
0 commit comments