blob: 7230cfa22bd92c74e6aa1ab99b0267506e8c154e (
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
74
75
76
77
78
79
80
81
82
83
|
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
;; RUN: wasm-opt %s --coalesce-locals -all -S -o - | filecheck %s
(module
;; CHECK: (func $nn-locals (type $0) (param $0 (ref any))
;; CHECK-NEXT: (local $1 (tuple (ref any) (ref any)))
;; CHECK-NEXT: (local $2 (tuple (ref any) (ref any)))
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (tuple.make 2
;; CHECK-NEXT: (local.get $0)
;; CHECK-NEXT: (local.get $0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (tuple.make 2
;; CHECK-NEXT: (local.get $0)
;; CHECK-NEXT: (local.get $0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $nn-locals
;; CHECK-NEXT: (tuple.extract 2 0
;; CHECK-NEXT: (local.get $1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $nn-locals
;; CHECK-NEXT: (tuple.extract 2 0
;; CHECK-NEXT: (local.get $2)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $nn-locals
;; CHECK-NEXT: (tuple.extract 2 1
;; CHECK-NEXT: (local.get $1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $nn-locals
;; CHECK-NEXT: (tuple.extract 2 1
;; CHECK-NEXT: (local.get $2)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $nn-locals (param $any (ref any))
;; When computing interferences, coalesce locals should not error on tuples
;; that contain non-nullable locals.
(local $x (tuple (ref any) (ref any)))
(local $y (tuple (ref any) (ref any)))
;; Set values into the tuple locals and use them.
;; Note that while the values are the same, we do not optimize them because
;; of current limitations on tuple handling in this pass, so we are mainly
;; testing for not crashing here.
(local.set $x
(tuple.make 2
(local.get $any)
(local.get $any)
)
)
(local.set $y
(tuple.make 2
(local.get $any)
(local.get $any)
)
)
(call $nn-locals
(tuple.extract 2 0
(local.get $x)
)
)
(call $nn-locals
(tuple.extract 2 0
(local.get $y)
)
)
(call $nn-locals
(tuple.extract 2 1
(local.get $x)
)
)
(call $nn-locals
(tuple.extract 2 1
(local.get $y)
)
)
)
)
|