Author: Evgeniy Brevnov Date: 2020-12-24T18:14:18+07:00 New Revision: e0751234ef0df733032b777ed0d993a490121855
URL: https://github.com/llvm/llvm-project/commit/e0751234ef0df733032b777ed0d993a490121855 DIFF: https://github.com/llvm/llvm-project/commit/e0751234ef0df733032b777ed0d993a490121855.diff LOG: [CodeGen] Add "noreturn" attirbute to _Unwind_Resume Currently 'resume' is lowered to _Unwind_Resume with out "noreturn" attribute. Semantically _Unwind_Resume library call is expected to never return and should be marked as such. Though I didn't find any changes in behavior of existing tests there will be a difference once https://reviews.llvm.org/D79485 lands. I was not able to come up with the test case anything better than just checking for presence of "noreturn" attribute. Please let me know if there is a better way to test the change. Reviewed By: xbolva00 Differential Revision: https://reviews.llvm.org/D93682 Added: llvm/test/CodeGen/Generic/dwarf_eh_resume.ll Modified: llvm/lib/CodeGen/DwarfEHPrepare.cpp llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-invoke-probabilities.ll Removed: ################################################################################ diff --git a/llvm/lib/CodeGen/DwarfEHPrepare.cpp b/llvm/lib/CodeGen/DwarfEHPrepare.cpp index c75c957bff8a..c7048337cdf2 100644 --- a/llvm/lib/CodeGen/DwarfEHPrepare.cpp +++ b/llvm/lib/CodeGen/DwarfEHPrepare.cpp @@ -235,6 +235,7 @@ bool DwarfEHPrepare::InsertUnwindResumeCalls(Function &Fn) { 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 @@ bool DwarfEHPrepare::InsertUnwindResumeCalls(Function &Fn) { 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 index a10148f1ffdc..473216e9f170 100644 --- a/llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-invoke-probabilities.ll +++ b/llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-invoke-probabilities.ll @@ -11,7 +11,7 @@ declare i32 @hoge(...) 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 <mcsymbol > ; 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 index 000000000000..b7bc17c46963 --- /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() _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits