llvm-project
72 строки · 2.6 Кб
1; RUN: opt %loadNPMPolly -aa-pipeline=basic-aa -polly-stmt-granularity=bb '-passes=print<polly-dependences>' -disable-output < %s | FileCheck %s
2;
3; CHECK: RAW dependences:
4; CHECK-NEXT: { }
5; CHECK-NEXT: WAR dependences:
6; CHECK-NEXT: { }
7; CHECK-NEXT: WAW dependences:
8; CHECK-NEXT: { }
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 }
11;
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];
17; }
18; }
19; }
20;
21target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
22
23define void @f(ptr noalias %A, ptr noalias %B, ptr noalias %Values) {
24entry:
25br label %for.cond
26
27for.cond: ; preds = %for.inc11, %entry
28%i.0 = phi i32 [ 0, %entry ], [ %inc12, %for.inc11 ]
29%exitcond1 = icmp ne i32 %i.0, 1024
30br i1 %exitcond1, label %for.body, label %for.end13
31
32for.body: ; preds = %for.cond
33br label %for.cond1
34
35for.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
38br i1 %exitcond, label %for.body3, label %for.end
39
40for.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
48store 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
56store i32 %add10, ptr %arrayidx9, align 4
57br label %for.inc
58
59for.inc: ; preds = %for.body3
60%inc = add nsw i32 %j.0, 1
61br label %for.cond1
62
63for.end: ; preds = %for.cond1
64br label %for.inc11
65
66for.inc11: ; preds = %for.end
67%inc12 = add nsw i32 %i.0, 1
68br label %for.cond
69
70for.end13: ; preds = %for.cond
71ret void
72}
73