1 ; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-process-unprofitable=false -polly-unprofitable-scalar-accs=false -polly-print-scops -disable-output < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-process-unprofitable=false -polly-unprofitable-scalar-accs=true -polly-print-scops -disable-output < %s | FileCheck %s --check-prefix=HEURISTIC
4 ; Check the effect of -polly-unprofitable-scalar-accs
6 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
8 define void @func(i32 %n, i32 %m, ptr noalias nonnull %A) {
13 %j = phi i32 [0, %entry], [%j.inc, %outer.inc]
14 %j.cmp = icmp slt i32 %j, %n
15 br i1 %j.cmp, label %inner.for, label %outer.exit
18 %i = phi i32 [1, %outer.for], [%i.inc, %inner.inc]
19 %b = phi double [0.0, %outer.for], [%a, %inner.inc]
20 %i.cmp = icmp slt i32 %i, %m
21 br i1 %i.cmp, label %body1, label %inner.exit
24 %A_idx = getelementptr inbounds double, ptr %A, i32 %i
25 %a = load double, ptr %A_idx
26 store double %a, ptr %A_idx
30 %i.inc = add nuw nsw i32 %i, 1
37 store double %b, ptr %A
38 %j.inc = add nuw nsw i32 %j, 1
50 ; CHECK-NEXT: Stmt_outer_for
51 ; CHECK-NEXT: Domain :=
52 ; CHECK-NEXT: [n, m] -> { Stmt_outer_for[i0] : 0 <= i0 <= n; Stmt_outer_for[0] : n < 0 };
53 ; CHECK-NEXT: Schedule :=
54 ; CHECK-NEXT: [n, m] -> { Stmt_outer_for[i0] -> [i0, 0, 0, 0] : i0 <= n; Stmt_outer_for[0] -> [0, 0, 0, 0] : n < 0 };
55 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
56 ; CHECK-NEXT: [n, m] -> { Stmt_outer_for[i0] -> MemRef_b__phi[] };
57 ; CHECK-NEXT: Stmt_inner_for
58 ; CHECK-NEXT: Domain :=
59 ; CHECK-NEXT: [n, m] -> { Stmt_inner_for[i0, i1] : 0 <= i0 < n and 0 <= i1 < m; Stmt_inner_for[i0, 0] : m <= 0 and 0 <= i0 < n };
60 ; CHECK-NEXT: Schedule :=
61 ; CHECK-NEXT: [n, m] -> { Stmt_inner_for[i0, i1] -> [i0, 1, i1, 0] : i1 < m; Stmt_inner_for[i0, 0] -> [i0, 1, 0, 0] : m <= 0 };
62 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
63 ; CHECK-NEXT: [n, m] -> { Stmt_inner_for[i0, i1] -> MemRef_b__phi[] };
64 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
65 ; CHECK-NEXT: [n, m] -> { Stmt_inner_for[i0, i1] -> MemRef_b[] };
66 ; CHECK-NEXT: Stmt_body1
67 ; CHECK-NEXT: Domain :=
68 ; CHECK-NEXT: [n, m] -> { Stmt_body1[i0, i1] : 0 <= i0 < n and 0 <= i1 <= -2 + m };
69 ; CHECK-NEXT: Schedule :=
70 ; CHECK-NEXT: [n, m] -> { Stmt_body1[i0, i1] -> [i0, 1, i1, 1] };
71 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
72 ; CHECK-NEXT: [n, m] -> { Stmt_body1[i0, i1] -> MemRef_a[] };
73 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
74 ; CHECK-NEXT: [n, m] -> { Stmt_body1[i0, i1] -> MemRef_A[1 + i1] };
75 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
76 ; CHECK-NEXT: [n, m] -> { Stmt_body1[i0, i1] -> MemRef_A[1 + i1] };
77 ; CHECK-NEXT: Stmt_inner_inc
78 ; CHECK-NEXT: Domain :=
79 ; CHECK-NEXT: [n, m] -> { Stmt_inner_inc[i0, i1] : 0 <= i0 < n and 0 <= i1 <= -2 + m };
80 ; CHECK-NEXT: Schedule :=
81 ; CHECK-NEXT: [n, m] -> { Stmt_inner_inc[i0, i1] -> [i0, 1, i1, 2] };
82 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
83 ; CHECK-NEXT: [n, m] -> { Stmt_inner_inc[i0, i1] -> MemRef_a[] };
84 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
85 ; CHECK-NEXT: [n, m] -> { Stmt_inner_inc[i0, i1] -> MemRef_b__phi[] };
86 ; CHECK-NEXT: Stmt_outer_inc
87 ; CHECK-NEXT: Domain :=
88 ; CHECK-NEXT: [n, m] -> { Stmt_outer_inc[i0] : 0 <= i0 < n };
89 ; CHECK-NEXT: Schedule :=
90 ; CHECK-NEXT: [n, m] -> { Stmt_outer_inc[i0] -> [i0, 2, 0, 0] };
91 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
92 ; CHECK-NEXT: [n, m] -> { Stmt_outer_inc[i0] -> MemRef_A[0] };
93 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
94 ; CHECK-NEXT: [n, m] -> { Stmt_outer_inc[i0] -> MemRef_b[] };
97 ; HEURISTIC-NOT: Statements