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) {
9 ; for (i = 0; i < N; ++i) {
11 ; A[i] = init + init2;
16 ; CHECK: Invariant Accesses: {
17 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
18 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_init_ptr[0] };
19 ; CHECK-NEXT: Execution Context: [N] -> { : N > 0 }
23 ; CHECK-NEXT: Stmt_for_j
24 ; CHECK-NEXT: Domain :=
25 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] : 0 <= i0 < N and 0 <= i1 < N };
26 ; CHECK-NEXT: Schedule :=
27 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> [i0, i1] };
28 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
29 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_init[] };
30 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
31 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_A[i1] };
34 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"
36 define void @f(ptr noalias %A, i64 %N, ptr noalias %init_ptr) #0 {
40 for.i: ; preds = %for.i.end, %entry
41 %indvar.i = phi i64 [ 0, %entry ], [ %indvar.i.next, %for.i.end ]
42 %indvar.i.next = add nsw i64 %indvar.i, 1
45 entry.next: ; preds = %for.i
46 %init = load i64, ptr %init_ptr
49 for.j: ; preds = %for.j, %entry.next
50 %indvar.j = phi i64 [ 0, %entry.next ], [ %indvar.j.next, %for.j ]
51 %init_2 = load i64, ptr %init_ptr
52 %init_sum = add i64 %init, %init_2
53 %scevgep = getelementptr i64, ptr %A, i64 %indvar.j
54 store i64 %init_sum, ptr %scevgep
55 %indvar.j.next = add nsw i64 %indvar.j, 1
56 %exitcond.j = icmp eq i64 %indvar.j.next, %N
57 br i1 %exitcond.j, label %for.i.end, label %for.j
59 for.i.end: ; preds = %for.j
60 %exitcond.i = icmp eq i64 %indvar.i.next, %N
61 br i1 %exitcond.i, label %return, label %for.i
63 return: ; preds = %for.i.end
67 attributes #0 = { nounwind }