1 ; RUN: opt %loadPolly -polly-print-scops -disable-output < %s \
2 ; RUN: -polly-invariant-load-hoisting \
5 ; Make sure we choose a canonical element that is not the first invariant load,
6 ; but the first that is an array base pointer.
9 ; CHECK-NEXT: Stmt_body0
10 ; CHECK-NEXT: Domain :=
11 ; CHECK-NEXT: { Stmt_body0[i0] : 0 <= i0 <= 1022 };
12 ; CHECK-NEXT: Schedule :=
13 ; CHECK-NEXT: { Stmt_body0[i0] -> [i0, 0] };
14 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
15 ; CHECK-NEXT: { Stmt_body0[i0] -> MemRef_X[0] };
16 ; CHECK-NEXT: Stmt_body1
17 ; CHECK-NEXT: Domain :=
18 ; CHECK-NEXT: { Stmt_body1[i0] : 0 <= i0 <= 1022 };
19 ; CHECK-NEXT: Schedule :=
20 ; CHECK-NEXT: { Stmt_body1[i0] -> [i0, 1] };
21 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
22 ; CHECK-NEXT: { Stmt_body1[i0] -> MemRef_baseB[0] };
23 ; CHECK-NEXT: Stmt_body2
24 ; CHECK-NEXT: Domain :=
25 ; CHECK-NEXT: { Stmt_body2[i0] : 0 <= i0 <= 1022 };
26 ; CHECK-NEXT: Schedule :=
27 ; CHECK-NEXT: { Stmt_body2[i0] -> [i0, 2] };
28 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
29 ; CHECK-NEXT: { Stmt_body2[i0] -> MemRef_X[0] };
30 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
31 ; CHECK-NEXT: { Stmt_body2[i0] -> MemRef_ptr[] };
32 ; CHECK-NEXT: Stmt_body3
33 ; CHECK-NEXT: Domain :=
34 ; CHECK-NEXT: { Stmt_body3[i0] : 0 <= i0 <= 1022 };
35 ; CHECK-NEXT: Schedule :=
36 ; CHECK-NEXT: { Stmt_body3[i0] -> [i0, 3] };
37 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
38 ; CHECK-NEXT: { Stmt_body3[i0] -> MemRef_baseB[0] };
39 ; CHECK-NEXT: Stmt_body4
40 ; CHECK-NEXT: Domain :=
41 ; CHECK-NEXT: { Stmt_body4[i0] : 0 <= i0 <= 1022 };
42 ; CHECK-NEXT: Schedule :=
43 ; CHECK-NEXT: { Stmt_body4[i0] -> [i0, 4] };
44 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
45 ; CHECK-NEXT: { Stmt_body4[i0] -> MemRef_X[0] };
46 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
47 ; CHECK-NEXT: { Stmt_body4[i0] -> MemRef_ptr[] };
50 define void @foo(ptr %A, ptr %X) {
55 %indvar = phi i64 [0, %start], [%indvar.next, %latch]
56 %indvar.next = add nsw i64 %indvar, 1
57 %icmp = icmp slt i64 %indvar.next, 1024
58 br i1 %icmp, label %body0, label %exit
61 %ptr = load ptr, ptr %A
62 store ptr %ptr, ptr %X
66 %baseA = load ptr, ptr %A
67 store float 42.0, ptr %baseA
71 %ptr2 = load ptr, ptr %A
72 store ptr %ptr, ptr %X
76 %baseB = load ptr, ptr %A
77 store float 42.0, ptr %baseB
81 %ptr3 = load ptr, ptr %A
82 store ptr %ptr, ptr %X