1; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s
2;
3; This caused the code generation to generate invalid code as the same BBMap was
4; used for the whole non-affine region. When %add is synthesized for the
5; incoming value of subregion_if first, the code for it was generated into
6; subregion_if, but reused for the incoming value of subregion_exit, although it
7; is not dominated by subregion_if.
8;
9; CHECK-LABEL: polly.stmt.subregion_entry:
10; CHECK:         %[[R0:[0-9]*]] = add i32 %n, -2
11;
12; CHECK-LABEL: polly.stmt.subregion_if:
13; CHECK:         %[[R1:[0-9]*]] = add i32 %n, -2
14;
15; CHECK-LABEL: polly.stmt.subregion_exit.region_exiting:
16; CHECK:         %polly.retval = phi i32 [ %[[R1]], %polly.stmt.subregion_if ], [ %[[R0]], %polly.stmt.subregion_entry ]
17
18define i32 @func(i32 %n){
19entry:
20  br label %subregion_entry
21
22subregion_entry:
23  %add = add nsw i32 %n, -2
24  %cmp = fcmp ogt float undef, undef
25  br i1 %cmp, label %subregion_if, label %subregion_exit
26
27subregion_if:
28  br label %subregion_exit
29
30subregion_exit:
31  %retval = phi i32 [ %add, %subregion_if ], [ %add, %subregion_entry ]
32  ret i32 %retval
33}
34