forked from WebAssembly/binaryen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgufa-multibyte.wast
More file actions
61 lines (52 loc) · 1.58 KB
/
gufa-multibyte.wast
File metadata and controls
61 lines (52 loc) · 1.58 KB
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
;; 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 --closed-world -S -o - | filecheck %s
(module
;; CHECK: (type $0 (func))
;; CHECK: (type $array (array (mut i8)))
(type $array (array (mut i8)))
;; CHECK: (export "test" (func $test))
;; CHECK: (func $test (type $0)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (i64.load32_u (type $array)
;; CHECK-NEXT: (array.new_default $array
;; CHECK-NEXT: (i32.const 69)
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test (export "test")
;; We initialize with i8s, and read an i64. That should not confuse us, and
;; we do not optimize here (though we could, in theory, if we tracked the
;; bytes and saw the i64 must be 0).
(drop
(i64.load32_u (type $array)
(array.new_default $array
(i32.const 69)
)
(i32.const 0)
)
)
)
)
(module
;; CHECK: (type $array (array (mut i8)))
(type $array (array (mut i8)))
;; CHECK: (type $1 (func (param (ref $array))))
;; CHECK: (export "test" (func $test))
;; CHECK: (func $test (type $1) (param $array (ref $array))
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test (export "test") (param $array (ref $array))
;; As above, but now no $array is ever created (and we are in closed world).
;; We can optimize this to trap.
(drop
(i64.load32_u (type $array)
(local.get $array)
(i32.const 0)
)
)
)
)