[LoopVectorize] Pointer indicies may be wider than the pointer
[oota-llvm.git] / test / Transforms / LoopVectorize / optsize.ll
1 ; This test verifies that the loop vectorizer will NOT produce a tail
2 ; loop with Optimize for size attibute.
3 ; REQUIRES: asserts
4 ; RUN: opt < %s -loop-vectorize -Os -debug -debug-only=loop-vectorize -S 2>&1 | FileCheck %s
5
6 ;CHECK-NOT: <2 x i8>
7 ;CHECK-NOT: <4 x i8>
8 ;CHECK: Aborting. A tail loop is required in Os.
9
10 target datalayout = "E-m:e-p:32:32-i64:32-f64:32:64-a:0:32-n32-S128"
11
12 @tab = common global [32 x i8] zeroinitializer, align 1
13
14 ; Function Attrs: nounwind optsize
15 define i32 @foo() #0 {
16 entry:
17   br label %for.body
18
19 for.body:                                         ; preds = %for.body, %entry
20   %i.08 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
21   %arrayidx = getelementptr inbounds [32 x i8], [32 x i8]* @tab, i32 0, i32 %i.08
22   %0 = load i8, i8* %arrayidx, align 1
23   %cmp1 = icmp eq i8 %0, 0
24   %. = select i1 %cmp1, i8 2, i8 1
25   store i8 %., i8* %arrayidx, align 1
26   %inc = add nsw i32 %i.08, 1
27   %exitcond = icmp eq i32 %i.08, 202
28   br i1 %exitcond, label %for.end, label %for.body
29
30 for.end:                                          ; preds = %for.body
31   ret i32 0
32 }
33
34 attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }