1; RUN: opt %loadPolly -polly-import-jscop -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
3;
4; CHECK-NOT: #pragma simd{{\s*$}}
5; CHECK: #pragma simd reduction
6; CHECK: Stmt_S0(n - c1)
7; CHECK: #pragma simd{{\s*$}}
8; CHECK: Stmt_S1(n - c1)
9;
10; PINFO:       for.cond2: Loop is parallel.
11; PINFO-NEXT:  for.cond: Loop is not parallel.
12;
13;    void rlr(int *A, long n) {
14;      for (long i = 0; i < 2 * n; i++)
15; S0:    A[0] += i;
16;      for (long i = 0; i < 2 * n; i++)
17; S1:    A[i + 1] = 1;
18;    }
19;
20target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
21
22define void @rlr(i32* %A, i32 %n) {
23entry:
24  br label %for.cond
25
26for.cond:                                         ; preds = %for.inc, %entry
27  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
28  %mul = shl nsw i32 %n, 1
29  %cmp = icmp slt i32 %i.0, %mul
30  br i1 %cmp, label %for.body, label %for.end
31
32for.body:                                         ; preds = %for.cond
33  br label %S0
34
35S0:                                               ; preds = %for.body
36  %tmp = load i32, i32* %A, align 4
37  %add = add nsw i32 %tmp, %i.0
38  store i32 %add, i32* %A, align 4
39  br label %for.inc
40
41for.inc:                                          ; preds = %S0
42  %inc = add nsw i32 %i.0, 1
43  br label %for.cond
44
45for.end:                                          ; preds = %for.cond
46  br label %for.cond2
47
48for.cond2:                                        ; preds = %for.inc8, %for.end
49  %i1.0 = phi i32 [ 0, %for.end ], [ %inc9, %for.inc8 ]
50  %mul3 = shl nsw i32 %n, 1
51  %cmp4 = icmp slt i32 %i1.0, %mul3
52  br i1 %cmp4, label %for.body5, label %for.end10
53
54for.body5:                                        ; preds = %for.cond2
55  br label %S1
56
57S1:                                               ; preds = %for.body5
58  %add6 = add nsw i32 %i1.0, 1
59  %arrayidx7 = getelementptr inbounds i32, i32* %A, i32 %add6
60  store i32 1, i32* %arrayidx7, align 4
61  br label %for.inc8
62
63for.inc8:                                         ; preds = %S1
64  %inc9 = add nsw i32 %i1.0, 1
65  br label %for.cond2
66
67for.end10:                                        ; preds = %for.cond2
68  ret void
69}
70
71