blob: 4fcaa0646d59ceb16f7d5c94e7adafae4af6922c [file] [log] [blame]
Tobias Grosserf4ee3712015-10-06 15:36:44 +00001; RUN: opt %loadPolly -polly-scops -analyze \
Tobias Grosserda95a4a2015-09-24 20:59:59 +00002; RUN: < %s | FileCheck %s
3;
4; float foo(float sum, float A[]) {
5;
6; for (long i = 0; i < 100; i++)
7; sum += A[i];
8;
9; return sum;
10; }
11
12; Verify that we do not model the read from %sum. Reads that only happen in
13; case control flow reaches the PHI node from outside the SCoP are handled
14; implicitly during code generation.
15
16; CHECK: Stmt_bb1[i0] -> MemRef_phisum__ph
17; CHECK-NOT: Stmt_bb1[i0] -> MemRef_sum[]
18
19target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
20
21define float @foo(float %sum, float* %A) {
22bb:
23 br label %bb1
24
25bb1:
26 %i = phi i64 [ 0, %bb ], [ %i.next, %bb1 ]
27 %phisum = phi float [ %sum, %bb ], [ %tmp5, %bb1 ]
28 %tmp = getelementptr inbounds float, float* %A, i64 %i
29 %tmp4 = load float, float* %tmp, align 4
30 %tmp5 = fadd float %phisum, %tmp4
31 %i.next = add nuw nsw i64 %i, 1
32 %exitcond = icmp ne i64 %i, 100
33 br i1 %exitcond, label %bb1, label %bb7
34
35bb7:
36 ret float %phisum
37}