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
6 target datalayout = "E-m:e-p:32:32-i64:32-f64:32:64-a:0:32-n32-S128"
8 @tab = common global [32 x i8] zeroinitializer, align 1
10 define i32 @foo_optsize() #0 {
11 ; CHECK-LABEL: @foo_optsize(
18 for.body: ; preds = %for.body, %entry
19 %i.08 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
20 %arrayidx = getelementptr inbounds [32 x i8], [32 x i8]* @tab, i32 0, i32 %i.08
21 %0 = load i8, i8* %arrayidx, align 1
22 %cmp1 = icmp eq i8 %0, 0
23 %. = select i1 %cmp1, i8 2, i8 1
24 store i8 %., i8* %arrayidx, align 1
25 %inc = add nsw i32 %i.08, 1
26 %exitcond = icmp eq i32 %i.08, 202
27 br i1 %exitcond, label %for.end, label %for.body
29 for.end: ; preds = %for.body
33 attributes #0 = { optsize }
35 define i32 @foo_minsize() #1 {
36 ; CHECK-LABEL: @foo_minsize(
43 for.body: ; preds = %for.body, %entry
44 %i.08 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
45 %arrayidx = getelementptr inbounds [32 x i8], [32 x i8]* @tab, i32 0, i32 %i.08
46 %0 = load i8, i8* %arrayidx, align 1
47 %cmp1 = icmp eq i8 %0, 0
48 %. = select i1 %cmp1, i8 2, i8 1
49 store i8 %., i8* %arrayidx, align 1
50 %inc = add nsw i32 %i.08, 1
51 %exitcond = icmp eq i32 %i.08, 202
52 br i1 %exitcond, label %for.end, label %for.body
54 for.end: ; preds = %for.body
58 attributes #1 = { minsize }