1; RUN: opt %loadPolly -polly-ast -polly-ast-detect-parallel -analyze < %s | FileCheck %s
2;
3; CHECK-NOT:#pragma known-parallel reduction
4; CHECK:    #pragma known-parallel
5; CHECK:    for (int c0 = 0; c0 <= 2047; c0 += 1)
6; CHECK:      for (int c1 = 0; c1 <= 1023; c1 += 1)
7; CHECK:        #pragma simd reduction
8; CHECK:        for (int c2 = 0; c2 <= 511; c2 += 1)
9; CHECK:          Stmt_for_body6(c0, c1, c2);
10;
11;    void rmd4(int *A) {
12;      for (long i = 0; i < 2048; i++)
13;        for (long j = 0; j < 1024; j++)
14;          for (long k = 0; k < 512; k++)
15;            A[i] += i;
16;    }
17;
18target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
19
20define void @rmd4(i32* %A) {
21entry:
22  br label %for.cond
23
24for.cond:                                         ; preds = %for.inc10, %entry
25  %i.0 = phi i32 [ 0, %entry ], [ %inc11, %for.inc10 ]
26  %exitcond2 = icmp ne i32 %i.0, 2048
27  br i1 %exitcond2, label %for.body, label %for.end12
28
29for.body:                                         ; preds = %for.cond
30  br label %for.cond1
31
32for.cond1:                                        ; preds = %for.inc7, %for.body
33  %j.0 = phi i32 [ 0, %for.body ], [ %inc8, %for.inc7 ]
34  %exitcond1 = icmp ne i32 %j.0, 1024
35  br i1 %exitcond1, label %for.body3, label %for.end9
36
37for.body3:                                        ; preds = %for.cond1
38  br label %for.cond4
39
40for.cond4:                                        ; preds = %for.inc, %for.body3
41  %k.0 = phi i32 [ 0, %for.body3 ], [ %inc, %for.inc ]
42  %exitcond = icmp ne i32 %k.0, 512
43  br i1 %exitcond, label %for.body6, label %for.end
44
45for.body6:                                        ; preds = %for.cond4
46  %arrayidx = getelementptr inbounds i32, i32* %A, i32 %i.0
47  %tmp = load i32, i32* %arrayidx, align 4
48  %add = add nsw i32 %tmp, %i.0
49  store i32 %add, i32* %arrayidx, align 4
50  br label %for.inc
51
52for.inc:                                          ; preds = %for.body6
53  %inc = add nsw i32 %k.0, 1
54  br label %for.cond4
55
56for.end:                                          ; preds = %for.cond4
57  br label %for.inc7
58
59for.inc7:                                         ; preds = %for.end
60  %inc8 = add nsw i32 %j.0, 1
61  br label %for.cond1
62
63for.end9:                                         ; preds = %for.cond1
64  br label %for.inc10
65
66for.inc10:                                        ; preds = %for.end9
67  %inc11 = add nsw i32 %i.0, 1
68  br label %for.cond
69
70for.end12:                                        ; preds = %for.cond
71  ret void
72}
73