1; RUN: opt %loadPolly -polly-stmt-granularity=scalar-indep -polly-print-instructions -polly-scops -analyze < %s | FileCheck %s -match-full-lines
2;
3; Split a block into two independent statements that share no scalar.
4; This case has the instructions of the two statements interleaved, such that
5; splitting the BasicBlock in the middle would cause a scalar dependency.
6;
7; for (int j = 0; j < n; j += 1) {
8; body:
9;   double valA = A[0];
10;   double valB = 21.0 + 21.0;
11;   A[0] = valA;
12;   B[0] = valB;
13; }
14;
15define void @func(i32 %n, double* noalias nonnull %A, double* noalias nonnull %B) {
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 %body, label %exit
23
24    body:
25      %valA = load double, double* %A
26      %valB = fadd double 21.0, 21.0
27      store double %valA, double* %A
28      store double %valB, double* %B
29      br label %inc
30
31inc:
32  %j.inc = add nuw nsw i32 %j, 1
33  br label %for
34
35exit:
36  br label %return
37
38return:
39  ret void
40}
41
42
43; CHECK:      Statements {
44; CHECK-NEXT:     Stmt_body
45; CHECK-NEXT:         Domain :=
46; CHECK-NEXT:             [n] -> { Stmt_body[i0] : 0 <= i0 < n };
47; CHECK-NEXT:         Schedule :=
48; CHECK-NEXT:             [n] -> { Stmt_body[i0] -> [i0, 0] };
49; CHECK-NEXT:         ReadAccess :=       [Reduction Type: NONE] [Scalar: 0]
50; CHECK-NEXT:             [n] -> { Stmt_body[i0] -> MemRef_A[0] };
51; CHECK-NEXT:         MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
52; CHECK-NEXT:             [n] -> { Stmt_body[i0] -> MemRef_A[0] };
53; CHECK-NEXT:         Instructions {
54; CHECK-NEXT:               %valA = load double, double* %A, align 8
55; CHECK-NEXT:               store double %valA, double* %A, align 8
56; CHECK-NEXT:         }
57; CHECK-NEXT:     Stmt_body_b
58; CHECK-NEXT:         Domain :=
59; CHECK-NEXT:             [n] -> { Stmt_body_b[i0] : 0 <= i0 < n };
60; CHECK-NEXT:         Schedule :=
61; CHECK-NEXT:             [n] -> { Stmt_body_b[i0] -> [i0, 1] };
62; CHECK-NEXT:         MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
63; CHECK-NEXT:             [n] -> { Stmt_body_b[i0] -> MemRef_B[0] };
64; CHECK-NEXT:         Instructions {
65; CHECK-NEXT:               %valB = fadd double 2.100000e+01, 2.100000e+01
66; CHECK-NEXT:               store double %valB, double* %B, align 8
67; CHECK-NEXT:         }
68; CHECK-NEXT: }
69