1 ; RUN: opt -basic-aa %loadPolly -polly-stmt-granularity=bb -polly-print-scops -disable-output < %s | FileCheck %s
3 ; CHECK: ReadAccess := [Reduction Type: NONE
4 ; CHECK: { Stmt_for_body[i0] -> MemRef_A[1 + i0] };
5 ; CHECK: ReadAccess := [Reduction Type: NONE
6 ; CHECK: { Stmt_for_body[i0] -> MemRef_A[i0] };
7 ; CHECK: MustWriteAccess := [Reduction Type: NONE
8 ; CHECK: { Stmt_for_body[i0] -> MemRef_first[0] };
9 ; CHECK: ReadAccess := [Reduction Type: +
10 ; CHECK: { Stmt_for_body[i0] -> MemRef_sum[0] };
11 ; CHECK: MustWriteAccess := [Reduction Type: +
12 ; CHECK: { Stmt_for_body[i0] -> MemRef_sum[0] };
13 ; CHECK: ReadAccess := [Reduction Type: NONE
14 ; CHECK: { Stmt_for_body[i0] -> MemRef_A[-1 + i0] };
15 ; CHECK: ReadAccess := [Reduction Type: NONE
16 ; CHECK: { Stmt_for_body[i0] -> MemRef_A[i0] };
17 ; CHECK: MustWriteAccess := [Reduction Type: NONE
18 ; CHECK: { Stmt_for_body[i0] -> MemRef_middle[0] };
19 ; CHECK: ReadAccess := [Reduction Type: *
20 ; CHECK: { Stmt_for_body[i0] -> MemRef_prod[0] };
21 ; CHECK: MustWriteAccess := [Reduction Type: *
22 ; CHECK: { Stmt_for_body[i0] -> MemRef_prod[0] };
23 ; CHECK: ReadAccess := [Reduction Type: NONE
24 ; CHECK: { Stmt_for_body[i0] -> MemRef_A[-1 + i0] };
25 ; CHECK: ReadAccess := [Reduction Type: NONE
26 ; CHECK: { Stmt_for_body[i0] -> MemRef_A[1 + i0] };
27 ; CHECK: MustWriteAccess := [Reduction Type: NONE
28 ; CHECK: { Stmt_for_body[i0] -> MemRef_last[0] };
30 ; int first, sum, middle, prod, last;
32 ; void f(int * restrict A) {
34 ; for (int i = 0; i < 100; i++) {
35 ; first = A[i+1] + A[i];
37 ; middle = A[i-1] + A[i];
39 ; last = A[i-1] + A[i+1];
42 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
44 @first = common global i32 0, align 4
45 @sum = common global i32 0, align 4
46 @middle = common global i32 0, align 4
47 @prod = common global i32 0, align 4
48 @last = common global i32 0, align 4
50 define void @f(ptr noalias %A) {
54 for.cond: ; preds = %for.inc, %entry
55 %i1.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
56 %exitcond = icmp ne i32 %i1.0, 100
57 br i1 %exitcond, label %for.body, label %for.end
59 for.body: ; preds = %for.cond
60 %add = add nsw i32 %i1.0, 1
61 %arrayidx = getelementptr inbounds i32, ptr %A, i32 %add
62 %tmp = load i32, ptr %arrayidx, align 4
63 %arrayidx2 = getelementptr inbounds i32, ptr %A, i32 %i1.0
64 %tmp1 = load i32, ptr %arrayidx2, align 4
65 %add3 = add nsw i32 %tmp, %tmp1
66 store i32 %add3, ptr @first, align 4
67 %mul = mul nsw i32 %i1.0, 3
68 %tmp2 = load i32, ptr @sum, align 4
69 %add4 = add nsw i32 %tmp2, %mul
70 store i32 %add4, ptr @sum, align 4
71 %sub = add nsw i32 %i1.0, -1
72 %arrayidx5 = getelementptr inbounds i32, ptr %A, i32 %sub
73 %tmp3 = load i32, ptr %arrayidx5, align 4
74 %arrayidx6 = getelementptr inbounds i32, ptr %A, i32 %i1.0
75 %tmp4 = load i32, ptr %arrayidx6, align 4
76 %add7 = add nsw i32 %tmp3, %tmp4
77 store i32 %add7, ptr @middle, align 4
78 %add8 = add nsw i32 %i1.0, 3
79 %tmp5 = load i32, ptr @prod, align 4
80 %mul9 = mul nsw i32 %tmp5, %add8
81 store i32 %mul9, ptr @prod, align 4
82 %sub10 = add nsw i32 %i1.0, -1
83 %arrayidx11 = getelementptr inbounds i32, ptr %A, i32 %sub10
84 %tmp6 = load i32, ptr %arrayidx11, align 4
85 %add12 = add nsw i32 %i1.0, 1
86 %arrayidx13 = getelementptr inbounds i32, ptr %A, i32 %add12
87 %tmp7 = load i32, ptr %arrayidx13, align 4
88 %add14 = add nsw i32 %tmp6, %tmp7
89 store i32 %add14, ptr @last, align 4
92 for.inc: ; preds = %for.body
93 %inc = add nsw i32 %i1.0, 1
96 for.end: ; preds = %for.cond