1 ; RUN: opt %loadPolly -polly-import-jscop -polly-ast -polly-ast-detect-parallel -analyze < %s | FileCheck %s
3 ; CHECK: #pragma known-parallel reduction
4 ; CHECK: for (int c0 = 0; c0 <= 2; c0 += 1) {
5 ; CHECK: if (c0 == 2) {
6 ; CHECK: #pragma simd reduction
7 ; CHECK: for (int c1 = 1; c1 < 2 * n; c1 += 2)
9 ; CHECK: } else if (c0 == 1) {
11 ; CHECK: for (int c1 = 0; c1 < 2 * n; c1 += 1)
14 ; CHECK: #pragma simd reduction
15 ; CHECK: for (int c1 = -2 * n + 2; c1 <= 0; c1 += 2)
16 ; CHECK: Stmt_S0(-c1);
19 ; void rmalrs2(int *A, long n) {
20 ; for (long i = 0; i < 2 * n; i++)
22 ; for (long i = 0; i < 2 * n; i++)
26 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
28 define void @rmalrs2(i32* %A, i32 %n) {
32 for.cond: ; preds = %for.inc, %entry
33 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
34 %mul = shl nsw i32 %n, 1
35 %cmp = icmp slt i32 %i.0, %mul
36 br i1 %cmp, label %for.body, label %for.end
38 for.body: ; preds = %for.cond
41 S0: ; preds = %for.body
42 %tmp = load i32, i32* %A, align 4
43 %add = add nsw i32 %tmp, %i.0
44 store i32 %add, i32* %A, align 4
47 for.inc: ; preds = %S0
48 %inc = add nsw i32 %i.0, 1
51 for.end: ; preds = %for.cond
54 for.cond2: ; preds = %for.inc8, %for.end
55 %i1.0 = phi i32 [ 0, %for.end ], [ %inc9, %for.inc8 ]
56 %mul3 = shl nsw i32 %n, 1
57 %cmp4 = icmp slt i32 %i1.0, %mul3
58 br i1 %cmp4, label %for.body5, label %for.end10
60 for.body5: ; preds = %for.cond2
63 S1: ; preds = %for.body5
64 %add6 = add nsw i32 %i1.0, 1
65 %arrayidx7 = getelementptr inbounds i32, i32* %A, i32 %add6
66 store i32 1, i32* %arrayidx7, align 4
69 for.inc8: ; preds = %S1
70 %inc9 = add nsw i32 %i1.0, 1
73 for.end10: ; preds = %for.cond2