[clang] Ensure NoTrapAfterNoreturn is false for the wasm backend (PR #65876)
Heejin Ahn via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 27 12:33:16 PDT 2023
================
@@ -1,33 +1,133 @@
-; RUN: llc < %s -asm-verbose=false -verify-machineinstrs | FileCheck %s
-; RUN: llc < %s -asm-verbose=false -fast-isel -fast-isel-abort=1 -verify-machineinstrs | FileCheck %s
-
-; Test that LLVM unreachable instruction and trap intrinsic are lowered to
-; wasm unreachable
+; RUN: llc < %s -verify-machineinstrs | FileCheck %s
+; RUN: llc < %s -fast-isel -fast-isel-abort=1 -verify-machineinstrs | FileCheck %s
+; RUN: llc < %s -verify-machineinstrs --trap-unreachable | FileCheck %s
+; RUN: llc < %s -fast-isel -fast-isel-abort=1 -verify-machineinstrs --trap-unreachable | FileCheck %s
+; RUN: llc < %s -verify-machineinstrs --trap-unreachable --no-trap-after-noreturn | FileCheck %s
+; RUN: llc < %s -fast-isel -fast-isel-abort=1 -verify-machineinstrs --trap-unreachable --no-trap-after-noreturn | FileCheck %s
target triple = "wasm32-unknown-unknown"
-declare void @llvm.trap()
-declare void @llvm.debugtrap()
-declare void @abort()
-; CHECK-LABEL: f1:
-; CHECK: call abort{{$}}
-; CHECK: unreachable
-define i32 @f1() {
- call void @abort()
- unreachable
-}
+; Test that the LLVM trap and debug trap intrinsics are lowered to
+; wasm unreachable.
+
+declare void @llvm.trap() cold noreturn nounwind
+declare void @llvm.debugtrap() nounwind
-; CHECK-LABEL: f2:
-; CHECK: unreachable
-define void @f2() {
+define void @trap_ret_void() {
+; CHECK-LABEL: trap_ret_void:
+; CHECK: .functype trap_ret_void () -> ()
+; CHECK-NEXT: # %bb.0:
+; CHECK-NEXT: unreachable
+; CHECK-NEXT: # fallthrough-return
+; CHECK-NEXT: end_function
call void @llvm.trap()
ret void
}
-; CHECK-LABEL: f3:
-; CHECK: unreachable
-define void @f3() {
+define void @dtrap_ret_void() {
+; CHECK-LABEL: dtrap_ret_void:
+; CHECK: .functype dtrap_ret_void () -> ()
----------------
aheejin wrote:
```suggestion
define void @debugtrap_ret_void() {
; CHECK-LABEL: debugtrap_ret_void:
; CHECK: .functype debugtrap_ret_void () -> ()
```
Nit: Not shortening it sounds clearer to me
https://github.com/llvm/llvm-project/pull/65876
More information about the cfe-commits
mailing list