1 ; RUN: opt %loadPolly -basic-aa -polly-invariant-load-hoisting=true -polly-print-scops -disable-output < %s | FileCheck %s
3 ; void f(long A[], int N, int *init_ptr) {
6 ; for (i = 0; i < N; ++i) {
8 ; for (i = 0; i < N; ++i) {
14 ; CHECK-LABEL: Function: f
17 ; CHECK-NEXT: Stmt_for_j
18 ; CHECK-NEXT: Domain :=
19 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] : 0 <= i0 < N and 0 <= i1 < N };
20 ; CHECK-NEXT: Schedule :=
21 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> [i0, i1] };
22 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
23 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_init[] };
24 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
25 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_A[i1] };
28 ; CHECK-LABEL: Function: g
31 ; CHECK-NEXT: Stmt_for_j
32 ; CHECK-NEXT: Domain :=
33 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] : 0 <= i0 < N and 0 <= i1 < N };
34 ; CHECK-NEXT: Schedule :=
35 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> [i0, i1] };
36 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
37 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_A[i1] };
38 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
39 ; CHECK-NEXT: [N] -> { Stmt_for_j[i0, i1] -> MemRef_init[] };
42 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"
45 define void @f(ptr noalias %A, i64 %N, ptr noalias %init_ptr) nounwind {
50 %indvar.i = phi i64 [ 0, %entry ], [ %indvar.i.next, %for.i.end ]
51 %indvar.i.next = add nsw i64 %indvar.i, 1
55 %init = load i64, ptr %init_ptr
59 %indvar.j = phi i64 [ 0, %entry.next ], [ %indvar.j.next, %for.j ]
60 %init_plus_two = add i64 %init, 2
61 %scevgep = getelementptr i64, ptr %A, i64 %indvar.j
62 store i64 %init_plus_two, ptr %scevgep
63 %indvar.j.next = add nsw i64 %indvar.j, 1
64 %exitcond.j = icmp eq i64 %indvar.j.next, %N
65 br i1 %exitcond.j, label %for.i.end, label %for.j
68 %exitcond.i = icmp eq i64 %indvar.i.next, %N
69 br i1 %exitcond.i, label %return, label %for.i
75 define void @g(ptr noalias %A, i64 %N, ptr noalias %init_ptr) nounwind {
80 %indvar.i = phi i64 [ 0, %entry ], [ %indvar.i.next, %for.i.end ]
81 %indvar.i.next = add nsw i64 %indvar.i, 1
85 %init = load i64, ptr %init_ptr
89 %indvar.j = phi i64 [ 0, %entry.next ], [ %indvar.j.next, %for.j ]
90 %scevgep = getelementptr i64, ptr %A, i64 %indvar.j
91 store i64 %init, ptr %scevgep
92 %indvar.j.next = add nsw i64 %indvar.j, 1
93 %exitcond.j = icmp eq i64 %indvar.j.next, %N
94 br i1 %exitcond.j, label %for.i.end, label %for.j
97 %exitcond.i = icmp eq i64 %indvar.i.next, %N
98 br i1 %exitcond.i, label %return, label %for.i