1 ; RUN: opt %loadPolly -basic-aa -polly-stmt-granularity=bb -polly-print-ast -polly-ast-detect-parallel -disable-output < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-stmt-granularity=bb -print-polyhedral-info -polly-check-parallel -disable-output < %s | FileCheck %s -check-prefix=PINFO
4 ; void f(int *restrict A, int *restrict B, int *restrict C, int *restrict D,
5 ; int *restrict E, int N) {
6 ; CHECK: #pragma minimal dependence distance: N >= 35 ? 1 : N >= 17 && N <= 34 ? 2 : 5
7 ; PINFO: for.cond: Loop is not parallel.
8 ; for (int i = 0; i < N; i++) {
9 ; A[i] = A[100 - 2 * i] + 1;
10 ; B[i] = B[100 - 3 * i] + 1;
11 ; C[i] = C[100 - 4 * i] + 1;
12 ; D[i] = D[100 - 5 * i] + 1;
13 ; E[i] = E[100 - 6 * i] + 1;
17 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
19 define void @f(ptr noalias %A, ptr noalias %B, ptr noalias %C, ptr noalias %D, ptr noalias %E, i32 %N) {
23 for.cond: ; preds = %for.inc, %entry
24 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
25 %cmp = icmp slt i32 %i.0, %N
26 br i1 %cmp, label %for.body, label %for.end
28 for.body: ; preds = %for.cond
29 %mul = shl nsw i32 %i.0, 1
30 %sub = sub nsw i32 100, %mul
31 %arrayidx = getelementptr inbounds i32, ptr %A, i32 %sub
32 %tmp = load i32, ptr %arrayidx, align 4
33 %add = add nsw i32 %tmp, 1
34 %arrayidx1 = getelementptr inbounds i32, ptr %A, i32 %i.0
35 store i32 %add, ptr %arrayidx1, align 4
36 %tmp1 = mul i32 %i.0, -3
37 %sub3 = add i32 %tmp1, 100
38 %arrayidx4 = getelementptr inbounds i32, ptr %B, i32 %sub3
39 %tmp2 = load i32, ptr %arrayidx4, align 4
40 %add5 = add nsw i32 %tmp2, 1
41 %arrayidx6 = getelementptr inbounds i32, ptr %B, i32 %i.0
42 store i32 %add5, ptr %arrayidx6, align 4
43 %mul7 = shl nsw i32 %i.0, 2
44 %sub8 = sub nsw i32 100, %mul7
45 %arrayidx9 = getelementptr inbounds i32, ptr %C, i32 %sub8
46 %tmp3 = load i32, ptr %arrayidx9, align 4
47 %add10 = add nsw i32 %tmp3, 1
48 %arrayidx11 = getelementptr inbounds i32, ptr %C, i32 %i.0
49 store i32 %add10, ptr %arrayidx11, align 4
50 %tmp4 = mul i32 %i.0, -5
51 %sub13 = add i32 %tmp4, 100
52 %arrayidx14 = getelementptr inbounds i32, ptr %D, i32 %sub13
53 %tmp5 = load i32, ptr %arrayidx14, align 4
54 %add15 = add nsw i32 %tmp5, 1
55 %arrayidx16 = getelementptr inbounds i32, ptr %D, i32 %i.0
56 store i32 %add15, ptr %arrayidx16, align 4
57 %tmp6 = mul i32 %i.0, -6
58 %sub18 = add i32 %tmp6, 100
59 %arrayidx19 = getelementptr inbounds i32, ptr %E, i32 %sub18
60 %tmp7 = load i32, ptr %arrayidx19, align 4
61 %add20 = add nsw i32 %tmp7, 1
62 %arrayidx21 = getelementptr inbounds i32, ptr %E, i32 %i.0
63 store i32 %add20, ptr %arrayidx21, align 4
66 for.inc: ; preds = %for.body
67 %inc = add nsw i32 %i.0, 1
70 for.end: ; preds = %for.cond