1; RUN: opt %loadPolly -polly-dependences -analyze < %s | FileCheck %s
2;
3; CHECK:      RAW dependences:
4; CHECK-NEXT:     [N] -> { Stmt_S0[] -> Stmt_S1[o0] : N >= 11 and 0 <= o0 <= 1023; Stmt_S1[i0] -> Stmt_S2[] : N >= 11 and 0 <= i0 <= 1023 }
5; CHECK-NEXT: WAR dependences:
6; CHECK-NEXT:     [N] -> { Stmt_S1[i0] -> Stmt_S2[] : N >= 11 and 0 <= i0 <= 1023 }
7; CHECK-NEXT: WAW dependences:
8; CHECK-NEXT:     [N] -> { Stmt_S0[] -> Stmt_S1[o0] : N >= 11 and 0 <= o0 <= 1023; Stmt_S1[i0] -> Stmt_S2[] : N >= 11 and 0 <= i0 <= 1023 }
9; CHECK-NEXT: Reduction dependences:
10; CHECK-NEXT:     [N] -> { Stmt_S1[i0] -> Stmt_S1[1 + i0] : N >= 11 and 0 <= i0 <= 1022 }
11;
12;    void f(int *sum, int N) {
13;      if (N >= 10) {
14; S0:    *sum = 0;
15;        for (int i = 0; i < 1024; i++)
16; S1:      *sum += i;
17; S2:    *sum = *sum * 3;
18;      }
19;    }
20target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
21
22define void @f(i32* %sum, i32 %N) {
23entry:
24  br label %entry.1
25
26entry.1:
27  %excond = icmp sgt i32 %N, 10
28  br i1 %excond, label %S0, label %f.end
29
30S0:
31  store i32 0, i32* %sum, align 4
32  br label %for.cond
33
34for.cond:                                         ; preds = %for.inc, %S0
35  %i.0 = phi i32 [ 0, %S0 ], [ %inc, %for.inc ]
36  %exitcond = icmp ne i32 %i.0, 1024
37  br i1 %exitcond, label %S1, label %S2
38
39S1:                                               ; preds = %for.cond
40  %tmp = load i32, i32* %sum, align 4
41  %add = add nsw i32 %tmp, %i.0
42  store i32 %add, i32* %sum, align 4
43  br label %for.inc
44
45for.inc:                                          ; preds = %S1
46  %inc = add nsw i32 %i.0, 1
47  br label %for.cond
48
49S2:                                               ; preds = %for.cond
50  %tmp1 = load i32, i32* %sum, align 4
51  %mul = mul nsw i32 %tmp1, 3
52  store i32 %mul, i32* %sum, align 4
53  br label %f.end
54
55f.end:
56  ret void
57}
58