[llvm] [CodeGen] Do not emit TRAP for `unreachable` after `@llvm.trap` (PR #94570)
Igor Kudrin via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 10 11:09:00 PDT 2024
================
@@ -15,11 +17,19 @@ define i32 @call_exit() noreturn nounwind {
; CHECK-LABEL: trap:
; CHECK: ud2
+; CHECK-NOT: ud2
+define i32 @trap() noreturn nounwind {
+ tail call void @llvm.trap()
+ unreachable
+}
+
+; CHECK-LABEL: trap_fn_attr:
+; CHECK: callq {{_?}}trap_func
; TRAP_AFTER_NORETURN: ud2
; NO_TRAP_AFTER_NORETURN-NOT: ud2
; NORMAL-NOT: ud2
-define i32 @trap() noreturn nounwind {
- tail call void @llvm.trap()
+define i32 @trap_fn_attr() noreturn nounwind {
+ tail call void @llvm.trap() #0
unreachable
}
----------------
igorkudrin wrote:
Maybe I don't understand what particular case you mean. Could you show an example?
https://github.com/llvm/llvm-project/pull/94570
More information about the llvm-commits
mailing list