1; RUN: opt %loadPolly -polly-scops -polly-invariant-load-hoisting=true -analyze < %s | FileCheck %s
2
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.
7
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: {  :  }
12; CHECK-NEXT:  }
13; CHECK-NEXT:  Context:
14; CHECK-NEXT:  {  :  }
15; CHECK-NEXT:  Assumed Context:
16; CHECK-NEXT:  {  :  }
17; CHECK-NEXT:  Invalid Context:
18; CHECK-NEXT:  {  : false }
19
20; CHECK:  Statements {
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[] };
37; CHECK-NEXT:  }
38
39define void @foo(float* %a, float* noalias %B) {
40entry:
41  br label %loop
42
43loop:
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, float* %B, i64 %indvar
48  store float %val, float* %ptr
49  %icmp = icmp eq i64 %indvar.next, 2
50  br i1 %icmp, label %ret, label %loop.next
51
52loop.next:
53  %Aptr = getelementptr float, float* %a, i64 %indvar.next
54  %a.val = load float, float* %Aptr
55  br label %loop
56
57ret:
58  ret void
59}
60