Skip to content

Commit 2d49bc0

Browse files
authored
[LV][NFC] Tidy up check-prof-info.ll test (#143884)
1 parent 8ba62fd commit 2d49bc0

File tree

1 file changed

+83
-61
lines changed

1 file changed

+83
-61
lines changed
Lines changed: 83 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,43 @@
1-
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --filter "br" --filter "^.*:"
22
; RUN: opt -passes="print<block-freq>,loop-vectorize" -force-vector-width=4 -force-vector-interleave=1 -S < %s | FileCheck %s
33
; RUN: opt -passes="print<block-freq>,loop-vectorize" -force-vector-width=4 -force-vector-interleave=4 -S < %s | FileCheck %s -check-prefix=CHECK-MASKED
44

55
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
66

7-
@a = dso_local global [1024 x i32] zeroinitializer, align 16
8-
@b = dso_local global [1024 x i32] zeroinitializer, align 16
7+
@a = global [1024 x i32] zeroinitializer, align 16
8+
@b = global [1024 x i32] zeroinitializer, align 16
99

1010
; Check correctness of profile info for vectorization without epilog.
11-
; Function Attrs: nofree norecurse nounwind uwtable
12-
define dso_local void @_Z3foov() local_unnamed_addr #0 {
11+
define void @_Z3foov() {
1312
; CHECK-LABEL: @_Z3foov(
14-
; CHECK: [[VECTOR_BODY:vector\.body]]:
15-
; CHECK: br i1 [[TMP:%.*]], label [[MIDDLE_BLOCK:%.*]], label %[[VECTOR_BODY]], !prof [[LP1_255:\!.*]],
16-
; CHECK: [[FOR_BODY:for\.body]]:
17-
; CHECK: br i1 [[EXITCOND:%.*]], label [[FOR_END_LOOPEXIT:%.*]], label %[[FOR_BODY]], !prof [[LP0_0:\!.*]],
18-
; CHECK-MASKED: [[VECTOR_BODY:vector\.body]]:
19-
; CHECK-MASKED: br i1 [[TMP:%.*]], label [[MIDDLE_BLOCK:%.*]], label %[[VECTOR_BODY]], !prof [[LP1_63:\!.*]],
20-
; CHECK-MASKED: [[FOR_BODY:for\.body]]:
21-
; CHECK-MASKED: br i1 [[EXITCOND:%.*]], label [[FOR_END_LOOPEXIT:%.*]], label %[[FOR_BODY]], !prof [[LP0_0:\!.*]],
13+
; CHECK: entry:
14+
; CHECK: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]], !prof [[PROF0:![0-9]+]]
15+
; CHECK: vector.ph:
16+
; CHECK: br label [[VECTOR_BODY:%.*]]
17+
; CHECK: vector.body:
18+
; CHECK: br i1 [[TMP6:%.*]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !prof [[PROF1:![0-9]+]], !llvm.loop [[LOOP2:![0-9]+]]
19+
; CHECK: middle.block:
20+
; CHECK: br i1 true, label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]], !prof [[PROF5:![0-9]+]]
21+
; CHECK: scalar.ph:
22+
; CHECK: br label [[FOR_BODY:%.*]]
23+
; CHECK: for.cond.cleanup:
24+
; CHECK: for.body:
25+
; CHECK: br i1 [[EXITCOND:%.*]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], !prof [[PROF6:![0-9]+]], !llvm.loop [[LOOP7:![0-9]+]]
26+
;
27+
; CHECK-MASKED-LABEL: @_Z3foov(
28+
; CHECK-MASKED: entry:
29+
; CHECK-MASKED: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]], !prof [[PROF0:![0-9]+]]
30+
; CHECK-MASKED: vector.ph:
31+
; CHECK-MASKED: br label [[VECTOR_BODY:%.*]]
32+
; CHECK-MASKED: vector.body:
33+
; CHECK-MASKED: br i1 [[TMP18:%.*]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !prof [[PROF1:![0-9]+]], !llvm.loop [[LOOP2:![0-9]+]]
34+
; CHECK-MASKED: middle.block:
35+
; CHECK-MASKED: br i1 true, label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]], !prof [[PROF5:![0-9]+]]
36+
; CHECK-MASKED: scalar.ph:
37+
; CHECK-MASKED: br label [[FOR_BODY:%.*]]
38+
; CHECK-MASKED: for.cond.cleanup:
39+
; CHECK-MASKED: for.body:
40+
; CHECK-MASKED: br i1 [[EXITCOND:%.*]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], !prof [[PROF6:![0-9]+]], !llvm.loop [[LOOP7:![0-9]+]]
2241
;
2342
entry:
2443
br label %for.body
@@ -27,32 +46,51 @@ for.cond.cleanup: ; preds = %for.body
2746
ret void
2847

2948
for.body: ; preds = %for.body, %entry
30-
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
31-
%arrayidx = getelementptr inbounds [1024 x i32], ptr @b, i64 0, i64 %indvars.iv
32-
%0 = load i32, ptr %arrayidx, align 4, !tbaa !2
33-
%1 = trunc i64 %indvars.iv to i32
49+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
50+
%arrayidx = getelementptr inbounds [1024 x i32], ptr @b, i64 0, i64 %iv
51+
%0 = load i32, ptr %arrayidx, align 4
52+
%1 = trunc i64 %iv to i32
3453
%mul = mul nsw i32 %0, %1
35-
%arrayidx2 = getelementptr inbounds [1024 x i32], ptr @a, i64 0, i64 %indvars.iv
36-
%2 = load i32, ptr %arrayidx2, align 4, !tbaa !2
54+
%arrayidx2 = getelementptr inbounds [1024 x i32], ptr @a, i64 0, i64 %iv
55+
%2 = load i32, ptr %arrayidx2, align 4
3756
%add = add nsw i32 %2, %mul
38-
store i32 %add, ptr %arrayidx2, align 4, !tbaa !2
39-
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
40-
%exitcond = icmp eq i64 %indvars.iv.next, 1024
41-
br i1 %exitcond, label %for.cond.cleanup, label %for.body, !prof !6
57+
store i32 %add, ptr %arrayidx2, align 4
58+
%iv.next = add nuw nsw i64 %iv, 1
59+
%exitcond = icmp eq i64 %iv.next, 1024
60+
br i1 %exitcond, label %for.cond.cleanup, label %for.body, !prof !0
4261
}
4362

4463
; Check correctness of profile info for vectorization with epilog.
45-
; Function Attrs: nofree norecurse nounwind uwtable
46-
define dso_local void @_Z3foo2v() local_unnamed_addr #0 {
64+
define void @_Z3foo2v() {
4765
; CHECK-LABEL: @_Z3foo2v(
48-
; CHECK: [[VECTOR_BODY:vector\.body]]:
49-
; CHECK: br i1 [[TMP:%.*]], label [[MIDDLE_BLOCK:%.*]], label %[[VECTOR_BODY]], !prof [[LP1_255:\!.*]],
50-
; CHECK: [[FOR_BODY:for\.body]]:
51-
; CHECK: br i1 [[EXITCOND:%.*]], label [[FOR_END_LOOPEXIT:%.*]], label %[[FOR_BODY]], !prof [[LP1_2:\!.*]],
52-
; CHECK-MASKED: [[VECTOR_BODY:vector\.body]]:
53-
; CHECK-MASKED: br i1 [[TMP:%.*]], label [[MIDDLE_BLOCK:%.*]], label %[[VECTOR_BODY]], !prof [[LP1_63:\!.*]],
54-
; CHECK-MASKED: [[FOR_BODY:for\.body]]:
55-
; CHECK-MASKED: br i1 [[EXITCOND:%.*]], label [[FOR_END_LOOPEXIT:%.*]], label %[[FOR_BODY]], !prof [[LP1_2:\!.*]],
66+
; CHECK: entry:
67+
; CHECK: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]], !prof [[PROF0]]
68+
; CHECK: vector.ph:
69+
; CHECK: br label [[VECTOR_BODY:%.*]]
70+
; CHECK: vector.body:
71+
; CHECK: br i1 [[TMP6:%.*]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !prof [[PROF1]], !llvm.loop [[LOOP8:![0-9]+]]
72+
; CHECK: middle.block:
73+
; CHECK: br i1 false, label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]], !prof [[PROF5]]
74+
; CHECK: scalar.ph:
75+
; CHECK: br label [[FOR_BODY:%.*]]
76+
; CHECK: for.cond.cleanup:
77+
; CHECK: for.body:
78+
; CHECK: br i1 [[EXITCOND:%.*]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], !prof [[PROF9:![0-9]+]], !llvm.loop [[LOOP10:![0-9]+]]
79+
;
80+
; CHECK-MASKED-LABEL: @_Z3foo2v(
81+
; CHECK-MASKED: entry:
82+
; CHECK-MASKED: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]], !prof [[PROF0]]
83+
; CHECK-MASKED: vector.ph:
84+
; CHECK-MASKED: br label [[VECTOR_BODY:%.*]]
85+
; CHECK-MASKED: vector.body:
86+
; CHECK-MASKED: br i1 [[TMP18:%.*]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !prof [[PROF1]], !llvm.loop [[LOOP8:![0-9]+]]
87+
; CHECK-MASKED: middle.block:
88+
; CHECK-MASKED: br i1 false, label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]], !prof [[PROF5]]
89+
; CHECK-MASKED: scalar.ph:
90+
; CHECK-MASKED: br label [[FOR_BODY:%.*]]
91+
; CHECK-MASKED: for.cond.cleanup:
92+
; CHECK-MASKED: for.body:
93+
; CHECK-MASKED: br i1 [[EXITCOND:%.*]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], !prof [[PROF9:![0-9]+]], !llvm.loop [[LOOP10:![0-9]+]]
5694
;
5795
entry:
5896
br label %for.body
@@ -61,36 +99,20 @@ for.cond.cleanup: ; preds = %for.body
6199
ret void
62100

63101
for.body: ; preds = %for.body, %entry
64-
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
65-
%arrayidx = getelementptr inbounds [1024 x i32], ptr @b, i64 0, i64 %indvars.iv
66-
%0 = load i32, ptr %arrayidx, align 4, !tbaa !2
67-
%1 = trunc i64 %indvars.iv to i32
102+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
103+
%arrayidx = getelementptr inbounds [1024 x i32], ptr @b, i64 0, i64 %iv
104+
%0 = load i32, ptr %arrayidx, align 4
105+
%1 = trunc i64 %iv to i32
68106
%mul = mul nsw i32 %0, %1
69-
%arrayidx2 = getelementptr inbounds [1024 x i32], ptr @a, i64 0, i64 %indvars.iv
70-
%2 = load i32, ptr %arrayidx2, align 4, !tbaa !2
107+
%arrayidx2 = getelementptr inbounds [1024 x i32], ptr @a, i64 0, i64 %iv
108+
%2 = load i32, ptr %arrayidx2, align 4
71109
%add = add nsw i32 %2, %mul
72-
store i32 %add, ptr %arrayidx2, align 4, !tbaa !2
73-
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
74-
%exitcond = icmp eq i64 %indvars.iv.next, 1027
75-
br i1 %exitcond, label %for.cond.cleanup, label %for.body, !prof !7
110+
store i32 %add, ptr %arrayidx2, align 4
111+
%iv.next = add nuw nsw i64 %iv, 1
112+
%exitcond = icmp eq i64 %iv.next, 1027
113+
br i1 %exitcond, label %for.cond.cleanup, label %for.body, !prof !1
76114
}
77115

78-
attributes #0 = { "use-soft-float"="false" }
79-
80-
!llvm.module.flags = !{!0}
81-
!llvm.ident = !{!1}
82-
83-
; CHECK: [[LP1_255]] = !{!"branch_weights", i32 1, i32 255}
84-
; CHECK: [[LP0_0]] = !{!"branch_weights", i32 0, i32 0}
85-
; CHECK-MASKED: [[LP1_63]] = !{!"branch_weights", i32 1, i32 63}
86-
; CHECK-MASKED: [[LP0_0]] = !{!"branch_weights", i32 0, i32 0}
87-
; CHECK: [[LP1_2]] = !{!"branch_weights", i32 1, i32 2}
88116

89-
!0 = !{i32 1, !"wchar_size", i32 4}
90-
!1 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project c292b5b5e059e6ce3e6449e6827ef7e1037c21c4)"}
91-
!2 = !{!3, !3, i64 0}
92-
!3 = !{!"int", !4, i64 0}
93-
!4 = !{!"omnipotent char", !5, i64 0}
94-
!5 = !{!"Simple C++ TBAA"}
95-
!6 = !{!"branch_weights", i32 1, i32 1023}
96-
!7 = !{!"branch_weights", i32 1, i32 1026}
117+
!0 = !{!"branch_weights", i32 1, i32 1023}
118+
!1 = !{!"branch_weights", i32 1, i32 1026}

0 commit comments

Comments
 (0)