Skip to content

Commit bde905f

Browse files
committed
[LV] Strip duplicate iv
1 parent e44e014 commit bde905f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

llvm/test/Transforms/LoopVectorize/AArch64/pr151664-cost-hoisted-vector-scalable.ll

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
; and hence should not be produced by LoopVectorize. Unfortunately, what is
88
; actually costed is `<4 x float> @llvm.minimumnum`.
99

10-
; CHECK: LV: Found an estimated cost of 3 for VF 1 For instruction: %res = tail call float @llvm.minimumnum.f32(float %arg, float 0.000000e+00)
1110
define void @cost_hoisted_vector_code(ptr %p, float %arg) {
1211
; CHECK-LABEL: define void @cost_hoisted_vector_code(
1312
; CHECK-SAME: ptr [[P:%.*]], float [[ARG:%.*]]) #[[ATTR0:[0-9]+]] {
@@ -28,14 +27,15 @@ define void @cost_hoisted_vector_code(ptr %p, float %arg) {
2827
; CHECK-NEXT: [[TMP7:%.*]] = call <vscale x 4 x float> @llvm.minimumnum.nxv4f32(<vscale x 4 x float> [[BROADCAST_SPLAT]], <vscale x 4 x float> zeroinitializer)
2928
; CHECK-NEXT: br label %[[VECTOR_BODY:.*]]
3029
; CHECK: [[VECTOR_BODY]]:
31-
; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
30+
; CHECK-NEXT: [[INDEX1:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ]
31+
; CHECK-NEXT: [[INDEX:%.*]] = add i64 1, [[INDEX1]]
3232
; CHECK-NEXT: [[TMP8:%.*]] = getelementptr float, ptr [[P]], i64 [[INDEX]]
3333
; CHECK-NEXT: [[TMP9:%.*]] = call i64 @llvm.vscale.i64()
3434
; CHECK-NEXT: [[TMP10:%.*]] = mul nuw i64 [[TMP9]], 4
3535
; CHECK-NEXT: [[TMP11:%.*]] = getelementptr float, ptr [[TMP8]], i64 [[TMP10]]
3636
; CHECK-NEXT: store <vscale x 4 x float> [[TMP7]], ptr [[TMP8]], align 4
3737
; CHECK-NEXT: store <vscale x 4 x float> [[TMP7]], ptr [[TMP11]], align 4
38-
; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], [[TMP5]]
38+
; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX1]], [[TMP5]]
3939
; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]
4040
; CHECK-NEXT: br i1 [[TMP12]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
4141
; CHECK: [[MIDDLE_BLOCK]]:
@@ -48,11 +48,9 @@ entry:
4848

4949
loop: ; preds = %loop, %entry
5050
%iv = phi i64 [ 1, %entry ], [ %iv.next, %loop ]
51-
%idx = phi i64 [ 0, %entry ], [ %idx.next, %loop ]
5251
%res = tail call float @llvm.minimumnum.f32(float %arg, float 0.0)
53-
%gep.p.red = getelementptr float, ptr %p, i64 %idx
52+
%gep.p.red = getelementptr float, ptr %p, i64 %iv
5453
store float %res, ptr %gep.p.red, align 4
55-
%idx.next = add i64 %idx, 1
5654
%iv.next = add i64 %iv, 1
5755
%exit.cond = icmp eq i64 %iv.next, 0
5856
br i1 %exit.cond, label %exit, label %loop

0 commit comments

Comments
 (0)