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
We currently check for passthrus in two places, on the instruction to reduce in isCandidate, and on the users in checkUsers.
We cannot reduce the VL if an instruction has a user that's a passthru, because the user will read elements past VL in the tail.
However it's fine to reduce an instruction if it itself contains a non-undef passthru. Since the VL can only be reduced, not increased, the previous tail will always remain the same.
Copy file name to clipboardExpand all lines: llvm/test/CodeGen/RISCV/rvv/vl-opt.ll
+16-8Lines changed: 16 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -126,14 +126,22 @@ define <vscale x 4 x i32> @different_vl_with_tu(<vscale x 4 x i32> %passthru, <v
126
126
; We can propagate VL to a tail-undisturbed policy, provided none of its users
127
127
; are passthrus (i.e. read past VL).
128
128
define <vscale x 4 x i32> @different_imm_vl_with_tu(<vscale x 4 x i32> %passthru, <vscale x 4 x i32> %a, <vscale x 4 x i32> %b, iXLen %vl1, iXLen %vl2) {
129
-
; CHECK-LABEL: different_imm_vl_with_tu:
130
-
; CHECK: # %bb.0:
131
-
; CHECK-NEXT: vsetivli zero, 5, e32, m2, tu, ma
132
-
; CHECK-NEXT: vmv2r.v v14, v10
133
-
; CHECK-NEXT: vadd.vv v14, v10, v12
134
-
; CHECK-NEXT: vsetivli zero, 4, e32, m2, tu, ma
135
-
; CHECK-NEXT: vadd.vv v8, v14, v10
136
-
; CHECK-NEXT: ret
129
+
; NOVLOPT-LABEL: different_imm_vl_with_tu:
130
+
; NOVLOPT: # %bb.0:
131
+
; NOVLOPT-NEXT: vsetivli zero, 5, e32, m2, tu, ma
132
+
; NOVLOPT-NEXT: vmv2r.v v14, v10
133
+
; NOVLOPT-NEXT: vadd.vv v14, v10, v12
134
+
; NOVLOPT-NEXT: vsetivli zero, 4, e32, m2, tu, ma
135
+
; NOVLOPT-NEXT: vadd.vv v8, v14, v10
136
+
; NOVLOPT-NEXT: ret
137
+
;
138
+
; VLOPT-LABEL: different_imm_vl_with_tu:
139
+
; VLOPT: # %bb.0:
140
+
; VLOPT-NEXT: vsetivli zero, 4, e32, m2, tu, ma
141
+
; VLOPT-NEXT: vmv2r.v v14, v10
142
+
; VLOPT-NEXT: vadd.vv v14, v10, v12
143
+
; VLOPT-NEXT: vadd.vv v8, v14, v10
144
+
; VLOPT-NEXT: ret
137
145
%v = call <vscale x 4 x i32> @llvm.riscv.vadd.nxv4i32.nxv4i32(<vscale x 4 x i32> %a, <vscale x 4 x i32> %a, <vscale x 4 x i32> %b, iXLen 5)
138
146
%w = call <vscale x 4 x i32> @llvm.riscv.vadd.nxv4i32.nxv4i32(<vscale x 4 x i32> %passthru, <vscale x 4 x i32> %v, <vscale x 4 x i32> %a, iXLen 4)
0 commit comments