[llvm] [CodeGen] Do not emit TRAP for `unreachable` after `@llvm.trap` (PR #94570)
    Igor Kudrin via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sun Jun  9 15:42:20 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:
> Test noreturn/not-noreturn indirect call before unreachable?
In the update, I replaced `getCalledFunction()` with `getIntrinsicID()`, so this test is probably not needed.
https://github.com/llvm/llvm-project/pull/94570
    
    
More information about the llvm-commits
mailing list