1; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-process-unprofitable=false -polly-unprofitable-scalar-accs=false -polly-scops -analyze < %s | FileCheck %s 2; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-process-unprofitable=false -polly-unprofitable-scalar-accs=true -polly-scops -analyze < %s | FileCheck %s --check-prefix=HEURISTIC 3 4; Check the effect of -polly-unprofitable-scalar-accs 5 6target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 7 8define void @func(i32 %n, i32 %m, double* noalias nonnull %A) { 9entry: 10 br label %outer.for 11 12outer.for: 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 16 17 inner.for: 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 22 23 body1: 24 %A_idx = getelementptr inbounds double, double* %A, i32 %i 25 %a = load double, double* %A_idx 26 store double %a, double* %A_idx 27 br label %inner.inc 28 29 inner.inc: 30 %i.inc = add nuw nsw i32 %i, 1 31 br label %inner.for 32 33 inner.exit: 34 br label %outer.inc 35 36outer.inc: 37 store double %b, double* %A 38 %j.inc = add nuw nsw i32 %j, 1 39 br label %outer.for 40 41outer.exit: 42 br label %return 43 44return: 45 ret void 46} 47 48 49; CHECK: Statements { 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[] }; 95; CHECK-NEXT: } 96 97; HEURISTIC-NOT: Statements 98