40 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly<no-default-opts>' -S < %s | FileCheck %s2;3; Check for the correct written value of a scalar phi write whose value is4; defined within the loop, but its effective value is its last definition when5; leaving the loop (in this test it is the value 2 for %i.inc). This can be6; either computed:7; - Using SCEVExpander:8; In this case the Loop passed to the expander must NOT be the loop9; - Overwriting the same alloca in each iteration s.t. the last value will10; retain in %i.inc.s2a11; The first is currently generated by Polly and tested here.12 13; CHECK: polly.stmt.next:14; CHECK-NEXT: store i32 2, ptr %phi.phiops15; CHECK-NEXT: br label %polly.stmt.join16 17define i32 @func() {18entry:19 br label %start20 21start:22 br i1 true, label %loop, label %join23 24loop:25 %i = phi i32 [ 0, %start ], [ %i.inc, %loop ]26 %i.inc = add nsw i32 %i, 127 %cond = icmp slt i32 %i.inc, 228 br i1 %cond, label %loop, label %next29 30next:31 br label %join32 33join:34 %phi = phi i32 [%i.inc, %next], [0, %start]35 br label %return36 37return:38 ret i32 %phi39}40