1 ; RUN: llc < %s -asm-verbose=false -verify-machineinstrs | FileCheck %s
3 ; Test lowering of __builtin_debugtrap in cases where lowering it via
4 ; the normal UNREACHABLE instruction would yield invalid
7 target triple = "wasm32"
9 declare void @llvm.debugtrap()
12 ; CHECK-NEXT: .functype foo (i32) -> ()
13 ; CHECK-NEXT: .LBB0_1:
15 ; CHECK-NEXT: unreachable
16 ; CHECK-NEXT: i32.const 0
18 ; CHECK-NEXT: end_loop
19 ; CHECK-NEXT: end_function
20 define void @foo(i32 %g) {
25 call void @llvm.debugtrap()
26 %exitcond = icmp eq i32 undef, %g
27 br i1 %exitcond, label %for.cond.cleanup, label %for.body
33 ; CHECK-LABEL: middle_of_block:
34 ; CHECK-NEXT: .functype middle_of_block (i32, i32) -> (i32)
35 ; CHECK-NEXT: unreachable
36 ; CHECK-NEXT: local.get 0
37 ; CHECK-NEXT: local.get 1
39 ; CHECK-NEXT: end_function
40 define i32 @middle_of_block(i32 %x, i32 %y) {
42 call void @llvm.debugtrap()
46 ; CHECK-LABEL: really_middle_of_block:
47 ; CHECK-NEXT: .functype really_middle_of_block () -> (i32)
48 ; CHECK-NEXT: call bar
50 ; CHECK-NEXT: unreachable
51 ; CHECK-NEXT: call bar
52 ; CHECK-NEXT: end_function
54 define i32 @really_middle_of_block() {
56 call void @llvm.debugtrap()