1; RUN: opt %loadPolly -polly-stmt-granularity=bb -analyze -polly-scops %s | FileCheck %s
2
3; CHECK-LABEL: Function: foo
4;
5; CHECK:       Statements {
6; CHECK-NEXT:      Stmt_body
7; CHECK-NEXT:          Domain :=
8; CHECK-NEXT:              { Stmt_body[i0] : 0 <= i0 <= 100 };
9; CHECK-NEXT:          Schedule :=
10; CHECK-NEXT:              { Stmt_body[i0] -> [i0] };
11; CHECK-NEXT:          MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 1]
12; CHECK-NEXT:              { Stmt_body[i0] -> MemRef_sum__phi[] };
13; CHECK-NEXT:          ReadAccess :=    [Reduction Type: NONE] [Scalar: 1]
14; CHECK-NEXT:              { Stmt_body[i0] -> MemRef_sum__phi[] };
15; CHECK-NEXT:          ReadAccess :=    [Reduction Type: NONE] [Scalar: 0]
16; CHECK-NEXT:              { Stmt_body[i0] -> MemRef_A[i0] };
17; CHECK-NEXT:          MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 1]
18; CHECK-NEXT:              { Stmt_body[i0] -> MemRef_sum_next[] };
19; CHECK-NEXT:  }
20
21target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
22
23define float @foo(float* %A) {
24entry:
25  br label %header
26
27header:
28  fence seq_cst
29  br i1 true, label %body, label %exit
30
31body:
32  %i = phi i64 [ 0, %header ], [ %next, %body ]
33  %sum = phi float [ 0.0, %header ], [ %sum.next, %body ]
34  %arrayidx = getelementptr float, float* %A, i64 %i
35  %scalar = fadd float 0.0, 0.0
36  %next = add nuw nsw i64 %i, 1
37  %val = load float, float* %arrayidx
38  %sum.next = fadd float %sum, %val
39  %cond = icmp ne i64 %i, 100
40  br i1 %cond, label %body, label %after
41
42after:
43  br label %exit
44
45exit:
46  %phi = phi float [%sum.next, %after], [0.0, %header]
47  ret float %phi
48}
49