1; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s 2; 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 6; either computed: 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. 12 13; CHECK: polly.stmt.next: 14; CHECK-NEXT: store i32 2, i32* %phi.phiops 15; CHECK-NEXT: br label %polly.stmt.join 16 17define i32 @func() { 18entry: 19 br label %start 20 21start: 22 br i1 true, label %loop, label %join 23 24loop: 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 29 30next: 31 br label %join 32 33join: 34 %phi = phi i32 [%i.inc, %next], [0, %start] 35 br label %return 36 37return: 38 ret i32 %phi 39} 40