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 should be split into two statements because {X[0], Y[0]}
4; and {A[0], B[0]} do not intersect.
5;
6;
7; for (int j = 0; j < n; j += 1) {
8; body:
9;   double valX = X[0];
10;   Y[0] = valX;
11;   double valA = A[0];
12;   double valB = B[0];
13;   A[0] = valA;
14;   A[0] = valB;
15; }
16;
17define void @func(i32 %n, double* noalias nonnull %A, double* noalias nonnull %B, double* noalias nonnull %X, double* noalias nonnull %Y) {
18entry:
19  br label %for
20
21for:
22  %j = phi i32 [0, %entry], [%j.inc, %inc]
23  %j.cmp = icmp slt i32 %j, %n
24  br i1 %j.cmp, label %body, label %exit
25
26    body:
27      %valX = load double, double* %X
28      store double %valX, double* %Y
29      %valA = load double, double* %A
30      %valB = load double, double* %B
31      store double %valA, double* %A
32      store double %valB, double* %A
33      br label %inc
34
35inc:
36  %j.inc = add nuw nsw i32 %j, 1
37  br label %for
38
39exit:
40  br label %return
41
42return:
43  ret void
44}
45
46
47; CHECK: Statements {
48; CHECK-NEXT: 	Stmt_body
49; CHECK-NEXT:         Domain :=
50; CHECK-NEXT:             [n] -> { Stmt_body[i0] : 0 <= i0 < n };
51; CHECK-NEXT:         Schedule :=
52; CHECK-NEXT:             [n] -> { Stmt_body[i0] -> [i0, 0] };
53; CHECK-NEXT:         ReadAccess :=	[Reduction Type: NONE] [Scalar: 0]
54; CHECK-NEXT:             [n] -> { Stmt_body[i0] -> MemRef_X[0] };
55; CHECK-NEXT:         MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]
56; CHECK-NEXT:             [n] -> { Stmt_body[i0] -> MemRef_Y[0] };
57; CHECK-NEXT:         Instructions {
58; CHECK-NEXT:               %valX = load double, double* %X, align 8
59; CHECK-NEXT:               store double %valX, double* %Y, align 8
60; CHECK-NEXT:         }
61; CHECK-NEXT: 	Stmt_body_b
62; CHECK-NEXT:         Domain :=
63; CHECK-NEXT:             [n] -> { Stmt_body_b[i0] : 0 <= i0 < n };
64; CHECK-NEXT:         Schedule :=
65; CHECK-NEXT:             [n] -> { Stmt_body_b[i0] -> [i0, 1] };
66; CHECK-NEXT:         ReadAccess :=	[Reduction Type: NONE] [Scalar: 0]
67; CHECK-NEXT:             [n] -> { Stmt_body_b[i0] -> MemRef_A[0] };
68; CHECK-NEXT:         ReadAccess :=	[Reduction Type: NONE] [Scalar: 0]
69; CHECK-NEXT:             [n] -> { Stmt_body_b[i0] -> MemRef_B[0] };
70; CHECK-NEXT:         MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]
71; CHECK-NEXT:             [n] -> { Stmt_body_b[i0] -> MemRef_A[0] };
72; CHECK-NEXT:         MustWriteAccess :=	[Reduction Type: NONE] [Scalar: 0]
73; CHECK-NEXT:             [n] -> { Stmt_body_b[i0] -> MemRef_A[0] };
74; CHECK-NEXT:         Instructions {
75; CHECK-NEXT:               %valA = load double, double* %A, align 8
76; CHECK-NEXT:               %valB = load double, double* %B, align 8
77; CHECK-NEXT:               store double %valA, double* %A, align 8
78; CHECK-NEXT:               store double %valB, double* %A, align 8
79; CHECK-NEXT:         }
80; CHECK-NEXT: }
81