Skip to content

Commit 20fa46f

Browse files
committed
Use flags instead of metadata
1 parent 8afd8fd commit 20fa46f

File tree

5 files changed

+25
-51
lines changed

5 files changed

+25
-51
lines changed

llvm/test/Transforms/LoopVectorize/AArch64/sve2-histcnt-epilogue.ll

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2-
; RUN: opt < %s -passes=loop-vectorize,instcombine -enable-histogram-loop-vectorization -sve-gather-overhead=2 -sve-scatter-overhead=2 -epilogue-vectorization-minimum-VF=4 -debug-only=loop-vectorize -S 2>&1 | FileCheck %s
2+
; RUN: opt < %s -mattr=+sve2 -passes=loop-vectorize,instcombine -enable-histogram-loop-vectorization -sve-gather-overhead=2 -sve-scatter-overhead=2 -epilogue-vectorization-minimum-VF=4 -debug-only=loop-vectorize -force-vector-interleave=1 -S 2>&1 | FileCheck %s
33
; REQUIRES: asserts
44

55
target triple = "aarch64-unknown-linux-gnu"
66

7-
;; We don't currently support histograms in epilogue vectorization, so check for the debug message.
8-
; CHECK-LABEL: LV: Checking a loop in 'simple_histogram'
9-
; CHECK: LEV: Unable to vectorize epilogue because the loop is not a supported candidate.
10-
11-
define void @simple_histogram(ptr noalias %buckets, ptr readonly %indices, i64 %N) #0 {
7+
define void @simple_histogram(ptr noalias %buckets, ptr readonly %indices, i64 %N) {
128
; CHECK-LABEL: define void @simple_histogram(
139
; CHECK-SAME: ptr noalias [[BUCKETS:%.*]], ptr readonly [[INDICES:%.*]], i64 [[N:%.*]]) #[[ATTR0:[0-9]+]] {
1410
; CHECK-NEXT: entry:
@@ -68,13 +64,8 @@ for.body:
6864
store i32 %inc, ptr %gep.bucket, align 4
6965
%iv.next = add nuw nsw i64 %iv, 1
7066
%exitcond = icmp eq i64 %iv.next, %N
71-
br i1 %exitcond, label %for.exit, label %for.body, !llvm.loop !0
67+
br i1 %exitcond, label %for.exit, label %for.body
7268

7369
for.exit:
7470
ret void
7571
}
76-
77-
attributes #0 = { "target-features"="+sve2" vscale_range(1,16) }
78-
79-
!0 = distinct !{!0, !1}
80-
!1 = !{!"llvm.loop.interleave.count", i32 1}

llvm/test/Transforms/LoopVectorize/AArch64/sve2-histcnt-no-scalar-interleave.ll

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2-
; RUN: opt < %s -passes=loop-vectorize,instcombine -enable-histogram-loop-vectorization -sve-gather-overhead=2 -sve-scatter-overhead=2 -debug-only=loop-vectorize -S 2>&1 | FileCheck %s
2+
; RUN: opt < %s -mattr=+sve2 -passes=loop-vectorize,instcombine -enable-histogram-loop-vectorization -sve-gather-overhead=2 -sve-scatter-overhead=2 -force-vector-interleave=2 -force-vector-width=1 -debug-only=loop-vectorize -S 2>&1 | FileCheck %s
33
; REQUIRES: asserts
44

55
;; Make sure we don't interleave a histogram when vectorization is disabled.
66

77
; CHECK-LABEL: LV: Checking a loop in 'simple_histogram_forced_scalar_interleave'
88
; CHECK: LV: Not interleaving without vectorization due to histogram operations.
99

10-
define void @simple_histogram_forced_scalar_interleave(ptr noalias %buckets, ptr readonly %indices, i64 %N) #0 {
10+
define void @simple_histogram_forced_scalar_interleave(ptr noalias %buckets, ptr readonly %indices, i64 %N) {
1111
; CHECK-LABEL: define void @simple_histogram_forced_scalar_interleave(
12-
; CHECK-SAME: ptr noalias [[BUCKETS:%.*]], ptr readonly [[INDICES:%.*]], i64 [[N:%.*]]) #[[ATTR0:[0-9]+]] {
12+
; CHECK-SAME: ptr noalias [[BUCKETS:%.*]], ptr readonly [[INDICES:%.*]], i64 [[N:%.*]]) {
1313
; CHECK-NEXT: entry:
1414
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
1515
; CHECK: for.body:
@@ -23,7 +23,7 @@ define void @simple_histogram_forced_scalar_interleave(ptr noalias %buckets, ptr
2323
; CHECK-NEXT: store i32 [[INC]], ptr [[ARRAYIDX2]], align 4
2424
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
2525
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[IV_NEXT]], [[N]]
26-
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_EXIT:%.*]], label [[FOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
26+
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_EXIT:%.*]], label [[FOR_BODY]]
2727
; CHECK: for.exit:
2828
; CHECK-NEXT: ret void
2929
;
@@ -41,14 +41,8 @@ for.body:
4141
store i32 %inc, ptr %gep.bucket, align 4
4242
%iv.next = add nuw nsw i64 %iv, 1
4343
%exitcond = icmp eq i64 %iv.next, %N
44-
br i1 %exitcond, label %for.exit, label %for.body, !llvm.loop !0
44+
br i1 %exitcond, label %for.exit, label %for.body
4545

4646
for.exit:
4747
ret void
4848
}
49-
50-
attributes #0 = { "target-features"="+sve2" vscale_range(1,16) }
51-
52-
!0 = distinct !{!0, !1, !2}
53-
!1 = !{!"llvm.loop.interleave.count", i32 2}
54-
!2 = !{!"llvm.loop.vectorize.width", i32 1}

llvm/test/Transforms/LoopVectorize/AArch64/sve2-histcnt-outerloop-scevaddrec.ll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt < %s -passes=loop-vectorize,instcombine -enable-histogram-loop-vectorization -sve-gather-overhead=2 -sve-scatter-overhead=2 -debug-only=loop-vectorize -S 2>&1 | FileCheck %s
1+
; RUN: opt < %s -mattr=+sve2 -passes=loop-vectorize,instcombine -enable-histogram-loop-vectorization -sve-gather-overhead=2 -sve-scatter-overhead=2 -debug-only=loop-vectorize -S 2>&1 | FileCheck %s
22
; REQUIRES: asserts
33

44
target triple = "aarch64-unknown-linux-gnu"
@@ -9,7 +9,7 @@ target triple = "aarch64-unknown-linux-gnu"
99
; CHECK-NEXT: LV: Can't vectorize due to memory conflicts
1010
; CHECK-NEXT: LV: Not vectorizing: Cannot prove legality.
1111

12-
define void @outer_loop_scevaddrec(ptr noalias %buckets, ptr readonly %indices, i64 %N, i64 %M) #0 {
12+
define void @outer_loop_scevaddrec(ptr noalias %buckets, ptr readonly %indices, i64 %N, i64 %M) {
1313
entry:
1414
br label %outer.header
1515

@@ -38,5 +38,3 @@ outer.latch:
3838
outer.exit:
3939
ret void
4040
}
41-
42-
attributes #0 = { "target-features"="+sve2" vscale_range(1,16) }

llvm/test/Transforms/LoopVectorize/AArch64/sve2-histcnt-too-many-deps.ll

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2-
; RUN: opt < %s -passes=loop-vectorize,instcombine -enable-histogram-loop-vectorization -sve-gather-overhead=2 -sve-scatter-overhead=2 -max-dependences=2 -debug-only=loop-vectorize,loop-accesses -S 2>&1 | FileCheck %s
3-
; RUN: opt < %s -passes=loop-vectorize,instcombine -enable-histogram-loop-vectorization -sve-gather-overhead=2 -sve-scatter-overhead=2 -debug-only=loop-vectorize,loop-accesses -S 2>&1 | FileCheck %s --check-prefix=NORMAL_DEP_LIMIT
2+
; RUN: opt < %s -mattr=+sve2 -passes=loop-vectorize,instcombine -enable-histogram-loop-vectorization -sve-gather-overhead=2 -sve-scatter-overhead=2 -force-vector-interleave=1 -max-dependences=2 -debug-only=loop-vectorize,loop-accesses -S 2>&1 | FileCheck %s
3+
; RUN: opt < %s -mattr=+sve2 -passes=loop-vectorize,instcombine -enable-histogram-loop-vectorization -sve-gather-overhead=2 -sve-scatter-overhead=2 -force-vector-interleave=1 -debug-only=loop-vectorize,loop-accesses -S 2>&1 | FileCheck %s --check-prefix=NORMAL_DEP_LIMIT
44
; REQUIRES: asserts
55

66
target triple = "aarch64-unknown-linux-gnu"
@@ -13,7 +13,7 @@ target triple = "aarch64-unknown-linux-gnu"
1313
; CHECK: LV: Can't vectorize due to memory conflicts
1414
; CHECK: LV: Not vectorizing: Cannot prove legality.
1515

16-
define void @many_deps(ptr noalias %buckets, ptr %array, ptr %indices, ptr %other, i64 %N) #0 {
16+
define void @many_deps(ptr noalias %buckets, ptr %array, ptr %indices, ptr %other, i64 %N) {
1717
; CHECK-LABEL: define void @many_deps(
1818
; CHECK-SAME: ptr noalias [[BUCKETS:%.*]], ptr [[ARRAY:%.*]], ptr [[INDICES:%.*]], ptr [[OTHER:%.*]], i64 [[N:%.*]]) #[[ATTR0:[0-9]+]] {
1919
; CHECK-NEXT: entry:
@@ -36,15 +36,15 @@ define void @many_deps(ptr noalias %buckets, ptr %array, ptr %indices, ptr %othe
3636
; CHECK-NEXT: store i32 [[ADD_OTHER]], ptr [[GEP_OTHER]], align 4
3737
; CHECK-NEXT: [[IV_NEXT]] = add nuw nsw i64 [[IV]], 1
3838
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[IV_NEXT]], [[N]]
39-
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_EXIT:%.*]], label [[FOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
39+
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_EXIT:%.*]], label [[FOR_BODY]]
4040
; CHECK: for.exit:
4141
; CHECK-NEXT: ret void
4242
;
4343
; NORMAL_DEP_LIMIT-LABEL: define void @many_deps(
4444
; NORMAL_DEP_LIMIT-SAME: ptr noalias [[BUCKETS:%.*]], ptr [[ARRAY:%.*]], ptr [[INDICES:%.*]], ptr [[OTHER:%.*]], i64 [[N:%.*]]) #[[ATTR0:[0-9]+]] {
4545
; NORMAL_DEP_LIMIT-NEXT: entry:
4646
; NORMAL_DEP_LIMIT-NEXT: [[TMP0:%.*]] = call i64 @llvm.vscale.i64()
47-
; NORMAL_DEP_LIMIT-NEXT: [[TMP1:%.*]] = shl nuw nsw i64 [[TMP0]], 2
47+
; NORMAL_DEP_LIMIT-NEXT: [[TMP1:%.*]] = shl i64 [[TMP0]], 2
4848
; NORMAL_DEP_LIMIT-NEXT: [[TMP2:%.*]] = call i64 @llvm.umax.i64(i64 [[TMP1]], i64 8)
4949
; NORMAL_DEP_LIMIT-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ult i64 [[N]], [[TMP2]]
5050
; NORMAL_DEP_LIMIT-NEXT: br i1 [[MIN_ITERS_CHECK]], label [[SCALAR_PH:%.*]], label [[VECTOR_MEMCHECK:%.*]]
@@ -67,12 +67,13 @@ define void @many_deps(ptr noalias %buckets, ptr %array, ptr %indices, ptr %othe
6767
; NORMAL_DEP_LIMIT-NEXT: br i1 [[CONFLICT_RDX9]], label [[SCALAR_PH]], label [[ENTRY:%.*]]
6868
; NORMAL_DEP_LIMIT: vector.ph:
6969
; NORMAL_DEP_LIMIT-NEXT: [[TMP4:%.*]] = call i64 @llvm.vscale.i64()
70-
; NORMAL_DEP_LIMIT-NEXT: [[DOTNEG:%.*]] = mul nsw i64 [[TMP4]], -4
71-
; NORMAL_DEP_LIMIT-NEXT: [[N_VEC:%.*]] = and i64 [[N]], [[DOTNEG]]
70+
; NORMAL_DEP_LIMIT-NEXT: [[TMP8:%.*]] = shl i64 [[TMP4]], 2
71+
; NORMAL_DEP_LIMIT-NEXT: [[N_MOD_VF:%.*]] = urem i64 [[N]], [[TMP8]]
72+
; NORMAL_DEP_LIMIT-NEXT: [[N_VEC:%.*]] = sub i64 [[N]], [[N_MOD_VF]]
7273
; NORMAL_DEP_LIMIT-NEXT: [[TMP5:%.*]] = call i64 @llvm.vscale.i64()
73-
; NORMAL_DEP_LIMIT-NEXT: [[TMP6:%.*]] = shl nuw nsw i64 [[TMP5]], 2
74+
; NORMAL_DEP_LIMIT-NEXT: [[TMP6:%.*]] = shl i64 [[TMP5]], 2
7475
; NORMAL_DEP_LIMIT-NEXT: [[TMP7:%.*]] = call <vscale x 4 x i32> @llvm.stepvector.nxv4i32()
75-
; NORMAL_DEP_LIMIT-NEXT: [[TMP9:%.*]] = trunc nuw nsw i64 [[TMP6]] to i32
76+
; NORMAL_DEP_LIMIT-NEXT: [[TMP9:%.*]] = trunc i64 [[TMP6]] to i32
7677
; NORMAL_DEP_LIMIT-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[TMP9]], i64 0
7778
; NORMAL_DEP_LIMIT-NEXT: [[DOTSPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[DOTSPLATINSERT]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
7879
; NORMAL_DEP_LIMIT-NEXT: br label [[FOR_BODY:%.*]]
@@ -95,7 +96,7 @@ define void @many_deps(ptr noalias %buckets, ptr %array, ptr %indices, ptr %othe
9596
; NORMAL_DEP_LIMIT-NEXT: [[TMP16:%.*]] = icmp eq i64 [[IV_NEXT]], [[N_VEC]]
9697
; NORMAL_DEP_LIMIT-NEXT: br i1 [[TMP16]], label [[MIDDLE_BLOCK:%.*]], label [[FOR_BODY]], !llvm.loop [[LOOP8:![0-9]+]]
9798
; NORMAL_DEP_LIMIT: middle.block:
98-
; NORMAL_DEP_LIMIT-NEXT: [[CMP_N:%.*]] = icmp eq i64 [[N]], [[N_VEC]]
99+
; NORMAL_DEP_LIMIT-NEXT: [[CMP_N:%.*]] = icmp eq i64 [[N_MOD_VF]], 0
99100
; NORMAL_DEP_LIMIT-NEXT: br i1 [[CMP_N]], label [[FOR_EXIT:%.*]], label [[SCALAR_PH]]
100101
; NORMAL_DEP_LIMIT: scalar.ph:
101102
; NORMAL_DEP_LIMIT-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY1:%.*]] ], [ 0, [[VECTOR_MEMCHECK]] ]
@@ -143,13 +144,8 @@ for.body:
143144
store i32 %add.other, ptr %gep.other, align 4
144145
%iv.next = add nuw nsw i64 %iv, 1
145146
%exitcond = icmp eq i64 %iv.next, %N
146-
br i1 %exitcond, label %for.exit, label %for.body, !llvm.loop !0
147+
br i1 %exitcond, label %for.exit, label %for.body
147148

148149
for.exit:
149150
ret void
150151
}
151-
152-
attributes #0 = { "target-features"="+sve2" vscale_range(1,16) }
153-
154-
!0 = distinct !{!0, !1}
155-
!1 = !{!"llvm.loop.interleave.count", i32 1}

llvm/test/Transforms/LoopVectorize/AArch64/sve2-histcnt-vplan.ll

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt < %s -passes=loop-vectorize,instcombine -enable-histogram-loop-vectorization -sve-gather-overhead=2 -sve-scatter-overhead=2 -debug-only=loop-vectorize -S 2>&1 | FileCheck %s
1+
; RUN: opt < %s -mattr=+sve2 -passes=loop-vectorize,instcombine -enable-histogram-loop-vectorization -sve-gather-overhead=2 -sve-scatter-overhead=2 -force-vector-interleave=1 -debug-only=loop-vectorize -S 2>&1 | FileCheck %s
22
; REQUIRES: asserts
33

44
target triple = "aarch64-unknown-linux-gnu"
@@ -85,7 +85,7 @@ target triple = "aarch64-unknown-linux-gnu"
8585
; CHECK-NEXT: No successors
8686
; CHECK-NEXT: }
8787

88-
define void @simple_histogram(ptr noalias %buckets, ptr readonly %indices, i64 %N) #0 {
88+
define void @simple_histogram(ptr noalias %buckets, ptr readonly %indices, i64 %N) {
8989
entry:
9090
br label %for.body
9191

@@ -100,13 +100,8 @@ for.body:
100100
store i32 %inc, ptr %gep.bucket, align 4
101101
%iv.next = add nuw nsw i64 %iv, 1
102102
%exitcond = icmp eq i64 %iv.next, %N
103-
br i1 %exitcond, label %for.exit, label %for.body, !llvm.loop !0
103+
br i1 %exitcond, label %for.exit, label %for.body
104104

105105
for.exit:
106106
ret void
107107
}
108-
109-
attributes #0 = { "target-features"="+sve2" vscale_range(1,16) }
110-
111-
!0 = distinct !{!0, !1}
112-
!1 = !{!"llvm.loop.interleave.count", i32 1}

0 commit comments

Comments
 (0)