Skip to content

Commit 2fab927

Browse files
committed
[LoopVectorize] Convert some tests to opaque pointers (NFC)
Check lines for some of these tests were regenerated. The difference is that with opaque pointers SCEVExpander always emits i8 GEPs, making the address calculation explicit. This is a known problem that will be solved long term by making all address calculations explicit.
1 parent 970fcba commit 2fab927

40 files changed

+3534
-3517
lines changed

llvm/test/Transforms/LoopVectorize/AArch64/arbitrary-induction-step.ll

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ target triple = "aarch64--linux-gnueabi"
1111
; }
1212

1313
; CHECK-LABEL: @ind_plus2(
14-
; CHECK: load <4 x i32>, <4 x i32>*
15-
; CHECK: load <4 x i32>, <4 x i32>*
14+
; CHECK: load <4 x i32>, ptr
15+
; CHECK: load <4 x i32>, ptr
1616
; CHECK: mul nsw <4 x i32>
1717
; CHECK: mul nsw <4 x i32>
1818
; CHECK: add <4 x i32>
@@ -21,21 +21,21 @@ target triple = "aarch64--linux-gnueabi"
2121
; CHECK: icmp eq i64 %index.next, 512
2222

2323
; FORCE-VEC-LABEL: @ind_plus2(
24-
; FORCE-VEC: %wide.load = load <2 x i32>, <2 x i32>*
24+
; FORCE-VEC: %wide.load = load <2 x i32>, ptr
2525
; FORCE-VEC: mul nsw <2 x i32>
2626
; FORCE-VEC: add <2 x i32>
2727
; FORCE-VEC: %index.next = add nuw i64 %index, 2
2828
; FORCE-VEC: icmp eq i64 %index.next, 512
29-
define i32 @ind_plus2(i32* %A) {
29+
define i32 @ind_plus2(ptr %A) {
3030
entry:
3131
br label %for.body
3232

3333
for.body: ; preds = %entry, %for.body
34-
%A.addr = phi i32* [ %A, %entry ], [ %inc.ptr, %for.body ]
34+
%A.addr = phi ptr [ %A, %entry ], [ %inc.ptr, %for.body ]
3535
%i = phi i32 [ 0, %entry ], [ %add1, %for.body ]
3636
%sum = phi i32 [ 0, %entry ], [ %add, %for.body ]
37-
%inc.ptr = getelementptr inbounds i32, i32* %A.addr, i64 1
38-
%0 = load i32, i32* %A.addr, align 4
37+
%inc.ptr = getelementptr inbounds i32, ptr %A.addr, i64 1
38+
%0 = load i32, ptr %A.addr, align 4
3939
%mul = mul nsw i32 %0, %i
4040
%add = add nsw i32 %mul, %sum
4141
%add1 = add nsw i32 %i, 2
@@ -55,8 +55,8 @@ for.end: ; preds = %for.body
5555
; }
5656

5757
; CHECK-LABEL: @ind_minus2(
58-
; CHECK: load <4 x i32>, <4 x i32>*
59-
; CHECK: load <4 x i32>, <4 x i32>*
58+
; CHECK: load <4 x i32>, ptr
59+
; CHECK: load <4 x i32>, ptr
6060
; CHECK: mul nsw <4 x i32>
6161
; CHECK: mul nsw <4 x i32>
6262
; CHECK: add <4 x i32>
@@ -65,21 +65,21 @@ for.end: ; preds = %for.body
6565
; CHECK: icmp eq i64 %index.next, 512
6666

6767
; FORCE-VEC-LABEL: @ind_minus2(
68-
; FORCE-VEC: %wide.load = load <2 x i32>, <2 x i32>*
68+
; FORCE-VEC: %wide.load = load <2 x i32>, ptr
6969
; FORCE-VEC: mul nsw <2 x i32>
7070
; FORCE-VEC: add <2 x i32>
7171
; FORCE-VEC: %index.next = add nuw i64 %index, 2
7272
; FORCE-VEC: icmp eq i64 %index.next, 512
73-
define i32 @ind_minus2(i32* %A) {
73+
define i32 @ind_minus2(ptr %A) {
7474
entry:
7575
br label %for.body
7676

7777
for.body: ; preds = %entry, %for.body
78-
%A.addr = phi i32* [ %A, %entry ], [ %inc.ptr, %for.body ]
78+
%A.addr = phi ptr [ %A, %entry ], [ %inc.ptr, %for.body ]
7979
%i = phi i32 [ 1024, %entry ], [ %sub, %for.body ]
8080
%sum = phi i32 [ 0, %entry ], [ %add, %for.body ]
81-
%inc.ptr = getelementptr inbounds i32, i32* %A.addr, i64 1
82-
%0 = load i32, i32* %A.addr, align 4
81+
%inc.ptr = getelementptr inbounds i32, ptr %A.addr, i64 1
82+
%0 = load i32, ptr %A.addr, align 4
8383
%mul = mul nsw i32 %0, %i
8484
%add = add nsw i32 %mul, %sum
8585
%sub = add nsw i32 %i, -2
@@ -123,18 +123,18 @@ for.end: ; preds = %for.body
123123
; FORCE-VEC: add <2 x i32>
124124
; FORCE-VEC: %index.next = add nuw i64 %index, 2
125125
; FORCE-VEC: icmp eq i64 %index.next, 1024
126-
define i32 @ptr_ind_plus2(i32* %A) {
126+
define i32 @ptr_ind_plus2(ptr %A) {
127127
entry:
128128
br label %for.body
129129

130130
for.body: ; preds = %for.body, %entry
131-
%A.addr = phi i32* [ %A, %entry ], [ %inc.ptr1, %for.body ]
131+
%A.addr = phi ptr [ %A, %entry ], [ %inc.ptr1, %for.body ]
132132
%sum = phi i32 [ 0, %entry ], [ %add, %for.body ]
133133
%i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
134-
%inc.ptr = getelementptr inbounds i32, i32* %A.addr, i64 1
135-
%0 = load i32, i32* %A.addr, align 4
136-
%inc.ptr1 = getelementptr inbounds i32, i32* %A.addr, i64 2
137-
%1 = load i32, i32* %inc.ptr, align 4
134+
%inc.ptr = getelementptr inbounds i32, ptr %A.addr, i64 1
135+
%0 = load i32, ptr %A.addr, align 4
136+
%inc.ptr1 = getelementptr inbounds i32, ptr %A.addr, i64 2
137+
%1 = load i32, ptr %inc.ptr, align 4
138138
%mul = mul nsw i32 %1, %0
139139
%add = add nsw i32 %mul, %sum
140140
%inc = add nsw i32 %i, 1

llvm/test/Transforms/LoopVectorize/AArch64/first-order-recurrence.ll

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
; return a;
1919
; }
2020
;
21-
define i32 @PR33613(double* %b, double %j, i32 %d) #0 {
21+
define i32 @PR33613(ptr %b, double %j, i32 %d) #0 {
2222
; CHECK-VF4UF2-LABEL: @PR33613
2323
; CHECK-VF4UF2: vector.body
2424
; CHECK-VF4UF2: %[[VEC_RECUR:.*]] = phi <vscale x 4 x double> [ {{.*}}, %vector.ph ], [ {{.*}}, %vector.body ]
@@ -35,18 +35,18 @@ for.cond.cleanup:
3535
ret i32 %a.1.lcssa
3636

3737
for.body:
38-
%b.addr.012 = phi double* [ %b, %entry ], [ %add.ptr, %for.body ]
38+
%b.addr.012 = phi ptr [ %b, %entry ], [ %add.ptr, %for.body ]
3939
%i.011 = phi i32 [ 0, %entry ], [ %inc1, %for.body ]
4040
%a.010 = phi i32 [ 0, %entry ], [ %a.1, %for.body ]
4141
%j.addr.09 = phi double [ %j, %entry ], [ %0, %for.body ]
42-
%arrayidx = getelementptr inbounds double, double* %b.addr.012, i64 %idxprom
43-
%0 = load double, double* %arrayidx, align 8
42+
%arrayidx = getelementptr inbounds double, ptr %b.addr.012, i64 %idxprom
43+
%0 = load double, ptr %arrayidx, align 8
4444
%mul = fmul double %j.addr.09, %0
4545
%tobool = fcmp une double %mul, 0.000000e+00
4646
%inc = zext i1 %tobool to i32
4747
%a.1 = add nsw i32 %a.010, %inc
4848
%inc1 = add nuw nsw i32 %i.011, 1
49-
%add.ptr = getelementptr inbounds double, double* %b.addr.012, i64 25
49+
%add.ptr = getelementptr inbounds double, ptr %b.addr.012, i64 25
5050
%exitcond = icmp eq i32 %inc1, 10240
5151
br i1 %exitcond, label %for.cond.cleanup, label %for.body, !llvm.loop !0
5252
}
@@ -66,32 +66,31 @@ for.body:
6666
; }
6767
;
6868
; Check that the sext sank after the load in the vector loop.
69-
define void @PR34711([2 x i16]* %a, i32* %b, i32* %c, i64 %n) #0 {
69+
define void @PR34711(ptr %a, ptr %b, ptr %c, i64 %n) #0 {
7070
; CHECK-VF4UF1-LABEL: @PR34711
7171
; CHECK-VF4UF1: vector.body
7272
; CHECK-VF4UF1: %[[VEC_RECUR:.*]] = phi <vscale x 4 x i16> [ %vector.recur.init, %vector.ph ], [ %[[MGATHER:.*]], %vector.body ]
73-
; CHECK-VF4UF1: %[[MGATHER]] = call <vscale x 4 x i16> @llvm.masked.gather.nxv4i16.nxv4p0i16(<vscale x 4 x i16*> {{.*}}, i32 2, <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i32 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), <vscale x 4 x i16> poison)
73+
; CHECK-VF4UF1: %[[MGATHER]] = call <vscale x 4 x i16> @llvm.masked.gather.nxv4i16.nxv4p0(<vscale x 4 x ptr> {{.*}}, i32 2, <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i32 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), <vscale x 4 x i16> poison)
7474
; CHECK-VF4UF1-NEXT: %[[SPLICE:.*]] = call <vscale x 4 x i16> @llvm.experimental.vector.splice.nxv4i16(<vscale x 4 x i16> %[[VEC_RECUR]], <vscale x 4 x i16> %[[MGATHER]], i32 -1)
7575
; CHECK-VF4UF1-NEXT: %[[SXT1:.*]] = sext <vscale x 4 x i16> %[[SPLICE]] to <vscale x 4 x i32>
7676
; CHECK-VF4UF1-NEXT: %[[SXT2:.*]] = sext <vscale x 4 x i16> %[[MGATHER]] to <vscale x 4 x i32>
7777
; CHECK-VF4UF1-NEXT: mul nsw <vscale x 4 x i32> %[[SXT2]], %[[SXT1]]
7878
entry:
79-
%pre.index = getelementptr inbounds [2 x i16], [2 x i16]* %a, i64 0, i64 0
80-
%.pre = load i16, i16* %pre.index
79+
%.pre = load i16, ptr %a
8180
br label %for.body
8281

8382
for.body:
8483
%0 = phi i16 [ %.pre, %entry ], [ %1, %for.body ]
8584
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
86-
%arraycidx = getelementptr inbounds i32, i32* %c, i64 %indvars.iv
87-
%cur.index = getelementptr inbounds [2 x i16], [2 x i16]* %a, i64 %indvars.iv, i64 1
88-
store i32 7, i32* %arraycidx ; 1st instruction, to be widened.
85+
%arraycidx = getelementptr inbounds i32, ptr %c, i64 %indvars.iv
86+
%cur.index = getelementptr inbounds [2 x i16], ptr %a, i64 %indvars.iv, i64 1
87+
store i32 7, ptr %arraycidx ; 1st instruction, to be widened.
8988
%conv = sext i16 %0 to i32 ; 2nd, cast to sink after third.
90-
%1 = load i16, i16* %cur.index ; 3rd, first-order-recurring load not widened.
89+
%1 = load i16, ptr %cur.index ; 3rd, first-order-recurring load not widened.
9190
%conv3 = sext i16 %1 to i32
9291
%mul = mul nsw i32 %conv3, %conv
93-
%arrayidx5 = getelementptr inbounds i32, i32* %b, i64 %indvars.iv
94-
store i32 %mul, i32* %arrayidx5
92+
%arrayidx5 = getelementptr inbounds i32, ptr %b, i64 %indvars.iv
93+
store i32 %mul, ptr %arrayidx5
9594
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
9695
%exitcond = icmp eq i64 %indvars.iv.next, %n
9796
br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0

0 commit comments

Comments
 (0)