1; RUN: opt %loadPolly -analyze -polly-scops %s | FileCheck %s
2
3; Check that PHI nodes only create PHI access and nothing else (e.g. unnecessary
4; SCALAR accesses). In this case, for a PHI in the exit node, hence there is no
5; PHI ReadAccess.
6
7; CHECK-LABEL: Function: foo
8;
9; CHECK:       Statements {
10; CHECK-NEXT:      Stmt_header
11; CHECK-NEXT:          Domain :=
12; CHECK-NEXT:              { Stmt_header[] };
13; CHECK-NEXT:          Schedule :=
14; CHECK-NEXT:              { Stmt_header[] -> [0, 0] };
15; CHECK-NEXT:          MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 1]
16; CHECK-NEXT:              { Stmt_header[] -> MemRef_phi[] };
17; CHECK-NEXT:      Stmt_body
18; CHECK-NEXT:          Domain :=
19; CHECK-NEXT:              { Stmt_body[i0] : 0 <= i0 <= 100 };
20; CHECK-NEXT:          Schedule :=
21; CHECK-NEXT:              { Stmt_body[i0] -> [1, i0] };
22; CHECK-NEXT:          MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 1]
23; CHECK-NEXT:              { Stmt_body[i0] -> MemRef_phi[] };
24; CHECK-NEXT:  }
25
26target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
27
28define float @foo(float %sum, float* %A) {
29entry:
30  br label %header
31
32header:
33  br i1 true, label %body, label %exit
34
35body:
36  %i = phi i64 [ 0, %header ], [ %next, %body ]
37  %scalar = fadd float 0.0, 0.0
38  %next = add nuw nsw i64 %i, 1
39  %cond = icmp ne i64 %i, 100
40  br i1 %cond, label %body, label %exit
41
42exit:
43  %phi = phi float [%scalar, %body], [0.0, %header]
44  ret float %phi
45}
46