diff --git a/llvm/lib/CodeGen/DwarfEHPrepare.cpp b/llvm/lib/CodeGen/DwarfEHPrepare.cpp --- a/llvm/lib/CodeGen/DwarfEHPrepare.cpp +++ b/llvm/lib/CodeGen/DwarfEHPrepare.cpp @@ -235,6 +235,7 @@ CI->setCallingConv(TLI->getLibcallCallingConv(RTLIB::UNWIND_RESUME)); // We never expect _Unwind_Resume to return. + CI->setDoesNotReturn(); new UnreachableInst(Ctx, UnwindBB); return true; } @@ -260,6 +261,7 @@ CI->setCallingConv(TLI->getLibcallCallingConv(RTLIB::UNWIND_RESUME)); // We never expect _Unwind_Resume to return. + CI->setDoesNotReturn(); new UnreachableInst(Ctx, UnwindBB); return true; } diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-invoke-probabilities.ll b/llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-invoke-probabilities.ll --- a/llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-invoke-probabilities.ll +++ b/llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-invoke-probabilities.ll @@ -11,7 +11,7 @@ define void @pluto() align 2 personality i8* bitcast (i32 (...)* @hoge to i8*) { ; CHECK-LABEL: @pluto ; CHECK: bb.1.bb -; CHECK: successors: %bb.2(0x40000000), %bb.3(0x40000000) +; CHECK: successors: %bb.2(0x00000000), %bb.3(0x80000000) ; CHECK: EH_LABEL ; CHECK: G_BR %bb.2 diff --git a/llvm/test/CodeGen/Generic/dwarf_eh_resume.ll b/llvm/test/CodeGen/Generic/dwarf_eh_resume.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/Generic/dwarf_eh_resume.ll @@ -0,0 +1,23 @@ +; RUN: llc %s -stop-after=irtranslator -o - | FileCheck %s + +declare i32 @hoge(...) + +; Check that 'resume' is lowered to _Unwind_Resume which marked as 'noreturn' +define void @pluto() align 2 personality i8* bitcast (i32 (...)* @hoge to i8*) { +;CHECK: call void @_Unwind_Resume(i8* %exn.obj) [[A:#.*]] +;CHECK: attributes [[A]] = { noreturn } +bb: + invoke void @spam() + to label %bb1 unwind label %bb2 + +bb1: ; preds = %bb + ret void + +bb2: ; preds = %bb + %tmp = landingpad { i8*, i32 } + cleanup + resume { i8*, i32 } %tmp + +} + +declare void @spam()