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++)
21 ; CHECK-NEXT: Stmt_sw_bb
22 ; CHECK-NEXT: Domain :=
23 ; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] : (i0) mod 4 = 0 and 0 <= i0 < N };
24 ; CHECK-NEXT: Schedule :=
25 ; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] -> [i0, 1] };
26 ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0]
27 ; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] -> MemRef_A[i0] };
28 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: +] [Scalar: 0]
29 ; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] -> MemRef_A[i0] };
30 ; CHECK-NEXT: Stmt_sw_bb_2
31 ; CHECK-NEXT: Domain :=
32 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] : (2 + i0) mod 4 = 0 and 2 <= i0 < N };
33 ; CHECK-NEXT: Schedule :=
34 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] -> [i0, 0] };
35 ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0]
36 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] -> MemRef_A[i0] };
37 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: +] [Scalar: 0]
38 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_2[i0] -> MemRef_A[i0] };
43 ; AST: for (int c0 = 0; c0 < N; c0 += 4) {
44 ; AST-NEXT: Stmt_sw_bb(c0);
45 ; AST-NEXT: if (N >= c0 + 3)
46 ; AST-NEXT: Stmt_sw_bb_2(c0 + 2);
50 ; AST-NEXT: { /* original code */ }
52 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
54 define void @f(ptr %A, i32 %N) {
56 %tmp = sext i32 %N to i64
59 for.cond: ; preds = %for.inc, %entry
60 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
61 %cmp = icmp slt i64 %indvars.iv, %tmp
62 br i1 %cmp, label %for.body, label %for.end
64 for.body: ; preds = %for.cond
65 %tmp1 = trunc i64 %indvars.iv to i32
66 %rem = srem i32 %tmp1, 4
67 switch i32 %rem, label %sw.epilog [
74 sw.bb: ; preds = %for.body
75 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
76 %tmp2 = load i32, ptr %arrayidx, align 4
77 %add = add nsw i32 %tmp2, 1
78 store i32 %add, ptr %arrayidx, align 4
81 sw.bb.1: ; preds = %for.body
84 sw.bb.2: ; preds = %for.body
85 %arrayidx4 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
86 %tmp3 = load i32, ptr %arrayidx4, align 4
87 %add5 = add nsw i32 %tmp3, 2
88 store i32 %add5, ptr %arrayidx4, align 4
91 sw.bb.6: ; preds = %for.body
94 sw.epilog: ; preds = %sw.bb.6, %sw.bb.2, %sw.bb.1, %sw.bb, %for.body
97 for.inc: ; preds = %sw.epilog
98 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
101 for.end: ; preds = %for.cond