1; RUN: opt < %s -S -loop-rotate -o - -verify-loop-info -verify-dom-info | FileCheck %s 2; RUN: opt < %s -S -loop-rotate -o - -verify-loop-info -verify-dom-info -enable-mssa-loop-dependency=true -verify-memoryssa | FileCheck %s 3 4; PR5502 5define void @z80_do_opcodes() nounwind { 6entry: 7 br label %while.cond 8 9while.cond: ; preds = %end_opcode, %entry 10 br label %while.body 11 12while.body: ; preds = %while.cond 13 br label %indirectgoto 14 15run_opcode: ; preds = %indirectgoto 16 %tmp276 = load i8, i8* undef ; <i8> [#uses=1] 17 br label %indirectgoto 18 19if.else295: ; preds = %divide_late 20 br label %end_opcode 21 22end_opcode: ; preds = %indirectgoto, %sw.default42406, %sw.default, %if.else295 23 %opcode.2 = phi i8 [ %opcode.0, %indirectgoto ], [ 0, %sw.default42406 ], [ undef, %sw.default ], [ %opcode.0, %if.else295 ] ; <i8> [#uses=0] 24 switch i32 undef, label %while.cond [ 25 i32 221, label %sw.bb11691 26 i32 253, label %sw.bb30351 27 ] 28 29sw.bb11691: ; preds = %end_opcode 30 br label %sw.default 31 32sw.default: ; preds = %sw.bb11691 33 br label %end_opcode 34 35sw.bb30351: ; preds = %end_opcode 36 br label %sw.default42406 37 38sw.default42406: ; preds = %sw.bb30351 39 br label %end_opcode 40 41indirectgoto: ; preds = %run_opcode, %while.body 42 %opcode.0 = phi i8 [ undef, %while.body ], [ %tmp276, %run_opcode ] ; <i8> [#uses=2] 43 indirectbr i8* undef, [label %run_opcode, label %if.else295, label %end_opcode] 44} 45 46; CHECK-LABEL: @foo 47define void @foo(i1 %a, i1 %b, i8* %c) { 48; CHECK: entry 49; CHECK-NEXT: br i1 %a, label %return, label %preheader 50entry: 51 br i1 %a, label %return, label %preheader 52 53; CHECK: preheader: 54; CHECK-NEXT: br label %header 55preheader: 56 br label %header 57 58; CHECK: header: 59; CHECK-NEXT: br i1 %b, label %return, label %body 60header: 61 br i1 %b, label %return, label %body 62 63; CHECK: body: 64; CHECK-NEXT: indirectbr i8* %c, [label %return, label %latch] 65body: 66 indirectbr i8* %c, [label %return, label %latch] 67 68; CHECK: latch: 69; CHECK-NEXT: br label %header 70latch: 71 br label %header 72 73return: 74 ret void 75} 76