1 ; RUN: opt -S -passes=loop-simplify -disable-output -verify-loop-info -verify-dom-info < %s
4 ; When loopsimplify inserts a preheader for this loop, it should add the new
5 ; block to the enclosing loop and not get confused by the unreachable
8 define void @is_extract_cab() nounwind {
12 header: ; preds = %if.end206, %cond.end66, %if.end23
13 br label %while.body115
15 while.body115: ; preds = %9, %if.end192, %if.end101
16 br i1 undef, label %header, label %while.body115
19 br label %while.body115
22 ; When loopsimplify generates dedicated exit block for blocks that are landing
23 ; pads (i.e. innerLoopExit in this test), we should not get confused with the
24 ; unreachable pred (unreachableB) to innerLoopExit.
25 define void @baz(i32 %trip) personality ptr @wobble {
31 to label %innerPreheader unwind label %innerLoopExit
37 %tmp50 = invoke ptr undef()
38 to label %innerLatch unwind label %innerLoopExit
41 %cmp = icmp slt i32 %trip, 42
42 br i1 %cmp, label %innerH, label %retblock
44 unreachableB: ; No predecessors!
45 %tmp62 = invoke ptr undef()
46 to label %retblock unwind label %innerLoopExit
48 ; undedicated exit block (preds from inner and outer loop)
49 ; Also has unreachableB as pred.
51 %tmp65 = landingpad { ptr, i32 }
54 to label %outerHeader unwind label %unwindblock
57 %tmp67 = landingpad { ptr, i32 }
65 ; Function Attrs: nounwind
68 ; Function Attrs: uwtable