[ScopBuilder/Simplify] Refactor isEscaping. NFC.
[polly-mirror.git] / test / ScopInfo / read-only-scalar-used-in-phi-2.ll
blob4fcaa0646d59ceb16f7d5c94e7adafae4af6922c
1 ; RUN: opt %loadPolly -polly-scops -analyze \
2 ; RUN: < %s | FileCheck %s
4 ;    float foo(float sum, float A[]) {
6 ;      for (long i = 0; i < 100; i++)
7 ;        sum += A[i];
9 ;      return sum;
10 ;    }
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.
16 ; CHECK: Stmt_bb1[i0] -> MemRef_phisum__ph
17 ; CHECK-NOT: Stmt_bb1[i0] -> MemRef_sum[]
19 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
21 define float @foo(float %sum, float* %A) {
22 bb:
23   br label %bb1
25 bb1:
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
35 bb7:
36   ret float %phisum