================ @@ -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 () -> () +; CHECK-NEXT: # %bb.0: +; CHECK-NEXT: unreachable +; CHECK-NEXT: # fallthrough-return +; CHECK-NEXT: end_function call void @llvm.debugtrap() ret void } + +; LLVM trap followed by LLVM unreachable could become exactly one +; wasm unreachable, but two are emitted currently. ---------------- aheejin wrote:
```suggestion ; LLVM trap followed by LLVM unreachable could become exactly one wasm ; unreachable, but two are emitted currently. ``` https://github.com/llvm/llvm-project/pull/65876 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits