1 ; RUN: opt %loadPolly -basic-aa -polly-print-scops \
2 ; RUN: -polly-invariant-load-hoisting=true -disable-output < %s | FileCheck %s
4 ; void f(long A[], int N, int *init_ptr) {
7 ; for (i = 0; i < N; ++i) {
9 ; for (i = 0; i < N; ++i) {
15 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
17 ; Function Attrs: nounwind
19 ; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
20 ; CHECK-NEXT: MemRef_init_ptr[0]
22 define void @f(ptr noalias %A, i64 %N, ptr noalias %init_ptr) #0 {
26 for.i: ; preds = %for.i.end, %entry
27 %indvar.i = phi i64 [ 0, %entry ], [ %indvar.i.next, %for.i.end ]
28 %indvar.i.next = add nsw i64 %indvar.i, 1
31 entry.next: ; preds = %for.i
32 %init = load i64, ptr %init_ptr
33 ; CHECK-NOT: Stmt_entry_next
36 for.j: ; preds = %for.j, %entry.next
37 %indvar.j = phi i64 [ 0, %entry.next ], [ %indvar.j.next, %for.j ]
38 %init_plus_two = add i64 %init, 2
39 ; CHECK-LABEL: Stmt_for_j
40 ; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
41 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_init[] };
42 ; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
43 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_A[i1] };
44 %scevgep = getelementptr i64, ptr %A, i64 %indvar.j
45 store i64 %init_plus_two, ptr %scevgep
46 %indvar.j.next = add nsw i64 %indvar.j, 1
47 %exitcond.j = icmp eq i64 %indvar.j.next, %N
48 br i1 %exitcond.j, label %for.i.end, label %for.j
50 for.i.end: ; preds = %for.j
51 %exitcond.i = icmp eq i64 %indvar.i.next, %N
52 br i1 %exitcond.i, label %return, label %for.i
54 return: ; preds = %for.i.end
58 attributes #0 = { nounwind }