1; RUN: opt %loadPolly -analyze -polly-scops \
2; RUN: < %s | FileCheck %s
3;
4;    float foo(float sum, float A[]) {
5;
6;      for (long i = 0; i < 100; i++)
7;        sum += A[i];
8;
9;      return sum;
10;    }
11
12; CHECK:      Statements {
13; CHECK-NEXT:     Stmt_next
14; CHECK-NEXT:         Domain :=
15; CHECK-NEXT:             { Stmt_next[] };
16; CHECK-NEXT:         Schedule :=
17; CHECK-NEXT:             { Stmt_next[] -> [0, 0] };
18; CHECK-NEXT:         ReadAccess :=    [Reduction Type: NONE] [Scalar: 1]
19; CHECK-NEXT:             { Stmt_next[] -> MemRef_sum[] };
20; CHECK-NEXT:         MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 1]
21; CHECK-NEXT:             { Stmt_next[] -> MemRef_phisum__phi[] };
22; CHECK-NEXT:         MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 1]
23; CHECK-NEXT:             { Stmt_next[] -> MemRef_phisummerge[] };
24; CHECK-NEXT:     Stmt_bb1
25; CHECK-NEXT:         Domain :=
26; CHECK-NEXT:             { Stmt_bb1[i0] : 0 <= i0 <= 100 };
27; CHECK-NEXT:         Schedule :=
28; CHECK-NEXT:             { Stmt_bb1[i0] -> [1, i0] };
29; CHECK-NEXT:         MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 1]
30; CHECK-NEXT:             { Stmt_bb1[i0] -> MemRef_phisum__phi[] };
31; CHECK-NEXT:         ReadAccess :=    [Reduction Type: NONE] [Scalar: 1]
32; CHECK-NEXT:             { Stmt_bb1[i0] -> MemRef_phisum__phi[] };
33; CHECK-NEXT:         ReadAccess :=    [Reduction Type: NONE] [Scalar: 0]
34; CHECK-NEXT:             { Stmt_bb1[i0] -> MemRef_A[i0] };
35; CHECK-NEXT:         MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 1]
36; CHECK-NEXT:             { Stmt_bb1[i0] -> MemRef_phisummerge[] };
37; CHECK-NEXT: }
38
39target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
40
41define float @foo(float %sum, float* %A) {
42bb:
43  br label %next
44
45next:
46  br i1 true, label %bb1, label %bb7
47
48bb1:
49  %i = phi i64 [ 0, %next ], [ %i.next, %bb1 ]
50  %phisum = phi float [ %sum, %next ], [ %tmp5, %bb1 ]
51  %tmp = getelementptr inbounds float, float* %A, i64 %i
52  %tmp4 = load float, float* %tmp, align 4
53  %tmp5 = fadd float %phisum, %tmp4
54  %i.next = add nuw nsw i64 %i, 1
55  %exitcond = icmp ne i64 %i, 100
56  br i1 %exitcond, label %bb1, label %bb7
57
58bb7:
59  %phisummerge = phi float [%phisum, %bb1], [0.0, %next]
60  ret float %phisummerge
61}
62