• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -basic-aa -polly-dependences -analyze < %s | FileCheck %s
2;
3;
4; These are the important RAW dependences, as they need to originate/end in only one iteration:
5;   Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1]
6;   Stmt_S1[i0, i1] -> Stmt_S2[i0, 0]
7;
8; These are the important WAW dependences, as they need to originate/end in only one iteration:
9;   Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1]
10;   Stmt_S1[i0, i1] -> Stmt_S2[i0, 0]
11;
12; CHECK:      RAW dependences:
13; CHECK-NEXT:     { Stmt_S0[i0] -> Stmt_S1[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S2[i0, i1] -> Stmt_S3[i0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023; Stmt_S3[i0] -> Stmt_S0[1 + i0] : 0 <= i0 <= 1022; Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022 }
14; CHECK-NEXT: WAR dependences:
15; CHECK-NEXT:     { Stmt_S0[i0] -> Stmt_S1[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S2[i0, i1] -> Stmt_S3[i0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023; Stmt_S3[i0] -> Stmt_S0[1 + i0] : 0 <= i0 <= 1022; Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022 }
16; CHECK-NEXT: WAW dependences:
17; CHECK-NEXT:     { Stmt_S0[i0] -> Stmt_S1[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S2[i0, i1] -> Stmt_S3[i0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023; Stmt_S3[i0] -> Stmt_S0[1 + i0] : 0 <= i0 <= 1022; Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022 }
18; CHECK-NEXT: Reduction dependences:
19; CHECK-NEXT:     { Stmt_S1[i0, i1] -> Stmt_S1[i0, 1 + i1] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022; Stmt_S2[i0, i1] -> Stmt_S2[i0, 1 + i1] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022 }
20;
21;    void f(int *restrict red) {
22;      for (int j = 0; j < 1024; j++) {
23; S0:    *red = 42 + *red * 5;
24;        for (int i = 0; i < 1024; i++)
25; S1:      *red *= i;
26;        for (int i = 0; i < 1024; i++)
27; S2:      *red += i;
28; S3:    *red = 42 + *red * 7;
29;      }
30;    }
31;
32target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
33
34define void @f(i32* noalias %red)  {
35entry:
36  br label %for.cond
37
38for.cond:                                         ; preds = %for.inc15, %entry
39  %j.0 = phi i32 [ 0, %entry ], [ %inc16, %for.inc15 ]
40  %exitcond2 = icmp ne i32 %j.0, 1024
41  br i1 %exitcond2, label %for.body, label %for.end17
42
43for.body:                                         ; preds = %for.cond
44  br label %S0
45
46S0:                                               ; preds = %for.body
47  %tmp = load i32, i32* %red, align 4
48  %mul = mul nsw i32 %tmp, 5
49  %add = add nsw i32 %mul, 42
50  store i32 %add, i32* %red, align 4
51  br label %for.cond1
52
53for.cond1:                                        ; preds = %for.inc, %S0
54  %i.0 = phi i32 [ 0, %S0 ], [ %inc, %for.inc ]
55  %exitcond = icmp ne i32 %i.0, 1024
56  br i1 %exitcond, label %for.body3, label %for.end
57
58for.body3:                                        ; preds = %for.cond1
59  br label %S1
60
61S1:                                               ; preds = %for.body3
62  %tmp3 = load i32, i32* %red, align 4
63  %mul4 = mul nsw i32 %tmp3, %i.0
64  store i32 %mul4, i32* %red, align 4
65  br label %for.inc
66
67for.inc:                                          ; preds = %S1
68  %inc = add nsw i32 %i.0, 1
69  br label %for.cond1
70
71for.end:                                          ; preds = %for.cond1
72  br label %for.cond6
73
74for.cond6:                                        ; preds = %for.inc10, %for.end
75  %i5.0 = phi i32 [ 0, %for.end ], [ %inc11, %for.inc10 ]
76  %exitcond1 = icmp ne i32 %i5.0, 1024
77  br i1 %exitcond1, label %for.body8, label %for.end12
78
79for.body8:                                        ; preds = %for.cond6
80  br label %S2
81
82S2:                                               ; preds = %for.body8
83  %tmp4 = load i32, i32* %red, align 4
84  %add9 = add nsw i32 %tmp4, %i5.0
85  store i32 %add9, i32* %red, align 4
86  br label %for.inc10
87
88for.inc10:                                        ; preds = %S2
89  %inc11 = add nsw i32 %i5.0, 1
90  br label %for.cond6
91
92for.end12:                                        ; preds = %for.cond6
93  br label %S3
94
95S3:                                               ; preds = %for.end12
96  %tmp5 = load i32, i32* %red, align 4
97  %mul13 = mul nsw i32 %tmp5, 7
98  %add14 = add nsw i32 %mul13, 42
99  store i32 %add14, i32* %red, align 4
100  br label %for.inc15
101
102for.inc15:                                        ; preds = %S3
103  %inc16 = add nsw i32 %j.0, 1
104  br label %for.cond
105
106for.end17:                                        ; preds = %for.cond
107  ret void
108}
109