1 ; RUN: opt %loadPolly -basic-aa -polly-print-scops -disable-output \
2 ; RUN: -polly-invariant-load-hoisting=true < %s | FileCheck %s
4 ; void f(long A[], int N, int *init_ptr) {
7 ; for (i = 0; i < N; ++i) {
8 ; 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
18 ; CHECK: Invariant Accesses:
19 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
20 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_init_ptr[0] };
21 define void @f(ptr noalias %A, i64 %N, ptr noalias %init_ptr) #0 {
25 for.i: ; preds = %for.i.end, %entry
26 %indvar.i = phi i64 [ 0, %entry ], [ %indvar.i.next, %for.i.end ]
27 %indvar.i.next = add nsw i64 %indvar.i, 1
30 entry.next: ; preds = %for.i
33 for.j: ; preds = %for.j, %entry.next
34 %indvar.j = phi i64 [ 0, %entry.next ], [ %indvar.j.next, %for.j ]
35 %init = load i64, ptr %init_ptr
36 %init_plus_two = add i64 %init, 2
37 %scevgep = getelementptr i64, ptr %A, i64 %indvar.j
38 store i64 %init_plus_two, ptr %scevgep
40 ; CHECK-NEXT: Stmt_for_j
41 ; CHECK-NOT: ReadAccess
42 ; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
43 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_A[i1] };
45 %indvar.j.next = add nsw i64 %indvar.j, 1
46 %exitcond.j = icmp eq i64 %indvar.j.next, %N
47 br i1 %exitcond.j, label %for.i.end, label %for.j
49 for.i.end: ; preds = %for.j
50 %exitcond.i = icmp eq i64 %indvar.i.next, %N
51 br i1 %exitcond.i, label %return, label %for.i
53 return: ; preds = %for.i.end
57 attributes #0 = { nounwind }