1 ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-ast -analyze < %s | FileCheck %s --check-prefix=AST
4 ; void f(int *A, int N) {
5 ; for (int i = 0; i < N; i++) {
25 ; CHECK-NEXT: Stmt_sw_bb
26 ; CHECK-NEXT: Domain :=
27 ; CHECK-NEXT: [N] -> { Stmt_sw_bb[0] : N > 0 };
28 ; CHECK-NEXT: Schedule :=
29 ; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] -> [0, 3] };
30 ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0]
31 ; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] -> MemRef_A[0] };
32 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: +] [Scalar: 0]
33 ; CHECK-NEXT: [N] -> { Stmt_sw_bb[i0] -> MemRef_A[0] };
34 ; CHECK-NEXT: Stmt_sw_bb_1
35 ; CHECK-NEXT: Domain :=
36 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[1] : N >= 2 };
37 ; CHECK-NEXT: Schedule :=
38 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] -> [1, 2] };
39 ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0]
40 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] -> MemRef_A[1] };
41 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: +] [Scalar: 0]
42 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_1[i0] -> MemRef_A[1] };
43 ; CHECK-NEXT: Stmt_sw_bb_5
44 ; CHECK-NEXT: Domain :=
45 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_5[2] : N >= 3 };
46 ; CHECK-NEXT: Schedule :=
47 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_5[i0] -> [2, 1] };
48 ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0]
49 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_5[i0] -> MemRef_A[2] };
50 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: +] [Scalar: 0]
51 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_5[i0] -> MemRef_A[2] };
52 ; CHECK-NEXT: Stmt_sw_bb_9
53 ; CHECK-NEXT: Domain :=
54 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_9[3] : N >= 4 };
55 ; CHECK-NEXT: Schedule :=
56 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_9[i0] -> [3, 0] };
57 ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0]
58 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_9[i0] -> MemRef_A[3] };
59 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: +] [Scalar: 0]
60 ; CHECK-NEXT: [N] -> { Stmt_sw_bb_9[i0] -> MemRef_A[3] };
66 ; AST-NEXT: Stmt_sw_bb(0);
67 ; AST-NEXT: if (N >= 2) {
68 ; AST-NEXT: Stmt_sw_bb_1(1);
69 ; AST-NEXT: if (N >= 3) {
70 ; AST-NEXT: Stmt_sw_bb_5(2);
71 ; AST-NEXT: if (N >= 4)
72 ; AST-NEXT: Stmt_sw_bb_9(3);
78 ; AST-NEXT: { /* original code */ }
80 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
82 define void @f(i32* %A, i32 %N) {
84 %tmp = sext i32 %N to i64
87 for.cond: ; preds = %for.inc, %entry
88 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
89 %cmp = icmp slt i64 %indvars.iv, %tmp
90 br i1 %cmp, label %for.body, label %for.end
92 for.body: ; preds = %for.cond
93 %tmp1 = trunc i64 %indvars.iv to i32
94 switch i32 %tmp1, label %sw.default [
101 sw.bb: ; preds = %for.body
102 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
103 %tmp2 = load i32, i32* %arrayidx, align 4
104 %add = add nsw i32 %tmp2, 1
105 store i32 %add, i32* %arrayidx, align 4
108 sw.bb.1: ; preds = %for.body
109 %arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
110 %tmp3 = load i32, i32* %arrayidx3, align 4
111 %add4 = add nsw i32 %tmp3, 2
112 store i32 %add4, i32* %arrayidx3, align 4
115 sw.bb.5: ; preds = %for.body
116 %arrayidx7 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
117 %tmp4 = load i32, i32* %arrayidx7, align 4
118 %add8 = add nsw i32 %tmp4, 3
119 store i32 %add8, i32* %arrayidx7, align 4
122 sw.bb.9: ; preds = %for.body
123 %arrayidx11 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
124 %tmp5 = load i32, i32* %arrayidx11, align 4
125 %add12 = add nsw i32 %tmp5, 4
126 store i32 %add12, i32* %arrayidx11, align 4
129 sw.default: ; preds = %for.body
132 sw.epilog: ; preds = %sw.default, %sw.bb.9, %sw.bb.5, %sw.bb.1, %sw.bb
135 for.inc: ; preds = %sw.epilog
136 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
139 for.end: ; preds = %for.cond