1 # RUN: llc -mtriple=wasm32-unknown-unknown -exception-model=wasm -mattr=+exception-handling -run-pass wasm-late-eh-prepare -run-pass wasm-cfg-stackify %s -o - | FileCheck %s
3 # This tests 'try' and 'catch' instructions are correctly placed with respect to
4 # EH_LABEL instructions.
6 target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
7 target triple = "wasm32-unknown-unknown"
9 declare i32 @__gxx_wasm_personality_v0(...)
11 define void @eh_label_test() personality i8* bitcast (i32 (...)* @__gxx_wasm_personality_v0 to i8*) {
17 # CHECK-LABEL: eh_label_test
20 - { reg: '$arguments' }
23 ; TRY should be before EH_LABEL wrappers of throwing calls
25 ; CHECK-NEXT: EH_LABEL
26 ; CHECK-NEXT: CALL_VOID @foo
27 ; CHECK-NEXT: EH_LABEL
28 successors: %bb.1, %bb.2
29 EH_LABEL <mcsymbol .Ltmp0>
30 CALL_VOID @foo, implicit-def dead $arguments, implicit $sp32, implicit $sp64
31 EH_LABEL <mcsymbol .Ltmp1>
36 ; CATCH should be after an EH_LABEL at the beginning of an EH pad
39 EH_LABEL <mcsymbol .Ltmp2>
40 dead %0:i32 = EXTRACT_EXCEPTION_I32 implicit-def dead $arguments
41 CATCHRET %bb.2, %bb.0, implicit-def dead $arguments
44 ; predecessors: %bb.0, %bb.1
45 RETURN_VOID implicit-def dead $arguments