diff --git a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp --- a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp +++ b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp @@ -169,11 +169,11 @@ auto *Term = BB.getTerminator(); - // Fow now only support `ret`/`resume` function terminators. - // FIXME: lift this restriction. + // Support function terminators that have no successors. switch (Term->getOpcode()) { case Instruction::Ret: case Instruction::Resume: + case Instruction::Unreachable: break; default: continue; diff --git a/llvm/test/Transforms/PhaseOrdering/AArch64/peel-multiple-unreachable-exits-for-vectorization.ll b/llvm/test/Transforms/PhaseOrdering/AArch64/peel-multiple-unreachable-exits-for-vectorization.ll --- a/llvm/test/Transforms/PhaseOrdering/AArch64/peel-multiple-unreachable-exits-for-vectorization.ll +++ b/llvm/test/Transforms/PhaseOrdering/AArch64/peel-multiple-unreachable-exits-for-vectorization.ll @@ -75,14 +75,10 @@ ; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[IV_NEXT:%.*]], [[AT_WITH_INT_CONVERSION_EXIT11:%.*]] ], [ [[IV_PH]], [[LOOP_PREHEADER20]] ] ; CHECK-NEXT: [[SUM:%.*]] = phi i64 [ [[SUM_NEXT:%.*]], [[AT_WITH_INT_CONVERSION_EXIT11]] ], [ [[SUM_PH]], [[LOOP_PREHEADER20]] ] ; CHECK-NEXT: [[INRANGE_I:%.*]] = icmp ult i64 [[SUB_I]], [[IV]] -; CHECK-NEXT: br i1 [[INRANGE_I]], label [[ERROR_I:%.*]], label [[AT_WITH_INT_CONVERSION_EXIT:%.*]] -; CHECK: error.i: -; CHECK-NEXT: tail call void @error() -; CHECK-NEXT: unreachable -; CHECK: at_with_int_conversion.exit: ; CHECK-NEXT: [[INRANGE_I7:%.*]] = icmp ult i64 [[SUB_I6_PEEL]], [[IV]] -; CHECK-NEXT: br i1 [[INRANGE_I7]], label [[ERROR_I10:%.*]], label [[AT_WITH_INT_CONVERSION_EXIT11]] -; CHECK: error.i10: +; CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[INRANGE_I]], i1 true, i1 [[INRANGE_I7]] +; CHECK-NEXT: br i1 [[OR_COND]], label [[COMMON_UNREACHABLE:%.*]], label [[AT_WITH_INT_CONVERSION_EXIT11]] +; CHECK: common.unreachable: ; CHECK-NEXT: tail call void @error() ; CHECK-NEXT: unreachable ; CHECK: at_with_int_conversion.exit11: @@ -201,25 +197,18 @@ ; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[IV_NEXT:%.*]], [[AT_WITH_INT_CONVERSION_EXIT22:%.*]] ], [ [[IV_PH]], [[LOOP_PREHEADER34]] ] ; CHECK-NEXT: [[SUM:%.*]] = phi i64 [ [[SUM_NEXT:%.*]], [[AT_WITH_INT_CONVERSION_EXIT22]] ], [ [[SUM_PH]], [[LOOP_PREHEADER34]] ] ; CHECK-NEXT: [[INRANGE_I:%.*]] = icmp ult i64 [[SUB_I]], [[IV]] -; CHECK-NEXT: br i1 [[INRANGE_I]], label [[ERROR_I:%.*]], label [[AT_WITH_INT_CONVERSION_EXIT:%.*]] -; CHECK: error.i: +; CHECK-NEXT: br i1 [[INRANGE_I]], label [[COMMON_UNREACHABLE:%.*]], label [[AT_WITH_INT_CONVERSION_EXIT:%.*]] +; CHECK: common.unreachable: ; CHECK-NEXT: tail call void @error() ; CHECK-NEXT: unreachable ; CHECK: at_with_int_conversion.exit: -; CHECK-NEXT: [[GEP_IDX_I:%.*]] = getelementptr i64, ptr [[START_I]], i64 [[IV]] -; CHECK-NEXT: [[LV_I:%.*]] = load i64, ptr [[GEP_IDX_I]], align 4 ; CHECK-NEXT: [[INRANGE_I7:%.*]] = icmp ult i64 [[SUB_I6_PEEL]], [[IV]] -; CHECK-NEXT: br i1 [[INRANGE_I7]], label [[ERROR_I10:%.*]], label [[AT_WITH_INT_CONVERSION_EXIT11:%.*]] -; CHECK: error.i10: -; CHECK-NEXT: tail call void @error() -; CHECK-NEXT: unreachable -; CHECK: at_with_int_conversion.exit11: ; CHECK-NEXT: [[INRANGE_I18:%.*]] = icmp ult i64 [[SUB_I17_PEEL]], [[IV]] -; CHECK-NEXT: br i1 [[INRANGE_I18]], label [[ERROR_I21:%.*]], label [[AT_WITH_INT_CONVERSION_EXIT22]] -; CHECK: error.i21: -; CHECK-NEXT: tail call void @error() -; CHECK-NEXT: unreachable +; CHECK-NEXT: [[OR_COND:%.*]] = select i1 [[INRANGE_I7]], i1 true, i1 [[INRANGE_I18]] +; CHECK-NEXT: br i1 [[OR_COND]], label [[COMMON_UNREACHABLE]], label [[AT_WITH_INT_CONVERSION_EXIT22]] ; CHECK: at_with_int_conversion.exit22: +; CHECK-NEXT: [[GEP_IDX_I:%.*]] = getelementptr i64, ptr [[START_I]], i64 [[IV]] +; CHECK-NEXT: [[LV_I:%.*]] = load i64, ptr [[GEP_IDX_I]], align 4 ; CHECK-NEXT: [[GEP_IDX_I8:%.*]] = getelementptr i64, ptr [[START_I1_PEEL]], i64 [[IV]] ; CHECK-NEXT: [[LV_I9:%.*]] = load i64, ptr [[GEP_IDX_I8]], align 4 ; CHECK-NEXT: [[GEP_IDX_I19:%.*]] = getelementptr i64, ptr [[START_I12_PEEL]], i64 [[IV]] diff --git a/llvm/test/Transforms/SimplifyCFG/tail-merge-assert.ll b/llvm/test/Transforms/SimplifyCFG/tail-merge-assert.ll --- a/llvm/test/Transforms/SimplifyCFG/tail-merge-assert.ll +++ b/llvm/test/Transforms/SimplifyCFG/tail-merge-assert.ll @@ -25,23 +25,19 @@ ; CHECK-LABEL: @merge_glibc_asserts( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i32 [[Y:%.*]], [[X:%.*]] -; CHECK-NEXT: br i1 [[CMP]], label [[COND_END:%.*]], label [[COND_FALSE:%.*]] -; CHECK: cond.false: -; CHECK-NEXT: tail call void @glibc_assert_fail(ptr @.str, ptr @.str.1, i32 3, ptr @__PRETTY_FUNCTION__._Z1fjj) +; CHECK-NEXT: br i1 [[CMP]], label [[COND_END:%.*]], label [[COMMON_UNREACHABLE:%.*]] +; CHECK: common.unreachable: +; CHECK-NEXT: [[DOTSINK:%.*]] = phi i32 [ 3, [[ENTRY:%.*]] ], [ 4, [[COND_END]] ], [ 5, [[COND_END4:%.*]] ] +; CHECK-NEXT: [[DOTSTR_3_SINK:%.*]] = phi ptr [ @.str, [[ENTRY]] ], [ @.str.2, [[COND_END]] ], [ @.str.3, [[COND_END4]] ] +; CHECK-NEXT: tail call void @glibc_assert_fail(ptr [[DOTSTR_3_SINK]], ptr @.str.1, i32 [[DOTSINK]], ptr @__PRETTY_FUNCTION__._Z1fjj) ; CHECK-NEXT: unreachable ; CHECK: cond.end: ; CHECK-NEXT: [[SUB:%.*]] = sub i32 [[Y]], [[X]] ; CHECK-NEXT: [[CMP1:%.*]] = icmp ugt i32 [[SUB]], 7 -; CHECK-NEXT: br i1 [[CMP1]], label [[COND_END4:%.*]], label [[COND_FALSE3:%.*]] -; CHECK: cond.false3: -; CHECK-NEXT: tail call void @glibc_assert_fail(ptr @.str.2, ptr @.str.1, i32 4, ptr @__PRETTY_FUNCTION__._Z1fjj) -; CHECK-NEXT: unreachable +; CHECK-NEXT: br i1 [[CMP1]], label [[COND_END4]], label [[COMMON_UNREACHABLE]] ; CHECK: cond.end4: ; CHECK-NEXT: [[CMP6:%.*]] = icmp ult i32 [[SUB]], 40 -; CHECK-NEXT: br i1 [[CMP6]], label [[COND_END9:%.*]], label [[COND_FALSE8:%.*]] -; CHECK: cond.false8: -; CHECK-NEXT: tail call void @glibc_assert_fail(ptr @.str.3, ptr @.str.1, i32 5, ptr @__PRETTY_FUNCTION__._Z1fjj) -; CHECK-NEXT: unreachable +; CHECK-NEXT: br i1 [[CMP6]], label [[COND_END9:%.*]], label [[COMMON_UNREACHABLE]] ; CHECK: cond.end9: ; CHECK-NEXT: ret void ; diff --git a/llvm/test/Transforms/SimplifyCFG/tail-merge-noreturn.ll b/llvm/test/Transforms/SimplifyCFG/tail-merge-noreturn.ll --- a/llvm/test/Transforms/SimplifyCFG/tail-merge-noreturn.ll +++ b/llvm/test/Transforms/SimplifyCFG/tail-merge-noreturn.ll @@ -10,22 +10,16 @@ define void @merge_simple() { ; CHECK-LABEL: @merge_simple( ; CHECK-NEXT: [[C1:%.*]] = call i1 @foo() -; CHECK-NEXT: br i1 [[C1]], label [[CONT1:%.*]], label [[A1:%.*]] -; CHECK: a1: +; CHECK-NEXT: br i1 [[C1]], label [[CONT1:%.*]], label [[COMMON_UNREACHABLE:%.*]] +; CHECK: common.unreachable: ; CHECK-NEXT: call void @assert_fail_1(i32 0) ; CHECK-NEXT: unreachable ; CHECK: cont1: ; CHECK-NEXT: [[C2:%.*]] = call i1 @foo() -; CHECK-NEXT: br i1 [[C2]], label [[CONT2:%.*]], label [[A2:%.*]] -; CHECK: a2: -; CHECK-NEXT: call void @assert_fail_1(i32 0) -; CHECK-NEXT: unreachable +; CHECK-NEXT: br i1 [[C2]], label [[CONT2:%.*]], label [[COMMON_UNREACHABLE]] ; CHECK: cont2: ; CHECK-NEXT: [[C3:%.*]] = call i1 @foo() -; CHECK-NEXT: br i1 [[C3]], label [[CONT3:%.*]], label [[A3:%.*]] -; CHECK: a3: -; CHECK-NEXT: call void @assert_fail_1(i32 0) -; CHECK-NEXT: unreachable +; CHECK-NEXT: br i1 [[C3]], label [[CONT3:%.*]], label [[COMMON_UNREACHABLE]] ; CHECK: cont3: ; CHECK-NEXT: ret void ; @@ -54,22 +48,17 @@ ; CHECK-LABEL: @phi_three_constants( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[C1:%.*]] = call i1 @foo() -; CHECK-NEXT: br i1 [[C1]], label [[CONT1:%.*]], label [[A1:%.*]] -; CHECK: a1: -; CHECK-NEXT: call void @assert_fail_1(i32 0) +; CHECK-NEXT: br i1 [[C1]], label [[CONT1:%.*]], label [[COMMON_UNREACHABLE:%.*]] +; CHECK: common.unreachable: +; CHECK-NEXT: [[DOTSINK:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ 1, [[CONT1]] ], [ 2, [[CONT2:%.*]] ] +; CHECK-NEXT: call void @assert_fail_1(i32 [[DOTSINK]]) ; CHECK-NEXT: unreachable ; CHECK: cont1: ; CHECK-NEXT: [[C2:%.*]] = call i1 @foo() -; CHECK-NEXT: br i1 [[C2]], label [[CONT2:%.*]], label [[A2:%.*]] -; CHECK: a2: -; CHECK-NEXT: call void @assert_fail_1(i32 1) -; CHECK-NEXT: unreachable +; CHECK-NEXT: br i1 [[C2]], label [[CONT2]], label [[COMMON_UNREACHABLE]] ; CHECK: cont2: ; CHECK-NEXT: [[C3:%.*]] = call i1 @foo() -; CHECK-NEXT: br i1 [[C3]], label [[CONT3:%.*]], label [[A3:%.*]] -; CHECK: a3: -; CHECK-NEXT: call void @assert_fail_1(i32 2) -; CHECK-NEXT: unreachable +; CHECK-NEXT: br i1 [[C3]], label [[CONT3:%.*]], label [[COMMON_UNREACHABLE]] ; CHECK: cont3: ; CHECK-NEXT: ret void ; @@ -98,16 +87,14 @@ define void @dont_phi_values(i32 %x, i32 %y) { ; CHECK-LABEL: @dont_phi_values( ; CHECK-NEXT: [[C1:%.*]] = call i1 @foo() -; CHECK-NEXT: br i1 [[C1]], label [[CONT1:%.*]], label [[A1:%.*]] -; CHECK: a1: -; CHECK-NEXT: call void @assert_fail_1(i32 [[X:%.*]]) +; CHECK-NEXT: br i1 [[C1]], label [[CONT1:%.*]], label [[COMMON_UNREACHABLE:%.*]] +; CHECK: common.unreachable: +; CHECK-NEXT: [[Y_SINK:%.*]] = phi i32 [ [[X:%.*]], [[TMP0:%.*]] ], [ [[Y:%.*]], [[CONT1]] ] +; CHECK-NEXT: call void @assert_fail_1(i32 [[Y_SINK]]) ; CHECK-NEXT: unreachable ; CHECK: cont1: ; CHECK-NEXT: [[C2:%.*]] = call i1 @foo() -; CHECK-NEXT: br i1 [[C2]], label [[CONT2:%.*]], label [[A2:%.*]] -; CHECK: a2: -; CHECK-NEXT: call void @assert_fail_1(i32 [[Y:%.*]]) -; CHECK-NEXT: unreachable +; CHECK-NEXT: br i1 [[C2]], label [[CONT2:%.*]], label [[COMMON_UNREACHABLE]] ; CHECK: cont2: ; CHECK-NEXT: ret void ; @@ -166,18 +153,17 @@ ; CHECK-NEXT: br i1 [[C:%.*]], label [[S1:%.*]], label [[S2:%.*]] ; CHECK: s1: ; CHECK-NEXT: [[C1:%.*]] = call i1 @foo() -; CHECK-NEXT: br i1 [[C1]], label [[A1:%.*]], label [[A2:%.*]] +; CHECK-NEXT: br i1 [[C1]], label [[COMMON_UNREACHABLE:%.*]], label [[A2:%.*]] ; CHECK: s2: ; CHECK-NEXT: [[C2:%.*]] = call i1 @bar() -; CHECK-NEXT: br i1 [[C2]], label [[A1]], label [[A2]] -; CHECK: a1: -; CHECK-NEXT: [[L1:%.*]] = phi i32 [ 0, [[S1]] ], [ 1, [[S2]] ] -; CHECK-NEXT: call void @assert_fail_1(i32 [[L1]]) +; CHECK-NEXT: br i1 [[C2]], label [[COMMON_UNREACHABLE]], label [[A2]] +; CHECK: common.unreachable: +; CHECK-NEXT: [[L2_SINK:%.*]] = phi i32 [ [[L2:%.*]], [[A2]] ], [ 0, [[S1]] ], [ 1, [[S2]] ] +; CHECK-NEXT: call void @assert_fail_1(i32 [[L2_SINK]]) ; CHECK-NEXT: unreachable ; CHECK: a2: -; CHECK-NEXT: [[L2:%.*]] = phi i32 [ 2, [[S1]] ], [ 3, [[S2]] ] -; CHECK-NEXT: call void @assert_fail_1(i32 [[L2]]) -; CHECK-NEXT: unreachable +; CHECK-NEXT: [[L2]] = phi i32 [ 2, [[S1]] ], [ 3, [[S2]] ] +; CHECK-NEXT: br label [[COMMON_UNREACHABLE]] ; entry: br i1 %c, label %s1, label %s2 @@ -201,19 +187,18 @@ ; CHECK-LABEL: @tail_merge_switch( ; CHECK-NEXT: entry: ; CHECK-NEXT: switch i32 [[V:%.*]], label [[RET:%.*]] [ -; CHECK-NEXT: i32 0, label [[A1:%.*]] +; CHECK-NEXT: i32 0, label [[COMMON_UNREACHABLE:%.*]] ; CHECK-NEXT: i32 13, label [[A2:%.*]] ; CHECK-NEXT: i32 42, label [[A3:%.*]] ; CHECK-NEXT: ] -; CHECK: a1: -; CHECK-NEXT: call void @assert_fail_1(i32 0) +; CHECK: common.unreachable: +; CHECK-NEXT: [[DOTSINK:%.*]] = phi i32 [ 2, [[A3]] ], [ 1, [[A2]] ], [ 0, [[ENTRY:%.*]] ] +; CHECK-NEXT: call void @assert_fail_1(i32 [[DOTSINK]]) ; CHECK-NEXT: unreachable ; CHECK: a2: -; CHECK-NEXT: call void @assert_fail_1(i32 1) -; CHECK-NEXT: unreachable +; CHECK-NEXT: br label [[COMMON_UNREACHABLE]] ; CHECK: a3: -; CHECK-NEXT: call void @assert_fail_1(i32 2) -; CHECK-NEXT: unreachable +; CHECK-NEXT: br label [[COMMON_UNREACHABLE]] ; CHECK: ret: ; CHECK-NEXT: ret void ; @@ -239,18 +224,14 @@ define void @need_to_add_bb2_preds(i1 %c1) { ; CHECK-LABEL: @need_to_add_bb2_preds( ; CHECK-NEXT: bb1: -; CHECK-NEXT: br i1 [[C1:%.*]], label [[BB2:%.*]], label [[A1:%.*]] +; CHECK-NEXT: br i1 [[C1:%.*]], label [[BB2:%.*]], label [[COMMON_UNREACHABLE:%.*]] ; CHECK: bb2: ; CHECK-NEXT: [[C2:%.*]] = call i1 @bar() -; CHECK-NEXT: br i1 [[C2]], label [[A2:%.*]], label [[A3:%.*]] -; CHECK: a1: -; CHECK-NEXT: call void @assert_fail_1(i32 0) -; CHECK-NEXT: unreachable -; CHECK: a2: -; CHECK-NEXT: call void @assert_fail_1(i32 1) -; CHECK-NEXT: unreachable -; CHECK: a3: -; CHECK-NEXT: call void @assert_fail_1(i32 2) +; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[C2]], i32 1, i32 2 +; CHECK-NEXT: br label [[COMMON_UNREACHABLE]] +; CHECK: common.unreachable: +; CHECK-NEXT: [[DOTSINK:%.*]] = phi i32 [ 0, [[BB1:%.*]] ], [ [[SPEC_SELECT]], [[BB2]] ] +; CHECK-NEXT: call void @assert_fail_1(i32 [[DOTSINK]]) ; CHECK-NEXT: unreachable ; bb1: @@ -274,20 +255,17 @@ ; CHECK-LABEL: @phi_in_bb2( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[C1:%.*]] = call i1 @foo() -; CHECK-NEXT: br i1 [[C1]], label [[CONT1:%.*]], label [[A1:%.*]] -; CHECK: a1: -; CHECK-NEXT: call void @assert_fail_1(i32 0) +; CHECK-NEXT: br i1 [[C1]], label [[CONT1:%.*]], label [[COMMON_UNREACHABLE:%.*]] +; CHECK: common.unreachable: +; CHECK-NEXT: [[P2_SINK:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ 1, [[CONT1]] ], [ 2, [[CONT2:%.*]] ] +; CHECK-NEXT: call void @assert_fail_1(i32 [[P2_SINK]]) ; CHECK-NEXT: unreachable ; CHECK: cont1: ; CHECK-NEXT: [[C2:%.*]] = call i1 @foo() -; CHECK-NEXT: br i1 [[C2]], label [[CONT2:%.*]], label [[A2:%.*]] -; CHECK: a2: -; CHECK-NEXT: [[P2:%.*]] = phi i32 [ 1, [[CONT1]] ], [ 2, [[CONT2]] ] -; CHECK-NEXT: call void @assert_fail_1(i32 [[P2]]) -; CHECK-NEXT: unreachable +; CHECK-NEXT: br i1 [[C2]], label [[CONT2]], label [[COMMON_UNREACHABLE]] ; CHECK: cont2: ; CHECK-NEXT: [[C3:%.*]] = call i1 @foo() -; CHECK-NEXT: br i1 [[C3]], label [[CONT3:%.*]], label [[A2]] +; CHECK-NEXT: br i1 [[C3]], label [[CONT3:%.*]], label [[COMMON_UNREACHABLE]] ; CHECK: cont3: ; CHECK-NEXT: ret void ; @@ -335,10 +313,12 @@ ; CHECK: if.then1: ; CHECK-NEXT: call void @escape_i32_ptr(ptr nonnull [[X]]) ; CHECK-NEXT: br label [[IF_END]] -; CHECK: if.end: -; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 4, ptr nonnull [[X]]) +; CHECK: common.unreachable: ; CHECK-NEXT: call void @abort() ; CHECK-NEXT: unreachable +; CHECK: if.end: +; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 4, ptr nonnull [[X]]) +; CHECK-NEXT: br label [[COMMON_UNREACHABLE:%.*]] ; CHECK: if.then3: ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 4, ptr nonnull [[Y]]) ; CHECK-NEXT: store i32 0, ptr [[Y]], align 4 @@ -349,8 +329,7 @@ ; CHECK-NEXT: br label [[IF_END7]] ; CHECK: if.end7: ; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 4, ptr nonnull [[Y]]) -; CHECK-NEXT: call void @abort() -; CHECK-NEXT: unreachable +; CHECK-NEXT: br label [[COMMON_UNREACHABLE]] ; CHECK: if.end9: ; CHECK-NEXT: ret void ; @@ -404,20 +383,16 @@ ; CHECK-LABEL: @dead_phi( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[C1:%.*]] = call i1 @foo() -; CHECK-NEXT: br i1 [[C1]], label [[CONT1:%.*]], label [[A1:%.*]] -; CHECK: a1: -; CHECK-NEXT: [[DEAD:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ 1, [[CONT1]] ] +; CHECK-NEXT: br i1 [[C1]], label [[CONT1:%.*]], label [[COMMON_UNREACHABLE:%.*]] +; CHECK: common.unreachable: ; CHECK-NEXT: call void @assert_fail_1(i32 0) ; CHECK-NEXT: unreachable ; CHECK: cont1: ; CHECK-NEXT: [[C2:%.*]] = call i1 @foo() -; CHECK-NEXT: br i1 [[C2]], label [[CONT2:%.*]], label [[A1]] +; CHECK-NEXT: br i1 [[C2]], label [[CONT2:%.*]], label [[COMMON_UNREACHABLE]] ; CHECK: cont2: ; CHECK-NEXT: [[C3:%.*]] = call i1 @foo() -; CHECK-NEXT: br i1 [[C3]], label [[CONT3:%.*]], label [[A3:%.*]] -; CHECK: a3: -; CHECK-NEXT: call void @assert_fail_1(i32 0) -; CHECK-NEXT: unreachable +; CHECK-NEXT: br i1 [[C3]], label [[CONT3:%.*]], label [[COMMON_UNREACHABLE]] ; CHECK: cont3: ; CHECK-NEXT: ret void ; @@ -446,15 +421,10 @@ ; CHECK-NEXT: entry: ; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[C:%.*]], metadata [[META5:![0-9]+]], metadata !DIExpression()), !dbg [[DBG7:![0-9]+]] ; CHECK-NEXT: switch i32 [[C]], label [[SW_EPILOG:%.*]] [ -; CHECK-NEXT: i32 13, label [[SW_BB:%.*]] -; CHECK-NEXT: i32 42, label [[SW_BB1:%.*]] +; CHECK-NEXT: i32 13, label [[COMMON_UNREACHABLE:%.*]] +; CHECK-NEXT: i32 42, label [[COMMON_UNREACHABLE]] ; CHECK-NEXT: ] -; CHECK: sw.bb: -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 55, metadata [[META5]], metadata !DIExpression()), !dbg [[DBG7]] -; CHECK-NEXT: tail call void @abort() -; CHECK-NEXT: unreachable -; CHECK: sw.bb1: -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 67, metadata [[META5]], metadata !DIExpression()), !dbg [[DBG7]] +; CHECK: common.unreachable: ; CHECK-NEXT: tail call void @abort() ; CHECK-NEXT: unreachable ; CHECK: sw.epilog: @@ -486,19 +456,11 @@ ; CHECK-NEXT: entry: ; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[C:%.*]], metadata [[META5]], metadata !DIExpression()), !dbg [[DBG7]] ; CHECK-NEXT: switch i32 [[C]], label [[SW_EPILOG:%.*]] [ -; CHECK-NEXT: i32 13, label [[SW_BB:%.*]] -; CHECK-NEXT: i32 42, label [[SW_BB1:%.*]] -; CHECK-NEXT: i32 53, label [[SW_BB2:%.*]] +; CHECK-NEXT: i32 13, label [[COMMON_UNREACHABLE:%.*]] +; CHECK-NEXT: i32 42, label [[COMMON_UNREACHABLE]] +; CHECK-NEXT: i32 53, label [[COMMON_UNREACHABLE]] ; CHECK-NEXT: ] -; CHECK: sw.bb: -; CHECK-NEXT: [[C_1:%.*]] = phi i32 [ 55, [[ENTRY:%.*]] ], [ 67, [[SW_BB1]] ] -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[C_1]], metadata [[META5]], metadata !DIExpression()), !dbg [[DBG7]] -; CHECK-NEXT: tail call void @abort() -; CHECK-NEXT: unreachable -; CHECK: sw.bb1: -; CHECK-NEXT: br label [[SW_BB]] -; CHECK: sw.bb2: -; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 84, metadata [[META5]], metadata !DIExpression()), !dbg [[DBG7]] +; CHECK: common.unreachable: ; CHECK-NEXT: tail call void @abort() ; CHECK-NEXT: unreachable ; CHECK: sw.epilog: