[ForwardOpTree] Allow out-of-quota in examination part of forwardTree.
[polly-mirror.git] / test / DependenceInfo / reduction_privatization_deps.ll
blobe51357a767e79ab6c3aeeeed2211f8ee43835d77
1 ; RUN: opt %loadPolly -polly-dependences -analyze < %s | FileCheck %s
3 ; CHECK:      RAW dependences:
4 ; CHECK-NEXT:     { Stmt_S0[i0] -> Stmt_S1[o0, i0 - o0] : i0 <= 1023 and 0 <= o0 <= i0; Stmt_S1[i0, i1] -> Stmt_S2[-1 + i0 + i1] : 0 <= i0 <= 1023 and i1 >= 0 and -i0 < i1 <= 1024 - i0 and i1 <= 1023 }
5 ; CHECK-NEXT: WAR dependences:
6 ; CHECK-NEXT:     { Stmt_S2[i0] -> Stmt_S2[1 + i0] : 0 <= i0 <= 1022; Stmt_S1[i0, i1] -> Stmt_S2[i0 + i1] : i0 >= 0 and 0 <= i1 <= 1023 - i0 }
7 ; CHECK-NEXT: WAW dependences:
8 ; CHECK-NEXT:     { Stmt_S0[i0] -> Stmt_S1[o0, i0 - o0] : i0 <= 1023 and 0 <= o0 <= i0; Stmt_S1[i0, i1] -> Stmt_S2[i0 + i1] : i0 >= 0 and 0 <= i1 <= 1023 - i0 }
9 ; CHECK-NEXT: Reduction dependences:
10 ; CHECK-NEXT:     { Stmt_S1[i0, i1] -> Stmt_S1[1 + i0, -1 + i1] : 0 <= i0 <= 1022 and 0 < i1 <= 1023 }
12 ;    void f(int *sum) {
13 ;      for (int i = 0; i < 1024; i++)
14 ; S0:    sum[i] = 0;
15 ;      for (int i = 0; i < 1024; i++)
16 ;        for (int j = 0; j < 1024; j++)
17 ; S1:      sum[i + j] += i;
18 ;      for (int i = 0; i < 1024; i++)
19 ; S2:    sum[i] = sum[i + 1] * 3;
20 ;    }
21 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
23 define void @f(i32* %sum)  {
24 entry:
25   br label %for.cond
27 for.cond:                                         ; preds = %for.inc, %entry
28   %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
29   %exitcond3 = icmp ne i32 %i.0, 1024
30   br i1 %exitcond3, label %for.body, label %for.end
32 for.body:                                         ; preds = %for.cond
33   br label %S0
35 S0:                                               ; preds = %for.body
36   %arrayidx = getelementptr inbounds i32, i32* %sum, i32 %i.0
37   store i32 0, i32* %arrayidx, align 4
38   br label %for.inc
40 for.inc:                                          ; preds = %S0
41   %inc = add nsw i32 %i.0, 1
42   br label %for.cond
44 for.end:                                          ; preds = %for.cond
45   br label %for.cond2
47 for.cond2:                                        ; preds = %for.inc13, %for.end
48   %i1.0 = phi i32 [ 0, %for.end ], [ %inc14, %for.inc13 ]
49   %exitcond2 = icmp ne i32 %i1.0, 1024
50   br i1 %exitcond2, label %for.body4, label %for.end15
52 for.body4:                                        ; preds = %for.cond2
53   br label %for.cond5
55 for.cond5:                                        ; preds = %for.inc10, %for.body4
56   %j.0 = phi i32 [ 0, %for.body4 ], [ %inc11, %for.inc10 ]
57   %exitcond1 = icmp ne i32 %j.0, 1024
58   br i1 %exitcond1, label %for.body7, label %for.end12
60 for.body7:                                        ; preds = %for.cond5
61   br label %S1
63 S1:                                               ; preds = %for.body7
64   %add = add nsw i32 %i1.0, %j.0
65   %arrayidx8 = getelementptr inbounds i32, i32* %sum, i32 %add
66   %tmp = load i32, i32* %arrayidx8, align 4
67   %add9 = add nsw i32 %tmp, %i1.0
68   store i32 %add9, i32* %arrayidx8, align 4
69   br label %for.inc10
71 for.inc10:                                        ; preds = %S1
72   %inc11 = add nsw i32 %j.0, 1
73   br label %for.cond5
75 for.end12:                                        ; preds = %for.cond5
76   br label %for.inc13
78 for.inc13:                                        ; preds = %for.end12
79   %inc14 = add nsw i32 %i1.0, 1
80   br label %for.cond2
82 for.end15:                                        ; preds = %for.cond2
83   br label %for.cond17
85 for.cond17:                                       ; preds = %for.inc23, %for.end15
86   %i16.0 = phi i32 [ 0, %for.end15 ], [ %inc24, %for.inc23 ]
87   %exitcond = icmp ne i32 %i16.0, 1024
88   br i1 %exitcond, label %for.body19, label %for.end25
90 for.body19:                                       ; preds = %for.cond17
91   br label %S2
93 S2:                                               ; preds = %for.body19
94   %add20 = add nsw i32 %i16.0, 1
95   %arrayidx21 = getelementptr inbounds i32, i32* %sum, i32 %add20
96   %tmp4 = load i32, i32* %arrayidx21, align 4
97   %mul = mul nsw i32 %tmp4, 3
98   %arrayidx22 = getelementptr inbounds i32, i32* %sum, i32 %i16.0
99   store i32 %mul, i32* %arrayidx22, align 4
100   br label %for.inc23
102 for.inc23:                                        ; preds = %S2
103   %inc24 = add nsw i32 %i16.0, 1
104   br label %for.cond17
106 for.end25:                                        ; preds = %for.cond17
107   ret void