1; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s
2;
3; llvm.org/PR25439
4; Scalar reloads in the generated entering block were not recognized as
5; dominating the subregion blocks when there were multiple entering nodes. This
6; resulted in values defined in there (here: %cond used in subregionB_entry) not
7; being copied. We check whether it is reusing the reloaded scalar.
8;
9; CHECK-LABEL: polly.stmt.subregionB_entry.exit:
10; CHECK:         store i1 %polly.cond, i1* %cond.s2a
11;
12; CHECK-LABEL: polly.stmt.subregionB_entry.entry:
13; CHECK:         %cond.s2a.reload = load i1, i1* %cond.s2a
14;
15; CHECK-LABEL: polly.stmt.subregionB_entry:
16; CHECK:         br i1 %cond.s2a.reload
17
18define void @func(i32* %A) {
19entry:
20  br label %subregionA_entry
21
22subregionA_entry:
23  %cond = phi i1 [ false, %entry ], [ true, %subregionB_exit ]
24  br i1 %cond, label %subregionA_if, label %subregionA_else
25
26subregionA_if:
27  br label %subregionB_entry
28
29subregionA_else:
30  br label %subregionB_entry
31
32subregionB_entry:
33  store i32 0, i32* %A
34  br i1 %cond, label %subregionB_if, label %subregionB_exit
35
36subregionB_if:
37  br label %subregionB_exit
38
39subregionB_exit:
40  br i1 false, label %subregionA_entry, label %return
41
42return:
43  ret void
44}
45