1# RUN: llc -mtriple=wasm32-unknown-unknown -exception-model=wasm -mattr=+exception-handling -run-pass wasm-cfg-sort -run-pass wasm-cfg-stackify %s -o - | FileCheck %s
2
3--- |
4  target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
5  target triple = "wasm32-unknown-unknown"
6
7  declare i32 @__gxx_wasm_personality_v0(...)
8  declare void @foo()
9  define void @function_property_test() {
10    ret void
11  }
12  define void @wasm_eh_info_test() personality i8* bitcast (i32 (...)* @__gxx_wasm_personality_v0 to i8*) {
13    ret void
14  }
15...
16
17# CHECK-LABEL: name: function_property_test
18# CHECK: machineFunctionInfo:
19# CHECK:   isCFGStackified:   true
20name: function_property_test
21liveins:
22  - { reg: '$arguments' }
23body: |
24  bb.0:
25    RETURN implicit-def dead $arguments
26...
27
28---
29# CHECK-LABEL: name: wasm_eh_info_test
30# CHECK: machineFunctionInfo:
31name: wasm_eh_info_test
32liveins:
33  - { reg: '$arguments' }
34# CHECK:  wasmEHFuncInfo:
35# bb.2 becomes bb.1 and bb.3 becomes bb.2 after CFGSort.
36# CHECK-NEXT:    1:               2
37machineFunctionInfo:
38  wasmEHFuncInfo:
39    2:               3
40body:             |
41  bb.0:
42    successors: %bb.1, %bb.2
43    CALL @foo, implicit-def dead $arguments, implicit $sp32, implicit $sp64, implicit-def dead $arguments, implicit $sp32, implicit $sp64
44
45  bb.1:
46    RETURN implicit-def dead $arguments
47
48  bb.2 (landing-pad):
49    successors: %bb.1, %bb.3
50    %0:i32 = CATCH &__cpp_exception, implicit-def dead $arguments
51    CALL @foo, implicit-def dead $arguments, implicit $sp32, implicit $sp64, implicit-def dead $arguments, implicit $sp32, implicit $sp64
52    BR %bb.1, implicit-def $arguments
53
54  bb.3 (landing-pad):
55    CATCH_ALL implicit-def $arguments
56    RETHROW 0, implicit-def $arguments
57...
58