[PATCH] D93682: [CodeGen] Add "noreturn" attirbute to _Unwind_Resume
Evgeniy via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 24 00:12:53 PST 2020
ebrevnov updated this revision to Diff 313662.
ebrevnov added a comment.
Updated test case due to https://reviews.llvm.org/D79485 has landed.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93682/new/
https://reviews.llvm.org/D93682
Files:
llvm/lib/CodeGen/DwarfEHPrepare.cpp
llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-invoke-probabilities.ll
llvm/test/CodeGen/Generic/dwarf_eh_resume.ll
Index: llvm/test/CodeGen/Generic/dwarf_eh_resume.ll
===================================================================
--- /dev/null
+++ 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()
Index: llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-invoke-probabilities.ll
===================================================================
--- llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-invoke-probabilities.ll
+++ 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 <mcsymbol >
; CHECK: G_BR %bb.2
Index: llvm/lib/CodeGen/DwarfEHPrepare.cpp
===================================================================
--- llvm/lib/CodeGen/DwarfEHPrepare.cpp
+++ 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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93682.313662.patch
Type: text/x-patch
Size: 2153 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201224/2ee52c44/attachment.bin>
More information about the llvm-commits
mailing list