1; RUN: opt %loadPolly -polly-stmt-granularity=scalar-indep -polly-print-instructions -polly-scops -analyze < %s | FileCheck %s -match-full-lines
2;
3; This case has no explicit epilogue for PHI writes because it would
4; have a scalar dependency to the previous statement.
5;
6; for (int j = 0; j < n; j += 1) {
7; bodyA:
8;   double valA = A[0];
9;   A[0] = valA;
10;
11; bodyB:
12;   phi = valA;
13; }
14;
15define void @func(i32 %n, double* noalias nonnull %A) {
16entry:
17  br label %for
18
19for:
20  %j = phi i32 [0, %entry], [%j.inc, %inc]
21  %j.cmp = icmp slt i32 %j, %n
22  br i1 %j.cmp, label %bodyA, label %exit
23
24    bodyA:
25      %valA = load double, double* %A
26      store double %valA, double* %A
27      br label %bodyB
28
29    bodyB:
30      %phi = phi double [%valA, %bodyA]
31      br label %inc
32
33inc:
34  %j.inc = add nuw nsw i32 %j, 1
35  br label %for
36
37exit:
38  br label %return
39
40return:
41  ret void
42}
43
44
45; CHECK:      Statements {
46; CHECK-NEXT:     Stmt_bodyA
47; CHECK-NEXT:         Domain :=
48; CHECK-NEXT:             [n] -> { Stmt_bodyA[i0] : 0 <= i0 < n };
49; CHECK-NEXT:         Schedule :=
50; CHECK-NEXT:             [n] -> { Stmt_bodyA[i0] -> [i0] };
51; CHECK-NEXT:         ReadAccess :=       [Reduction Type: NONE] [Scalar: 0]
52; CHECK-NEXT:             [n] -> { Stmt_bodyA[i0] -> MemRef_A[0] };
53; CHECK-NEXT:         MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
54; CHECK-NEXT:             [n] -> { Stmt_bodyA[i0] -> MemRef_A[0] };
55; CHECK-NEXT:         MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]
56; CHECK-NEXT:             [n] -> { Stmt_bodyA[i0] -> MemRef_phi__phi[] };
57; CHECK-NEXT:         Instructions {
58; CHECK-NEXT:               %valA = load double, double* %A, align 8
59; CHECK-NEXT:               store double %valA, double* %A, align 8
60; CHECK-NEXT:         }
61; CHECK-NEXT: }
62