1 ; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s
3 ; Check for the correct written value of a scalar phi write whose value is
4 ; defined within the loop, but its effective value is its last definition when
5 ; leaving the loop (in this test it is the value 2 for %i.inc). This can be
7 ; - Using SCEVExpander:
8 ; In this case the Loop passed to the expander must NOT be the loop
9 ; - Overwriting the same alloca in each iteration s.t. the last value will
10 ; retain in %i.inc.s2a
11 ; The first is currently generated by Polly and tested here.
13 ; CHECK: polly.stmt.next:
14 ; CHECK-NEXT: store i32 2, ptr %phi.phiops
15 ; CHECK-NEXT: br label %polly.stmt.join
22 br i1 true, label %loop, label %join
25 %i = phi i32 [ 0, %start ], [ %i.inc, %loop ]
26 %i.inc = add nsw i32 %i, 1
27 %cond = icmp slt i32 %i.inc, 2
28 br i1 %cond, label %loop, label %next
34 %phi = phi i32 [%i.inc, %next], [0, %start]