1 ; RUN: opt %loadPolly -polly-tiling=0 -polly-parallel -polly-opt-outer-coincidence=no -polly-opt-isl -polly-print-ast -disable-output < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-tiling=0 -polly-parallel -polly-opt-outer-coincidence=yes -polly-opt-isl -polly-print-ast -disable-output < %s | FileCheck %s --check-prefix=OUTER
4 ; By skewing, the diagonal can be made parallel. ISL does this when the Check
5 ; the 'outer_coincidence' option is enabled.
7 ; void func(int m, int n, float A[static const restrict m][n]) {
8 ; for (int i = 1; i < m; i+=1)
9 ; for (int j = 1; j < n; j+=1)
10 ; A[i][j] = A[i-1][j] + A[i][j-1];
13 define void @func(i64 %m, i64 %n, ptr noalias nonnull %A) #0 {
17 for.cond: ; preds = %for.inc11, %entry
18 %i.0 = phi i64 [ 1, %entry ], [ %add12, %for.inc11 ]
19 %cmp = icmp slt i64 %i.0, %m
20 br i1 %cmp, label %for.cond1.preheader, label %for.end13
22 for.cond1.preheader: ; preds = %for.cond
25 for.cond1: ; preds = %for.cond1.preheader, %for.body3
26 %j.0 = phi i64 [ %add10, %for.body3 ], [ 1, %for.cond1.preheader ]
27 %cmp2 = icmp slt i64 %j.0, %n
28 br i1 %cmp2, label %for.body3, label %for.inc11
30 for.body3: ; preds = %for.cond1
31 %sub = add nsw i64 %i.0, -1
32 %tmp = mul nsw i64 %sub, %n
33 %arrayidx = getelementptr inbounds float, ptr %A, i64 %tmp
34 %arrayidx4 = getelementptr inbounds float, ptr %arrayidx, i64 %j.0
35 %tmp13 = load float, ptr %arrayidx4, align 4
36 %sub5 = add nsw i64 %j.0, -1
37 %tmp14 = mul nsw i64 %i.0, %n
38 %arrayidx6 = getelementptr inbounds float, ptr %A, i64 %tmp14
39 %arrayidx7 = getelementptr inbounds float, ptr %arrayidx6, i64 %sub5
40 %tmp15 = load float, ptr %arrayidx7, align 4
41 %add = fadd float %tmp13, %tmp15
42 %tmp16 = mul nsw i64 %i.0, %n
43 %arrayidx8 = getelementptr inbounds float, ptr %A, i64 %tmp16
44 %arrayidx9 = getelementptr inbounds float, ptr %arrayidx8, i64 %j.0
45 store float %add, ptr %arrayidx9, align 4
46 %add10 = add nuw nsw i64 %j.0, 1
49 for.inc11: ; preds = %for.cond1
50 %add12 = add nuw nsw i64 %i.0, 1
53 for.end13: ; preds = %for.cond
58 ; CHECK: #pragma minimal dependence distance: 1
59 ; CHECK-NEXT: for (int c0 = 0; c0 < m - 1; c0 += 1)
60 ; CHECK-NEXT: #pragma minimal dependence distance: 1
61 ; CHECK-NEXT: for (int c1 = 0; c1 < n - 1; c1 += 1)
62 ; CHECK-NEXT: Stmt_for_body3(c0, c1);
64 ; OUTER: #pragma minimal dependence distance: 1
65 ; OUTER-NEXT: for (int c0 = 0; c0 < m + n - 3; c0 += 1)
66 ; OUTER-NEXT: #pragma simd
67 ; OUTER-NEXT: #pragma known-parallel
68 ; OUTER-NEXT: for (int c1 = max(0, -n + c0 + 2); c1 <= min(m - 2, c0); c1 += 1)
69 ; OUTER-NEXT: Stmt_for_body3(c1, c0 - c1);