58 lines · plain
1; RUN: opt %loadNPMPolly -aa-pipeline=basic-aa '-passes=polly-custom<scops>' -polly-print-scops -polly-allow-modref-calls -disable-output < %s 2>&1 | FileCheck %s2; RUN: opt %loadNPMPolly -aa-pipeline=basic-aa '-passes=polly<no-default-opts>' -disable-output -polly-allow-modref-calls < %s3;4; Check that the call to func will "read" not only the A array but also the5; B array. The reason is the readonly annotation of func.6;7; CHECK: Stmt_for_body8; CHECK-NEXT: Domain :=9; CHECK-NEXT: { Stmt_for_body[i0] : 0 <= i0 <= 1023 };10; CHECK-NEXT: Schedule :=11; CHECK-NEXT: { Stmt_for_body[i0] -> [i0] };12; CHECK-NEXT: ReadAccess := [Reduction Type: NONE]13; CHECK-NEXT: { Stmt_for_body[i0] -> MemRef_B[i0] };14; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE]15; CHECK-NEXT: { Stmt_for_body[i0] -> MemRef_A[2 + i0] };16; CHECK-DAG: ReadAccess := [Reduction Type: NONE]17; CHECK-DAG: { Stmt_for_body[i0] -> MemRef_B[o0] };18; CHECK-DAG: ReadAccess := [Reduction Type: NONE]19; CHECK-DAG: { Stmt_for_body[i0] -> MemRef_A[o0] };20;21; #pragma readonly22; int func(int *A);23;24; void jd(int *restrict A, int *restrict B) {25; for (int i = 0; i < 1024; i++)26; A[i + 2] = func(A) + B[i];27; }28;29target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"30 31define void @jd(ptr noalias %A, ptr noalias %B) {32entry:33 br label %for.body34 35for.body: ; preds = %entry, %for.inc36 %i = phi i64 [ 0, %entry ], [ %i.next, %for.inc ]37 %call = call i32 @func(ptr %A)38 %arrayidx = getelementptr inbounds i32, ptr %B, i64 %i39 %tmp = load i32, ptr %arrayidx, align 440 %add = add nsw i32 %call, %tmp41 %tmp1 = add nsw i64 %i, 242 %arrayidx1 = getelementptr inbounds i32, ptr %A, i64 %tmp143 store i32 %add, ptr %arrayidx1, align 444 br label %for.inc45 46for.inc: ; preds = %for.body47 %i.next = add nuw nsw i64 %i, 148 %exitcond = icmp ne i64 %i.next, 102449 br i1 %exitcond, label %for.body, label %for.end50 51for.end: ; preds = %for.inc52 ret void53}54 55declare i32 @func(ptr) #056 57attributes #0 = { nounwind readonly }58