|
11 | 11 | (type $desc (describes $struct) (struct)) |
12 | 12 | ) |
13 | 13 |
|
14 | | - ;; CHECK: (func $test (type $2) (param $ref (ref null $struct)) (result (ref $struct)) |
| 14 | + ;; CHECK: (type $none (func)) |
| 15 | + (type $none (func)) |
| 16 | + |
| 17 | + ;; CHECK: (tag $tag (type $none)) |
| 18 | + (tag $tag (type $none)) |
| 19 | + |
| 20 | + ;; CHECK: (func $test (type $3) (param $ref (ref null $struct)) (result (ref $struct)) |
15 | 21 | ;; CHECK-NEXT: (local $temp (ref $desc)) |
16 | 22 | ;; CHECK-NEXT: (block $block (result (ref none)) |
17 | 23 | ;; CHECK-NEXT: (drop |
|
49 | 55 | (unreachable) |
50 | 56 | ) |
51 | 57 | ) |
| 58 | + |
| 59 | + ;; CHECK: (func $br_on_cast_desc_eq_in_block (type $4) (result (ref $struct)) |
| 60 | + ;; CHECK-NEXT: (local $0 (ref null $desc)) |
| 61 | + ;; CHECK-NEXT: (local $1 i32) |
| 62 | + ;; CHECK-NEXT: (block $out (result (ref $struct)) |
| 63 | + ;; CHECK-NEXT: (if |
| 64 | + ;; CHECK-NEXT: (i32.const 0) |
| 65 | + ;; CHECK-NEXT: (then |
| 66 | + ;; CHECK-NEXT: (block $block |
| 67 | + ;; CHECK-NEXT: (drop |
| 68 | + ;; CHECK-NEXT: (block (result i32) |
| 69 | + ;; CHECK-NEXT: (drop |
| 70 | + ;; CHECK-NEXT: (br_on_cast_desc_eq_fail $out (ref (exact $struct)) (ref $struct) |
| 71 | + ;; CHECK-NEXT: (struct.new_default_desc $struct |
| 72 | + ;; CHECK-NEXT: (ref.null none) |
| 73 | + ;; CHECK-NEXT: ) |
| 74 | + ;; CHECK-NEXT: (try_table (result (ref $desc)) (catch $tag $block) |
| 75 | + ;; CHECK-NEXT: (ref.as_non_null |
| 76 | + ;; CHECK-NEXT: (local.get $0) |
| 77 | + ;; CHECK-NEXT: ) |
| 78 | + ;; CHECK-NEXT: ) |
| 79 | + ;; CHECK-NEXT: ) |
| 80 | + ;; CHECK-NEXT: ) |
| 81 | + ;; CHECK-NEXT: (i32.const 0) |
| 82 | + ;; CHECK-NEXT: ) |
| 83 | + ;; CHECK-NEXT: ) |
| 84 | + ;; CHECK-NEXT: ) |
| 85 | + ;; CHECK-NEXT: ) |
| 86 | + ;; CHECK-NEXT: ) |
| 87 | + ;; CHECK-NEXT: (unreachable) |
| 88 | + ;; CHECK-NEXT: ) |
| 89 | + ;; CHECK-NEXT: ) |
| 90 | + (func $br_on_cast_desc_eq_in_block (result (ref $struct)) |
| 91 | + (local $0 (ref null $desc)) |
| 92 | + (local $1 i32) |
| 93 | + ;; While simplifying locals here, we must be aware that the br_on |
| 94 | + ;; instruction has a descriptor, and must visit it. If we do not, then we'd |
| 95 | + ;; see no branches to $block, and move the tee out of it, breaking |
| 96 | + ;; validation. |
| 97 | + (block $out (result (ref $struct)) |
| 98 | + (if |
| 99 | + (i32.const 0) |
| 100 | + (then |
| 101 | + (block $block |
| 102 | + (drop |
| 103 | + (local.tee $1 |
| 104 | + (block (result i32) |
| 105 | + (drop |
| 106 | + (br_on_cast_desc_eq_fail $out (ref (exact $struct)) (ref $struct) |
| 107 | + (struct.new_default_desc $struct |
| 108 | + (ref.null none) |
| 109 | + ) |
| 110 | + (try_table (result (ref $desc)) (catch $tag $block) |
| 111 | + (ref.as_non_null |
| 112 | + (local.get $0) |
| 113 | + ) |
| 114 | + ) |
| 115 | + ) |
| 116 | + ) |
| 117 | + (i32.const 0) |
| 118 | + ) |
| 119 | + ) |
| 120 | + ) |
| 121 | + ) |
| 122 | + ) |
| 123 | + ) |
| 124 | + (unreachable) |
| 125 | + ) |
| 126 | + ) |
52 | 127 | ) |
53 | 128 |
|
0 commit comments