1 ; RUN: opt %loadPolly -polly-analyze-read-only-scalars=true -polly-optree -analyze < %s | FileCheck %s -match-full-lines -check-prefixes=STATS,MODEL
2 ; RUN: opt %loadPolly -polly-analyze-read-only-scalars=false -polly-optree -analyze < %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, double* 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, double* %A
32 %j.inc = add nuw nsw i32 %j, 1
44 ; STATS: Instructions copied: 1
45 ; STATS: Read-only accesses copied: 1
46 ; STATS: Operand trees forwarded: 1
47 ; STATS: Statements with forwarded operand trees: 1
50 ; MODEL: After statements {
51 ; MODEL-NEXT: Stmt_bodyA
52 ; MODEL-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
53 ; MODEL-NEXT: [n] -> { Stmt_bodyA[i0] -> MemRef_arg[] };
54 ; MODEL-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
55 ; MODEL-NEXT: [n] -> { Stmt_bodyA[i0] -> MemRef_val[] };
56 ; MODEL-NEXT: Instructions {
57 ; MODEL-NEXT: %val = fadd double %arg, 2.100000e+01
59 ; MODEL-NEXT: Stmt_bodyB
60 ; MODEL-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
61 ; MODEL-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_A[0] };
62 ; MODEL-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
63 ; MODEL-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_arg[] };
64 ; MODEL-NEXT: Instructions {
65 ; MODEL-NEXT: %val = fadd double %arg, 2.100000e+01
66 ; MODEL-NEXT: store double %val, double* %A
70 ; NOMODEL: After statements {
71 ; NOMODEL-NEXT: Stmt_bodyA
72 ; NOMODEL-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
73 ; NOMODEL-NEXT: [n] -> { Stmt_bodyA[i0] -> MemRef_val[] };
74 ; NOMODEL-NEXT: Instructions {
75 ; NOMODEL-NEXT: %val = fadd double %arg, 2.100000e+01
77 ; NOMODEL-NEXT: Stmt_bodyB
78 ; NOMODEL-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
79 ; NOMODEL-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_A[0] };
80 ; NOMODEL-NEXT: Instructions {
81 ; NOMODEL-NEXT: %val = fadd double %arg, 2.100000e+01
82 ; NOMODEL-NEXT: store double %val, double* %A