1 ; RUN: opt %loadNPMPolly -aa-pipeline=basic-aa -polly-stmt-granularity=bb '-passes=print<polly-dependences>' -disable-output < %s | FileCheck %s
3 ; CHECK: RAW dependences:
5 ; CHECK-NEXT: WAR dependences:
7 ; CHECK-NEXT: WAW dependences:
9 ; CHECK-NEXT: Reduction dependences:
10 ; CHECK-NEXT: { Stmt_for_body3[i0, i1] -> Stmt_for_body3[o0, 1 + i0 + i1 - o0] : i0 >= 0 and i1 >= 0 and o0 >= -1022 + i0 + i1 and i0 <= o0 <= 1023 and o0 <= 1 + i0 }
12 ; void f(int *restrict A, int *restrict B, int *restrict Values) {
13 ; for (int i = 0; i < 1024; i++) {
14 ; for (int j = 0; j < 1024; j++) {
15 ; A[i] += Values[i + j - 1];
16 ; B[j] += Values[i + j + 42];
21 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
23 define void @f(ptr noalias %A, ptr noalias %B, ptr noalias %Values) {
27 for.cond: ; preds = %for.inc11, %entry
28 %i.0 = phi i32 [ 0, %entry ], [ %inc12, %for.inc11 ]
29 %exitcond1 = icmp ne i32 %i.0, 1024
30 br i1 %exitcond1, label %for.body, label %for.end13
32 for.body: ; preds = %for.cond
35 for.cond1: ; preds = %for.inc, %for.body
36 %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
37 %exitcond = icmp ne i32 %j.0, 1024
38 br i1 %exitcond, label %for.body3, label %for.end
40 for.body3: ; preds = %for.cond1
41 %add = add nsw i32 %i.0, %j.0
42 %sub = add nsw i32 %add, -1
43 %arrayidx = getelementptr inbounds i32, ptr %Values, i32 %sub
44 %tmp = load i32, ptr %arrayidx, align 4
45 %arrayidx4 = getelementptr inbounds i32, ptr %A, i32 %i.0
46 %tmp2 = load i32, ptr %arrayidx4, align 4
47 %add5 = add nsw i32 %tmp2, %tmp
48 store i32 %add5, ptr %arrayidx4, align 4
49 %add6 = add nsw i32 %i.0, %j.0
50 %add7 = add nsw i32 %add6, 42
51 %arrayidx8 = getelementptr inbounds i32, ptr %Values, i32 %add7
52 %tmp3 = load i32, ptr %arrayidx8, align 4
53 %arrayidx9 = getelementptr inbounds i32, ptr %B, i32 %j.0
54 %tmp4 = load i32, ptr %arrayidx9, align 4
55 %add10 = add nsw i32 %tmp4, %tmp3
56 store i32 %add10, ptr %arrayidx9, align 4
59 for.inc: ; preds = %for.body3
60 %inc = add nsw i32 %j.0, 1
63 for.end: ; preds = %for.cond1
66 for.inc11: ; preds = %for.end
67 %inc12 = add nsw i32 %i.0, 1
70 for.end13: ; preds = %for.cond