blob: ebb97cc59e1ff0b92593bb4a22fb4c933cff0aa4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; RUN: foreach %s %t wasm-opt -all --gufa -S -o - | filecheck %s
(module
;; CHECK: (type $0 (func (param externref anyref)))
;; CHECK: (export "externals" (func $externals))
;; CHECK: (func $externals (type $0) (param $ext externref) (param $any anyref)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.cast (ref struct)
;; CHECK-NEXT: (any.convert_extern
;; CHECK-NEXT: (local.get $ext)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (extern.convert_any
;; CHECK-NEXT: (local.get $any)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $externals (export "externals") (param $ext externref) (param $any anyref)
;; We must not turn these into unreachable code, as the function is
;; exported.
(drop
(ref.cast (ref struct)
(any.convert_extern
(local.get $ext)
)
)
)
(drop
(extern.convert_any
(local.get $any)
)
)
)
;; CHECK: (func $non-exported (type $0) (param $ext externref) (param $any anyref)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block ;; (replaces unreachable RefCast we can't emit)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (any.convert_extern
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (extern.convert_any
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $non-exported (param $ext externref) (param $any anyref)
;; This is not exported, so the params are dead code, and can be turned
;; unreachable.
(drop
(ref.cast (ref struct)
(any.convert_extern
(local.get $ext)
)
)
)
(drop
(extern.convert_any
(local.get $any)
)
)
)
)
|