1 ; This test verifies that the loop vectorizer will NOT produce a tail
2 ; loop with the optimize for size or the minimize size attributes.
4 ; RUN: opt < %s -loop-vectorize -S | FileCheck %s
5 ; RUN: opt < %s -loop-vectorize -pgso -S | FileCheck %s -check-prefix=PGSO
6 ; RUN: opt < %s -loop-vectorize -pgso=false -S | FileCheck %s -check-prefix=NPGSO
8 target datalayout = "E-m:e-p:32:32-i64:32-f64:32:64-a:0:32-n32-S128"
10 @tab = common global [32 x i8] zeroinitializer, align 1
12 define i32 @foo_optsize() #0 {
13 ; CHECK-LABEL: @foo_optsize(
20 for.body: ; preds = %for.body, %entry
21 %i.08 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
22 %arrayidx = getelementptr inbounds [32 x i8], [32 x i8]* @tab, i32 0, i32 %i.08
23 %0 = load i8, i8* %arrayidx, align 1
24 %cmp1 = icmp eq i8 %0, 0
25 %. = select i1 %cmp1, i8 2, i8 1
26 store i8 %., i8* %arrayidx, align 1
27 %inc = add nsw i32 %i.08, 1
28 %exitcond = icmp eq i32 %i.08, 202
29 br i1 %exitcond, label %for.end, label %for.body
31 for.end: ; preds = %for.body
35 attributes #0 = { optsize }
37 define i32 @foo_minsize() #1 {
38 ; CHECK-LABEL: @foo_minsize(
41 ; CHECK-LABEL: @foo_pgso(
46 for.body: ; preds = %for.body, %entry
47 %i.08 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
48 %arrayidx = getelementptr inbounds [32 x i8], [32 x i8]* @tab, i32 0, i32 %i.08
49 %0 = load i8, i8* %arrayidx, align 1
50 %cmp1 = icmp eq i8 %0, 0
51 %. = select i1 %cmp1, i8 2, i8 1
52 store i8 %., i8* %arrayidx, align 1
53 %inc = add nsw i32 %i.08, 1
54 %exitcond = icmp eq i32 %i.08, 202
55 br i1 %exitcond, label %for.end, label %for.body
57 for.end: ; preds = %for.body
61 attributes #1 = { minsize }
63 define i32 @foo_pgso() !prof !14 {
64 ; PGSO-LABEL: @foo_pgso(
65 ; PGSO-NOT: <{{[0-9]+}} x i8>
66 ; NPGSO-LABEL: @foo_pgso(
67 ; NPGSO: <{{[0-9]+}} x i8>
72 for.body: ; preds = %for.body, %entry
73 %i.08 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
74 %arrayidx = getelementptr inbounds [32 x i8], [32 x i8]* @tab, i32 0, i32 %i.08
75 %0 = load i8, i8* %arrayidx, align 1
76 %cmp1 = icmp eq i8 %0, 0
77 %. = select i1 %cmp1, i8 2, i8 1
78 store i8 %., i8* %arrayidx, align 1
79 %inc = add nsw i32 %i.08, 1
80 %exitcond = icmp eq i32 %i.08, 202
81 br i1 %exitcond, label %for.end, label %for.body
83 for.end: ; preds = %for.body
87 !llvm.module.flags = !{!0}
88 !0 = !{i32 1, !"ProfileSummary", !1}
89 !1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
90 !2 = !{!"ProfileFormat", !"InstrProf"}
91 !3 = !{!"TotalCount", i64 10000}
92 !4 = !{!"MaxCount", i64 10}
93 !5 = !{!"MaxInternalCount", i64 1}
94 !6 = !{!"MaxFunctionCount", i64 1000}
95 !7 = !{!"NumCounts", i64 3}
96 !8 = !{!"NumFunctions", i64 3}
97 !9 = !{!"DetailedSummary", !10}
98 !10 = !{!11, !12, !13}
99 !11 = !{i32 10000, i64 100, i32 1}
100 !12 = !{i32 999000, i64 100, i32 1}
101 !13 = !{i32 999999, i64 1, i32 2}
102 !14 = !{!"function_entry_count", i64 0}