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 the call to func will "read" not only the A array but also the 7; B array. The reason is the readonly annotation of func. 8; 9; CHECK: Stmt_for_body 10; CHECK-NEXT: Domain := 11; CHECK-NEXT: { Stmt_for_body[i0] : 0 <= i0 <= 1023 }; 12; CHECK-NEXT: Schedule := 13; CHECK-NEXT: { Stmt_for_body[i0] -> [i0] }; 14; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] 15; CHECK-NEXT: { Stmt_for_body[i0] -> MemRef_B[i0] }; 16; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] 17; CHECK-NEXT: { Stmt_for_body[i0] -> MemRef_A[2 + i0] }; 18; CHECK-DAG: ReadAccess := [Reduction Type: NONE] 19; CHECK-DAG: { Stmt_for_body[i0] -> MemRef_B[o0] }; 20; CHECK-DAG: ReadAccess := [Reduction Type: NONE] 21; CHECK-DAG: { Stmt_for_body[i0] -> MemRef_A[o0] }; 22; 23; #pragma readonly 24; int func(int *A); 25; 26; void jd(int *restrict A, int *restrict B) { 27; for (int i = 0; i < 1024; i++) 28; A[i + 2] = func(A) + B[i]; 29; } 30; 31target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 32 33define void @jd(i32* noalias %A, i32* noalias %B) { 34entry: 35 br label %for.body 36 37for.body: ; preds = %entry, %for.inc 38 %i = phi i64 [ 0, %entry ], [ %i.next, %for.inc ] 39 %call = call i32 @func(i32* %A) 40 %arrayidx = getelementptr inbounds i32, i32* %B, i64 %i 41 %tmp = load i32, i32* %arrayidx, align 4 42 %add = add nsw i32 %call, %tmp 43 %tmp1 = add nsw i64 %i, 2 44 %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %tmp1 45 store i32 %add, i32* %arrayidx1, align 4 46 br label %for.inc 47 48for.inc: ; preds = %for.body 49 %i.next = add nuw nsw i64 %i, 1 50 %exitcond = icmp ne i64 %i.next, 1024 51 br i1 %exitcond, label %for.body, label %for.end 52 53for.end: ; preds = %for.inc 54 ret void 55} 56 57declare i32 @func(i32*) #0 58 59attributes #0 = { nounwind readonly } 60