1 ; RUN: opt %loadPolly -polly-analyze-read-only-scalars=true -polly-print-optree -disable-output < %s | FileCheck %s -match-full-lines -check-prefixes=STATS,MODEL
2 ; RUN: opt %loadPolly -polly-analyze-read-only-scalars=false -polly-print-optree -disable-output < %s | FileCheck %s -match-full-lines -check-prefixes=STATS,NOMODEL
4 ; Move %val to %bodyB, so %bodyA can be removed (by -polly-simplify)
6 ; for (int j = 0; j < n; j += 1) {
8 ; double val = arg + 21.0;
14 define void @func(i32 %n, ptr noalias nonnull %A, double %arg) {
19 %j = phi i32 [0, %entry], [%j.inc, %inc]
20 %j.cmp = icmp slt i32 %j, %n
21 br i1 %j.cmp, label %bodyA, label %exit
24 %val = fadd double %arg, 21.0
28 store double %val, ptr %A
32 %j.inc = add nuw nsw i32 %j, 1
44 ; STATS: Instructions copied: 1
45 ; MODEL: Read-only accesses copied: 1
46 ; NOMODEL: Read-only accesses copied: 0
47 ; STATS: Operand trees forwarded: 1
48 ; STATS: Statements with forwarded operand trees: 1
51 ; MODEL: After statements {
52 ; MODEL-NEXT: Stmt_bodyA
53 ; MODEL-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
54 ; MODEL-NEXT: [n] -> { Stmt_bodyA[i0] -> MemRef_arg[] };
55 ; MODEL-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
56 ; MODEL-NEXT: [n] -> { Stmt_bodyA[i0] -> MemRef_val[] };
57 ; MODEL-NEXT: Instructions {
58 ; MODEL-NEXT: %val = fadd double %arg, 2.100000e+01
60 ; MODEL-NEXT: Stmt_bodyB
61 ; MODEL-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
62 ; MODEL-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_A[0] };
63 ; MODEL-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
64 ; MODEL-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_arg[] };
65 ; MODEL-NEXT: Instructions {
66 ; MODEL-NEXT: %val = fadd double %arg, 2.100000e+01
67 ; MODEL-NEXT: store double %val, ptr %A, align 8
71 ; NOMODEL: After statements {
72 ; NOMODEL-NEXT: Stmt_bodyA
73 ; NOMODEL-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
74 ; NOMODEL-NEXT: [n] -> { Stmt_bodyA[i0] -> MemRef_val[] };
75 ; NOMODEL-NEXT: Instructions {
76 ; NOMODEL-NEXT: %val = fadd double %arg, 2.100000e+01
78 ; NOMODEL-NEXT: Stmt_bodyB
79 ; NOMODEL-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
80 ; NOMODEL-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_A[0] };
81 ; NOMODEL-NEXT: Instructions {
82 ; NOMODEL-NEXT: %val = fadd double %arg, 2.100000e+01
83 ; NOMODEL-NEXT: store double %val, ptr %A, align 8