1; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-scops -analyze < %s | FileCheck %s
2
3; In this test case we pass a pointer %A into a PHI node and also use this
4; pointer as base pointer of an array store. As a result, we get both scalar
5; and array memory accesses to A[] and A[0].
6
7; CHECK:      Arrays {
8; CHECK-NEXT:     float MemRef_A[*]; // Element size 4
9; CHECK-NEXT:     float* MemRef_x__phi; // Element size 8
10; CHECK-NEXT:     float* MemRef_C[*]; // Element size 8
11; CHECK-NEXT: }
12; CHECK:      Arrays (Bounds as pw_affs) {
13; CHECK-NEXT:     float MemRef_A[*]; // Element size 4
14; CHECK-NEXT:     float* MemRef_x__phi; // Element size 8
15; CHECK-NEXT:     float* MemRef_C[*]; // Element size 8
16; CHECK-NEXT: }
17; CHECK:      Alias Groups (0):
18; CHECK-NEXT:     n/a
19; CHECK:      Statements {
20; CHECK-NEXT:     Stmt_then
21; CHECK-NEXT:         Domain :=
22; CHECK-NEXT:             [p] -> { Stmt_then[i0] : p = 32 and 0 <= i0 <= 999 };
23; CHECK-NEXT:         Schedule :=
24; CHECK-NEXT:             [p] -> { Stmt_then[i0] -> [i0, 1] };
25; CHECK-NEXT:         MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 0]
26; CHECK-NEXT:             [p] -> { Stmt_then[i0] -> MemRef_A[0] };
27; CHECK-NEXT:         MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 1]
28; CHECK-NEXT:             [p] -> { Stmt_then[i0] -> MemRef_x__phi[] };
29; CHECK-NEXT:     Stmt_else
30; CHECK-NEXT:         Domain :=
31; CHECK-NEXT:             [p] -> { Stmt_else[i0] : 0 <= i0 <= 999 and (p >= 33 or p <= 31) };
32; CHECK-NEXT:         Schedule :=
33; CHECK-NEXT:             [p] -> { Stmt_else[i0] -> [i0, 0] : p >= 33 or p <= 31 };
34; CHECK-NEXT:         MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 0]
35; CHECK-NEXT:             [p] -> { Stmt_else[i0] -> MemRef_A[0] };
36; CHECK-NEXT:         MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 1]
37; CHECK-NEXT:             [p] -> { Stmt_else[i0] -> MemRef_x__phi[] };
38; CHECK-NEXT:     Stmt_bb8
39; CHECK-NEXT:         Domain :=
40; CHECK-NEXT:             [p] -> { Stmt_bb8[i0] : 0 <= i0 <= 999 };
41; CHECK-NEXT:         Schedule :=
42; CHECK-NEXT:             [p] -> { Stmt_bb8[i0] -> [i0, 2] };
43; CHECK-NEXT:         ReadAccess :=    [Reduction Type: NONE] [Scalar: 1]
44; CHECK-NEXT:             [p] -> { Stmt_bb8[i0] -> MemRef_x__phi[] };
45; CHECK-NEXT:         MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 0]
46; CHECK-NEXT:             [p] -> { Stmt_bb8[i0] -> MemRef_C[0] };
47; CHECK-NEXT: }
48
49target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
50
51define void @foo(float* noalias %A, float* noalias %B, float ** noalias %C, i32 %p) {
52bb:
53  br label %bb1
54
55bb1:
56  %i.0 = phi i64 [ 0, %bb ], [ %tmp9, %bb8 ]
57  %exitcond = icmp ne i64 %i.0, 1000
58  br i1 %exitcond, label %bb2, label %bb10
59
60bb2:
61  %cmp = icmp eq i32 %p, 32
62  br i1 %cmp, label %then, label %else
63
64then:
65  store float 3.0, float* %A
66  br label %bb8
67
68else:
69  store float 4.0, float* %A
70  br label %bb8
71
72bb8:
73  %x = phi float* [%A, %then], [%B, %else]
74  store float* %x, float** %C
75  %tmp9 = add nuw nsw i64 %i.0, 1
76  br label %bb1
77
78bb10:
79  ret void
80}
81