1 ; RUN: opt %loadPolly -basic-aa -polly-stmt-granularity=bb -polly-print-scops -polly-allow-modref-calls \
2 ; RUN: -disable-output < %s | FileCheck %s
3 ; RUN: opt %loadPolly -basic-aa -polly-codegen -disable-output \
4 ; RUN: -polly-allow-modref-calls < %s
6 ; Verify that we model the read access of the gcread intrinsic
7 ; correctly, thus that A is read by it but B is not.
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_A[o0] };
16 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE]
17 ; CHECK-NEXT: { Stmt_for_body[i0] -> MemRef_dummyloc[0] };
18 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE]
19 ; CHECK-NEXT: { Stmt_for_body[i0] -> MemRef_B[i0] };
20 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE]
21 ; CHECK-NEXT: { Stmt_for_body[i0] -> MemRef_A[i0] };
23 ; void jd(int *restirct A, int *restrict B) {
25 ; for (int i = 0; i < 1024; i++) {
26 ; char *dummy = @llvm.gcread(A, nullptr);
32 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
34 define void @jd(ptr noalias %A, ptr noalias %B) gc "dummy" {
36 %dummyloc = alloca ptr
39 entry.split: ; preds = %entry
42 for.body: ; preds = %entry.split, %for.inc
43 %i = phi i64 [ 0, %entry.split ], [ %i.next, %for.inc ]
44 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %i
45 %arrayidx1 = getelementptr inbounds i32, ptr %B, i64 %i
46 %dummy = call ptr @f(ptr %arrayidx, ptr null)
47 store ptr %dummy, ptr %dummyloc, align 4
48 %tmp = load i32, ptr %arrayidx1
49 store i32 %tmp, ptr %arrayidx, align 4
52 for.inc: ; preds = %for.body
53 %i.next = add nuw nsw i64 %i, 1
54 %exitcond = icmp ne i64 %i.next, 1024
55 br i1 %exitcond, label %for.body, label %for.end
57 for.end: ; preds = %for.inc
61 declare ptr @f(ptr, ptr) #0
63 attributes #0 = { argmemonly readonly nounwind }