1 ; RUN: opt %loadPolly %defaultOpts -polly-codegen -enable-polly-vector -dce -S %s | FileCheck %s
2 ; Obtained from C source as:
3 ; clang -S -emit-llvm -O0 vect-91.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-91.s > vect-91.ll
6 ; ModuleID = 'vect-91.s'
7 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
8 target triple = "x86_64-unknown-linux-gnu"
10 @a = external global [276 x i32]
12 define i32 @main1(i32* %pa) nounwind uwtable noinline {
16 for.cond: ; preds = %for.inc, %entry
17 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
18 %arrayidx = getelementptr i32* %pa, i64 %indvar
19 %exitcond = icmp ne i64 %indvar, 256
20 br i1 %exitcond, label %for.body, label %for.end
22 for.body: ; preds = %for.cond
23 %tmp3 = load i32* %arrayidx, align 4
24 %add = add nsw i32 %tmp3, 1
25 store i32 %add, i32* %arrayidx, align 4
28 for.inc: ; preds = %for.body
29 %indvar.next = add i64 %indvar, 1
32 for.end: ; preds = %for.cond
36 define i32 @main2() nounwind uwtable noinline {
40 for.cond: ; preds = %for.inc, %entry
41 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
42 %arrayidx = getelementptr [276 x i32]* @a, i64 0, i64 %indvar
43 %exitcond = icmp ne i64 %indvar, 256
44 br i1 %exitcond, label %for.body, label %for.end
46 for.body: ; preds = %for.cond
47 %tmp2 = load i32* %arrayidx, align 4
48 %add = add nsw i32 %tmp2, 1
49 store i32 %add, i32* %arrayidx, align 4
52 for.inc: ; preds = %for.body
53 %indvar.next = add i64 %indvar, 1
56 for.end: ; preds = %for.cond
60 define i32 @main3() nounwind uwtable noinline {
64 for.cond: ; preds = %for.inc, %entry
65 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
66 %arrayidx5 = getelementptr [276 x i32]* @a, i64 0, i64 %indvar
67 %tmp = add i64 %indvar, 20
68 %arrayidx = getelementptr [276 x i32]* @a, i64 0, i64 %tmp
69 %exitcond = icmp ne i64 %indvar, 256
70 br i1 %exitcond, label %for.body, label %for.end
72 for.body: ; preds = %for.cond
73 %tmp2 = load i32* %arrayidx, align 4
74 store i32 %tmp2, i32* %arrayidx5, align 4
77 for.inc: ; preds = %for.body
78 %indvar.next = add i64 %indvar, 1
81 for.end: ; preds = %for.cond