1 ; RUN: opt < %s -mergereturn -loop-extract -enable-new-pm=0 -S | FileCheck %s
3 ; This test used to enter an infinite loop, until out of memory (PR3082).
6 ; CHECK-LABEL: define void @test()
8 ; CHECK-NEXT: br label %codeRepl
10 ; CHECK-NEXT: %targetBlock = call i1 @test.loopentry()
11 ; CHECK-NEXT: br i1 %targetBlock, label %exit.1, label %exit.0
13 ; CHECK-NEXT: br label %UnifiedReturnBlock
15 ; CHECK-NEXT: br label %UnifiedReturnBlock
16 ; CHECK: UnifiedReturnBlock:
17 ; CHECK-NEXT: ret void
22 loopentry: ; preds = %loopexit, %entry
23 br i1 undef, label %exit.1, label %loopexit
25 loopexit: ; preds = %loopentry
26 br i1 undef, label %loopentry, label %exit.0
28 exit.0: ; preds = %loopexit
31 exit.1: ; preds = %loopentry
35 ; CHECK-LABEL: define internal i1 @test.loopentry()
36 ; CHECK-NEXT: newFuncRoot:
37 ; CHECK-NEXT: br label %loopentry
38 ; CHECK: exit.1.exitStub:
39 ; CHECK-NEXT: ret i1 true
40 ; CHECK: exit.0.exitStub:
41 ; CHECK-NEXT: ret i1 false
43 ; CHECK-NEXT: br i1 true, label %exit.1.exitStub, label %loopexit
45 ; CHECK-NEXT: br i1 false, label %loopexit.loopentry_crit_edge, label %exit.0.exitStub
46 ; CHECK: loopexit.loopentry_crit_edge:
47 ; CHECK-NEXT: br label %loopentry