• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -polly-dependences -analyze < %s | FileCheck %s
2;
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 }
11;
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;    }
21target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
22
23define void @f(i32* %sum)  {
24entry:
25  br label %for.cond
26
27for.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
31
32for.body:                                         ; preds = %for.cond
33  br label %S0
34
35S0:                                               ; 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
39
40for.inc:                                          ; preds = %S0
41  %inc = add nsw i32 %i.0, 1
42  br label %for.cond
43
44for.end:                                          ; preds = %for.cond
45  br label %for.cond2
46
47for.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
51
52for.body4:                                        ; preds = %for.cond2
53  br label %for.cond5
54
55for.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
59
60for.body7:                                        ; preds = %for.cond5
61  br label %S1
62
63S1:                                               ; 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
70
71for.inc10:                                        ; preds = %S1
72  %inc11 = add nsw i32 %j.0, 1
73  br label %for.cond5
74
75for.end12:                                        ; preds = %for.cond5
76  br label %for.inc13
77
78for.inc13:                                        ; preds = %for.end12
79  %inc14 = add nsw i32 %i1.0, 1
80  br label %for.cond2
81
82for.end15:                                        ; preds = %for.cond2
83  br label %for.cond17
84
85for.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
89
90for.body19:                                       ; preds = %for.cond17
91  br label %S2
92
93S2:                                               ; 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
101
102for.inc23:                                        ; preds = %S2
103  %inc24 = add nsw i32 %i16.0, 1
104  br label %for.cond17
105
106for.end25:                                        ; preds = %for.cond17
107  ret void
108}
109