[PATCH] D93682: [CodeGen] Add "noreturn" attirbute to _Unwind_Resume

Evgeniy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 23 02:53:30 PST 2020


ebrevnov updated this revision to Diff 313522.
ebrevnov added a comment.

Added test case.


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/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/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.313522.patch
Type: text/x-patch
Size: 1535 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201223/7965d2e5/attachment.bin>


More information about the llvm-commits mailing list