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. 3; REQUIRES: asserts 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 7 8target datalayout = "E-m:e-p:32:32-i64:32-f64:32:64-a:0:32-n32-S128" 9 10@tab = common global [32 x i8] zeroinitializer, align 1 11 12define i32 @foo_optsize() #0 { 13; CHECK-LABEL: @foo_optsize( 14; CHECK-NOT: <2 x i8> 15; CHECK-NOT: <4 x i8> 16 17entry: 18 br label %for.body 19 20for.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 30 31for.end: ; preds = %for.body 32 ret i32 0 33} 34 35attributes #0 = { optsize } 36 37define i32 @foo_minsize() #1 { 38; CHECK-LABEL: @foo_minsize( 39; CHECK-NOT: <2 x i8> 40; CHECK-NOT: <4 x i8> 41; CHECK-LABEL: @foo_pgso( 42 43entry: 44 br label %for.body 45 46for.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 56 57for.end: ; preds = %for.body 58 ret i32 0 59} 60 61attributes #1 = { minsize } 62 63define 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> 68 69entry: 70 br label %for.body 71 72for.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 82 83for.end: ; preds = %for.body 84 ret i32 0 85} 86 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} 103