70 lines · plain
1; RUN: opt -S -passes=loop-simplify -disable-output -verify-loop-info -verify-dom-info < %s2; PR52353 4; When loopsimplify inserts a preheader for this loop, it should add the new5; block to the enclosing loop and not get confused by the unreachable6; bogus loop entry.7 8define void @is_extract_cab(i1 %arg) nounwind {9entry:10 br label %header11 12header: ; preds = %if.end206, %cond.end66, %if.end2313 br label %while.body11514 15while.body115: ; preds = %9, %if.end192, %if.end10116 br i1 %arg, label %header, label %while.body11517 18foo:19 br label %while.body11520}21 22; When loopsimplify generates dedicated exit block for blocks that are landing23; pads (i.e. innerLoopExit in this test), we should not get confused with the24; unreachable pred (unreachableB) to innerLoopExit.25define void @baz(i32 %trip) personality ptr @wobble {26entry:27 br label %outerHeader28 29outerHeader:30 invoke void @foo()31 to label %innerPreheader unwind label %innerLoopExit32 33innerPreheader:34 br label %innerH35 36innerH:37 %tmp50 = invoke ptr undef()38 to label %innerLatch unwind label %innerLoopExit39 40innerLatch:41 %cmp = icmp slt i32 %trip, 4242 br i1 %cmp, label %innerH, label %retblock43 44unreachableB: ; No predecessors!45 %tmp62 = invoke ptr undef()46 to label %retblock unwind label %innerLoopExit47 48; undedicated exit block (preds from inner and outer loop)49; Also has unreachableB as pred.50innerLoopExit:51 %tmp65 = landingpad { ptr, i32 }52 cleanup53 invoke void @foo()54 to label %outerHeader unwind label %unwindblock55 56unwindblock:57 %tmp67 = landingpad { ptr, i32 }58 cleanup59 ret void60 61retblock:62 ret void63}64 65; Function Attrs: nounwind66declare ptr @wobble()67 68; Function Attrs: uwtable69declare void @foo()70