1 ; RUN: opt %loadPolly -polly-print-scops -disable-output < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-print-ast -disable-output < %s | FileCheck %s --check-prefix=AST
4 ; void f(int *A, int N) {
5 ; for (int i = 0; i < N; i++)
22 ; CHECK-NEXT: Stmt_sw_bb_1
23 ; CHECK-NEXT: Domain :=
24 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] : (-1 + i0) mod 4 = 0 and 0 < i0 < N };
25 ; CHECK-NEXT: Schedule :=
26 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] -> [i0, 2] };
27 ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0]
28 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] -> MemRef_A[i0] };
29 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: +] [Scalar: 0]
30 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] -> MemRef_A[i0] };
31 ; CHECK-NEXT: Stmt_sw_bb_2
32 ; CHECK-NEXT: Domain :=
33 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] : (2 + i0) mod 4 = 0 and 2 <= i0 < N };
34 ; CHECK-NEXT: Schedule :=
35 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] -> [i0, 1] };
36 ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0]
37 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] -> MemRef_A[i0] };
38 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: +] [Scalar: 0]
39 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] -> MemRef_A[i0] };
40 ; CHECK-NEXT: Stmt_sw_bb_6
41 ; CHECK-NEXT: Domain :=
42 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_6[i0] : (1 + i0) mod 4 = 0 and 3 <= i0 < N };
43 ; CHECK-NEXT: Schedule :=
44 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_6[i0] -> [i0, 0] };
45 ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0]
46 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_6[i0] -> MemRef_A[i0] };
47 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: +] [Scalar: 0]
48 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_6[i0] -> MemRef_A[i0] };
53 ; AST: for (int c0 = 1; c0 < N; c0 += 4) {
54 ; AST-NEXT: Stmt_sw_bb_1(c0);
55 ; AST-NEXT: if (N >= c0 + 2) {
56 ; AST-NEXT: Stmt_sw_bb_2(c0 + 1);
57 ; AST-NEXT: if (N >= c0 + 3)
58 ; AST-NEXT: Stmt_sw_bb_6(c0 + 2);
63 ; AST-NEXT: { /* original code */ }
65 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
67 define void @f(ptr %A, i32 %N) {
69 %tmp = sext i32 %N to i64
72 for.cond: ; preds = %for.inc, %entry
73 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
74 %cmp = icmp slt i64 %indvars.iv, %tmp
75 br i1 %cmp, label %for.body, label %for.end
77 for.body: ; preds = %for.cond
78 %tmp1 = trunc i64 %indvars.iv to i32
79 %rem = srem i32 %tmp1, 4
80 switch i32 %rem, label %sw.epilog [
87 sw.bb: ; preds = %for.body
90 sw.bb.1: ; preds = %for.body
91 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
92 %tmp2 = load i32, ptr %arrayidx, align 4
93 %add = add nsw i32 %tmp2, 1
94 store i32 %add, ptr %arrayidx, align 4
97 sw.bb.2: ; preds = %for.body
98 %arrayidx4 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
99 %tmp3 = load i32, ptr %arrayidx4, align 4
100 %add5 = add nsw i32 %tmp3, 2
101 store i32 %add5, ptr %arrayidx4, align 4
104 sw.bb.6: ; preds = %for.body
105 %arrayidx8 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
106 %tmp4 = load i32, ptr %arrayidx8, align 4
107 %add9 = add nsw i32 %tmp4, 3
108 store i32 %add9, ptr %arrayidx8, align 4
111 sw.epilog: ; preds = %sw.bb.6, %sw.bb.2, %sw.bb.1, %sw.bb, %for.body
114 for.inc: ; preds = %sw.epilog
115 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
118 for.end: ; preds = %for.cond