1 ; RUN: opt %loadPolly -polly-detect-unprofitable -polly-dependences -analyze < %s | FileCheck %s
3 ; CHECK: RAW dependences:
4 ; CHECK-DAG: Stmt_S2[i0, 0] -> Stmt_S1[1 + i0, 0] : i0 <= 97 and i0 >= 0
5 ; CHECK-DAG: Stmt_S1[i0, 0] -> Stmt_S2[i0, 0] : i0 <= 98 and i0 >= 0
6 ; CHECK: WAR dependences:
8 ; CHECK: WAW dependences:
9 ; CHECK-DAG: Stmt_S2[i0, 0] -> Stmt_S1[1 + i0, 0] : i0 <= 97 and i0 >= 0
10 ; CHECK-DAG: Stmt_S1[i0, 0] -> Stmt_S2[i0, 0] : i0 <= 98 and i0 >= 0
11 ; CHECK: Reduction dependences:
12 ; CHECK-DAG: { Stmt_S2[i0, i1] -> Stmt_S2[1 + i0, i1] : i0 <= 97 and i0 >= 0 and i1 <= 99 and i1 >= 1 }
15 ; for (int i = 0; i < 99; i++) {
16 ; for (int j = 0; j < 1; j++)
18 ; for (int j = 0; j < 100; j++)
19 ; S2: sum[j] += i * j;
23 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
25 define void @f(i32* %sum) {
29 for.cond: ; preds = %for.inc12, %entry
30 %i.0 = phi i32 [ 0, %entry ], [ %inc13, %for.inc12 ]
31 %exitcond2 = icmp ne i32 %i.0, 99
32 br i1 %exitcond2, label %for.body, label %for.end14
34 for.body: ; preds = %for.cond
37 for.cond1: ; preds = %for.inc, %for.body
38 %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
39 %exitcond = icmp ne i32 %j.0, 1
40 br i1 %exitcond, label %for.body3, label %for.end
42 for.body3: ; preds = %for.cond1
45 S1: ; preds = %for.body3
46 %arrayidx = getelementptr inbounds i32, i32* %sum, i32 %j.0
47 %tmp = load i32* %arrayidx, align 4
48 %add = add nsw i32 %tmp, 42
49 store i32 %add, i32* %arrayidx, align 4
52 for.inc: ; preds = %S1
53 %inc = add nsw i32 %j.0, 1
56 for.end: ; preds = %for.cond1
59 for.cond4: ; preds = %for.inc9, %for.end
60 %j.1 = phi i32 [ 0, %for.end ], [ %inc10, %for.inc9 ]
61 %exitcond1 = icmp ne i32 %j.1, 100
62 br i1 %exitcond1, label %for.body6, label %for.end11
64 for.body6: ; preds = %for.cond4
67 S2: ; preds = %for.body6
68 %mul = mul nsw i32 %i.0, %j.1
69 %arrayidx7 = getelementptr inbounds i32, i32* %sum, i32 %j.1
70 %tmp3 = load i32* %arrayidx7, align 4
71 %add8 = add nsw i32 %tmp3, %mul
72 store i32 %add8, i32* %arrayidx7, align 4
75 for.inc9: ; preds = %S2
76 %inc10 = add nsw i32 %j.1, 1
79 for.end11: ; preds = %for.cond4
82 for.inc12: ; preds = %for.end11
83 %inc13 = add nsw i32 %i.0, 1
86 for.end14: ; preds = %for.cond