1; RUN: opt %loadPolly -basic-aa -polly-scops -analyze -polly-allow-modref-calls \
2; RUN:  < %s | FileCheck %s
3; RUN: opt %loadPolly -basic-aa -polly-codegen -disable-output \
4; RUN: -polly-allow-modref-calls < %s
5;
6; Check that we assume the call to func has a read on the whole A array.
7;
8; CHECK:      Stmt_for_body
9; CHECK-NEXT:   Domain :=
10; CHECK-NEXT:       { Stmt_for_body[i0] : 0 <= i0 <= 1023 };
11; CHECK-NEXT:   Schedule :=
12; CHECK-NEXT:       { Stmt_for_body[i0] -> [i0] };
13; CHECK-NEXT:   MustWriteAccess :=  [Reduction Type: NONE]
14; CHECK-NEXT:       { Stmt_for_body[i0] -> MemRef_A[2 + i0] };
15; CHECK-NEXT:   ReadAccess :=  [Reduction Type: NONE]
16; CHECK-NEXT:       { Stmt_for_body[i0] -> MemRef_A[o0] };
17;
18;    #pragma readonly
19;    int func(int *A);
20;
21;    void jd(int *A) {
22;      for (int i = 0; i < 1024; i++)
23;        A[i + 2] = func(A);
24;    }
25;
26target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
27
28define void @jd(i32* %A) {
29entry:
30  br label %for.body
31
32for.body:                                         ; preds = %entry, %for.inc
33  %i = phi i64 [ 0, %entry ], [ %i.next, %for.inc ]
34  %call = call i32 @func(i32* %A) #2
35  %tmp = add nsw i64 %i, 2
36  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %tmp
37  store i32 %call, i32* %arrayidx, align 4
38  br label %for.inc
39
40for.inc:                                          ; preds = %for.body
41  %i.next = add nuw nsw i64 %i, 1
42  %exitcond = icmp ne i64 %i.next, 1024
43  br i1 %exitcond, label %for.body, label %for.end
44
45for.end:                                          ; preds = %for.inc
46  ret void
47}
48
49declare i32 @func(i32*) #0
50
51attributes #0 = { nounwind readonly }
52