1; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
2;
3; Check we remove read only statements.
4;
5; CHECK:      Statements {
6; CHECK-NEXT:     Stmt_for_body_2
7; CHECK-NEXT:         Domain :=
8; CHECK-NEXT:             { Stmt_for_body_2[i0] : 0 <= i0 <= 99 };
9; CHECK-NEXT:         Schedule :=
10; CHECK-NEXT:             { Stmt_for_body_2[i0] -> [i0] };
11; CHECK-NEXT:         ReadAccess :=    [Reduction Type: +] [Scalar: 0]
12; CHECK-NEXT:             { Stmt_for_body_2[i0] -> MemRef_A[i0] };
13; CHECK-NEXT:         MustWriteAccess :=    [Reduction Type: +] [Scalar: 0]
14; CHECK-NEXT:             { Stmt_for_body_2[i0] -> MemRef_A[i0] };
15; CHECK-NEXT: }
16;
17;    int g(int);
18;    void f(int *A) {
19;      for (int i = 0; i < 100; i++) {
20;        (A[i]);
21;        /* Split BB */
22;        (A[i]);
23;        /* Split BB */
24;        A[i] += 1;
25;        /* Split BB */
26;        (A[i]);
27;        /* Split BB */
28;        (A[i]);
29;      }
30;    }
31;
32target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
33
34define void @f(i32* %A) {
35entry:
36  br label %for.cond
37
38for.cond:                                         ; preds = %for.inc, %entry
39  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
40  %exitcond = icmp ne i64 %indvars.iv, 100
41  br i1 %exitcond, label %for.body, label %for.end
42
43for.body:                                         ; preds = %for.cond
44  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
45  %tmp = load i32, i32* %arrayidx, align 4
46  br label %for.body.1
47
48for.body.1:
49  %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
50  %tmp1 = load i32, i32* %arrayidx2, align 4
51  br label %for.body.2
52
53for.body.2:
54  %arrayidx5 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
55  %tmp2 = load i32, i32* %arrayidx5, align 4
56  %add = add nsw i32 %tmp2, 1
57  store i32 %add, i32* %arrayidx5, align 4
58  br label %for.body.3
59
60for.body.3:
61  %arrayidx7 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
62  %tmp3 = load i32, i32* %arrayidx7, align 4
63  br label %for.body.4
64
65for.body.4:
66  %arrayidx10 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
67  %tmp4 = load i32, i32* %arrayidx10, align 4
68  br label %for.inc
69
70for.inc:                                          ; preds = %for.body
71  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
72  br label %for.cond
73
74for.end:                                          ; preds = %for.cond
75  ret void
76}
77