1; RUN: opt %loadPolly -polly-process-unprofitable -polly-codegen -S < %s | FileCheck %s
2;
3; llvm.org/PR25412
4; %synthgep caused %gep to be synthesized in subregion_if which was reused for
5; %retval in subregion_exit, even though it is not dominating subregion_exit.
6;
7; CHECK-LABEL: polly.stmt.polly.merge_new_and_old.exit:
8; CHECK:         %scevgep[[R1:[0-9]*]] = getelementptr %struct.hoge, %struct.hoge* %arg, i64 0, i32 2
9; CHECK:         store double* %scevgep[[R1]], double** %gep.s2a
10; CHECK:         br label
11
12%struct.hoge = type { double, double, double }
13
14define double @func(%struct.hoge* %arg) {
15entry:
16  br label %subregion_entry
17
18subregion_entry:
19  %gep = getelementptr inbounds %struct.hoge, %struct.hoge* %arg, i64 0, i32 2
20  %cond = fcmp ogt double undef, undef
21  br i1 %cond, label %subregion_if, label %subregion_exit
22
23subregion_if:
24  %synthgep = load double, double* %gep
25  br label %subregion_exit
26
27subregion_exit:
28  %retval = load double, double* %gep
29  ret double %retval
30}
31