1 ; RUN: opt %loadNPMPolly '-passes=print<polly-function-scops>' -polly-invariant-load-hoisting=true -disable-output < %s 2>&1 | FileCheck %s
3 ; This test case verifies that the statement domain of the invariant access
4 ; is the universe. In earlier versions of Polly, we accidentally computed an
5 ; empty access domain which resulted in invariant accesses not being executed
6 ; and consequently undef values being used.
8 ; CHECK: Invariant Accesses: {
9 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
10 ; CHECK-NEXT: { Stmt_loop_next[i0] -> MemRef_a[1] };
11 ; CHECK-NEXT: Execution Context: { : }
13 ; CHECK-NEXT: Context:
15 ; CHECK-NEXT: Assumed Context:
17 ; CHECK-NEXT: Invalid Context:
18 ; CHECK-NEXT: { : false }
21 ; CHECK-NEXT: Stmt_loop
22 ; CHECK-NEXT: Domain :=
23 ; CHECK-NEXT: { Stmt_loop[i0] : 0 <= i0 <= 1 };
24 ; CHECK-NEXT: Schedule :=
25 ; CHECK-NEXT: { Stmt_loop[i0] -> [i0, 0] };
26 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
27 ; CHECK-NEXT: { Stmt_loop[i0] -> MemRef_val__phi[] };
28 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
29 ; CHECK-NEXT: { Stmt_loop[i0] -> MemRef_B[i0] };
30 ; CHECK-NEXT: Stmt_loop_next
31 ; CHECK-NEXT: Domain :=
32 ; CHECK-NEXT: { Stmt_loop_next[0] };
33 ; CHECK-NEXT: Schedule :=
34 ; CHECK-NEXT: { Stmt_loop_next[i0] -> [0, 1] };
35 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
36 ; CHECK-NEXT: { Stmt_loop_next[i0] -> MemRef_val__phi[] };
39 define void @foo(ptr %a, ptr noalias %B) {
44 %indvar = phi i64 [0, %entry], [%indvar.next, %loop.next]
45 %val = phi float [1.0, %entry], [%a.val, %loop.next]
46 %indvar.next = add nuw nsw i64 %indvar, 1
47 %ptr = getelementptr float, ptr %B, i64 %indvar
48 store float %val, ptr %ptr
49 %icmp = icmp eq i64 %indvar.next, 2
50 br i1 %icmp, label %ret, label %loop.next
53 %Aptr = getelementptr float, ptr %a, i64 %indvar.next
54 %a.val = load float, ptr %Aptr