1 ; RUN: opt %loadPolly -polly-ast -polly-ast-detect-parallel -analyze < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polyhedral-info -polly-check-parallel -analyze < %s | FileCheck %s -check-prefix=PINFO
4 ; CHECK: #pragma known-parallel reduction (^ : MemRef_sum)
5 ; void f(int N, int M, int P, int sum[P][M]) {
6 ; PINFO: for.cond: Loop is not parallel.
7 ; for (int i = 0; i < N; i++)
8 ; PINFO-NEXT: for.cond1: Loop is parallel.
9 ; for (int j = 0; j < P; j++)
11 ; PINFO-NEXT: for.cond4: Loop is parallel.
12 ; for (int k = 0; k < M; k++)
16 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
18 define void @f(i32 %N, i32 %M, i32 %P, i32* %sum) {
22 for.cond: ; preds = %for.inc11, %entry
23 %i.0 = phi i32 [ 0, %entry ], [ %inc12, %for.inc11 ]
24 %cmp = icmp slt i32 %i.0, %N
25 br i1 %cmp, label %for.body, label %for.end13
27 for.body: ; preds = %for.cond
30 for.cond1: ; preds = %for.inc8, %for.body
31 %j.0 = phi i32 [ 0, %for.body ], [ %inc9, %for.inc8 ]
32 %cmp2 = icmp slt i32 %j.0, %P
33 br i1 %cmp2, label %for.body3, label %for.end10
35 for.body3: ; preds = %for.cond1
38 for.cond4: ; preds = %for.inc, %for.body3
39 %k.0 = phi i32 [ 0, %for.body3 ], [ %inc, %for.inc ]
40 %cmp5 = icmp slt i32 %k.0, %M
41 br i1 %cmp5, label %for.body6, label %for.end
43 for.body6: ; preds = %for.cond4
44 %tmp = mul nsw i32 %j.0, %M
45 %arrayidx.sum = add i32 %tmp, %k.0
46 %arrayidx7 = getelementptr inbounds i32, i32* %sum, i32 %arrayidx.sum
47 %tmp1 = load i32, i32* %arrayidx7, align 4
48 %xor = xor i32 %tmp1, %j.0
49 store i32 %xor, i32* %arrayidx7, align 4
52 for.inc: ; preds = %for.body6
53 %inc = add nsw i32 %k.0, 1
56 for.end: ; preds = %for.cond4
59 for.inc8: ; preds = %for.end
60 %inc9 = add nsw i32 %j.0, 1
63 for.end10: ; preds = %for.cond1
66 for.inc11: ; preds = %for.end10
67 %inc12 = add nsw i32 %i.0, 1
70 for.end13: ; preds = %for.cond