[llvm] [CodeGen] Avoid generating trap instructions after exception restore intrinsics (PR #109560)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 22 08:49:33 PDT 2024


================
@@ -1405,8 +1405,8 @@ let IntrProperties = [IntrNoMem, IntrSpeculatable, IntrWillReturn] in {
 // given function it is 'const' and may be CSE'd etc.
 def int_eh_typeid_for : Intrinsic<[llvm_i32_ty], [llvm_anyptr_ty], [IntrNoMem]>;
 
-def int_eh_return_i32 : Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty]>;
-def int_eh_return_i64 : Intrinsic<[], [llvm_i64_ty, llvm_ptr_ty]>;
+def int_eh_return_i32 : Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty], [IntrNoReturn]>;
+def int_eh_return_i64 : Intrinsic<[], [llvm_i64_ty, llvm_ptr_ty], [IntrNoReturn]>;
----------------
duk-37 wrote:

I'm a little confused as to what you mean. The Clang intrinsic, `__builtin_eh_return` is marked as `NoReturn`, everything essentially treats it as `noreturn` due to `unreachable` being emitted immediately after them, and the verifier would complain if you emitted code after them (which is exactly what this PR is trying to fix).

Marking these as `noreturn` accurately represents their behavior and makes it so that the patch can be a bit smaller since I don't need to reorganize logic in the instruction selectors.

https://github.com/llvm/llvm-project/pull/109560


More information about the llvm-commits mailing list