1; RUN: opt %loadPolly -polly-dependences -analyze < %s | FileCheck %s
2; RUN: opt %loadPolly -polly-dependences -polly-dependences-analysis-level=reference-wise -analyze < %s | FileCheck %s
3; RUN: opt %loadPolly -polly-dependences -polly-dependences-analysis-level=access-wise -analyze < %s | FileCheck %s
4;
5; CHECK:      RAW dependences:
6; CHECK-NEXT:     {  }
7; CHECK-NEXT: WAR dependences:
8; CHECK-NEXT:     {  }
9; CHECK-NEXT: WAW dependences:
10; CHECK-NEXT:     {  }
11; CHECK-NEXT: Reduction dependences:
12; CHECK-NEXT:     { Stmt_for_body3[i0, i1] -> Stmt_for_body3[2 + i0, -1 + i1] : 0 <= i0 <= 97 and 0 < i1 <= 99 }
13;
14; void f(int *sum) {
15;   for (int i = 0; i < 100; i++)
16;     for (int j = 0; j < 100; j++)
17;       sum[i+j*2] += j * i;
18; }
19target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
20
21define void @f(i32* %sum) {
22entry:
23  br label %for.cond
24
25for.cond:                                         ; preds = %for.inc6, %entry
26  %i.0 = phi i32 [ 0, %entry ], [ %inc7, %for.inc6 ]
27  %exitcond1 = icmp ne i32 %i.0, 100
28  br i1 %exitcond1, label %for.body, label %for.end8
29
30for.body:                                         ; preds = %for.cond
31  br label %for.cond1
32
33for.cond1:                                        ; preds = %for.inc, %for.body
34  %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
35  %exitcond = icmp ne i32 %j.0, 100
36  br i1 %exitcond, label %for.body3, label %for.end
37
38for.body3:                                        ; preds = %for.cond1
39  %mul = mul nsw i32 %j.0, %i.0
40  %mul4 = shl nsw i32 %j.0, 1
41  %add = add nsw i32 %i.0, %mul4
42  %arrayidx = getelementptr inbounds i32, i32* %sum, i32 %add
43  %tmp = load i32, i32* %arrayidx, align 4
44  %add5 = add nsw i32 %tmp, %mul
45  store i32 %add5, i32* %arrayidx, align 4
46  br label %for.inc
47
48for.inc:                                          ; preds = %for.body3
49  %inc = add nsw i32 %j.0, 1
50  br label %for.cond1
51
52for.end:                                          ; preds = %for.cond1
53  br label %for.inc6
54
55for.inc6:                                         ; preds = %for.end
56  %inc7 = add nsw i32 %i.0, 1
57  br label %for.cond
58
59for.end8:                                         ; preds = %for.cond
60  ret void
61}
62