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