diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/precompute_all-features.txt | 50 | ||||
-rw-r--r-- | test/passes/precompute_all-features.wast | 73 |
2 files changed, 123 insertions, 0 deletions
diff --git a/test/passes/precompute_all-features.txt b/test/passes/precompute_all-features.txt index 9a6fea94b..34c9554dd 100644 --- a/test/passes/precompute_all-features.txt +++ b/test/passes/precompute_all-features.txt @@ -261,4 +261,54 @@ (func $reftype-test (result nullref) (ref.null) ) + (func $dummy + (nop) + ) + (func $br_reuse_node + (drop + (block $l0 (result f32) + (drop + (block $l1 + (global.set $global-mut + (i32.const 1) + ) + (br $l0 + (f32.const 3.5) + ) + ) + ) + (f32.const 0) + ) + ) + (drop + (block $l2 (result nullref) + (drop + (block $l3 + (global.set $global-mut + (i32.const 1) + ) + (br $l2 + (ref.null) + ) + ) + ) + (ref.null) + ) + ) + (drop + (block $l4 (result funcref) + (drop + (block $l5 + (global.set $global-mut + (i32.const 1) + ) + (br $l4 + (ref.func $dummy) + ) + ) + ) + (ref.null) + ) + ) + ) ) diff --git a/test/passes/precompute_all-features.wast b/test/passes/precompute_all-features.wast index da755bde6..2a59ea290 100644 --- a/test/passes/precompute_all-features.wast +++ b/test/passes/precompute_all-features.wast @@ -381,4 +381,77 @@ (func $reftype-test (result nullref) (ref.null) ) + + ;; Check if constant nodes (const, ref.null, and ref.func) are correctly + ;; reused. (We shouldn't reuse a const node for something like ref.null, which + ;; will incorrectly cause an expression like 'nullref.const'.) + (func $dummy) + (func $br_reuse_node + (drop + (block $l0 (result f32) + (drop + (block $l1 (result i32) + (global.set $global-mut + (i32.const 1) + ) + (br_if $l1 + (i32.const 1) + (f32.lt + (br_if $l0 + (f32.const 3.5) + (i32.const 1) + ) + (f32.const 3) + ) + ) + ) + ) + (f32.const 0) + ) + ) + + (drop + (block $l2 (result nullref) + (drop + (block $l3 (result i32) + (global.set $global-mut + (i32.const 1) + ) + (br_if $l3 + (i32.const 1) + (ref.is_null + (br_if $l2 + (ref.null) + (i32.const 3) + ) + ) + ) + ) + ) + (ref.null) + ) + ) + + (drop + (block $l4 (result funcref) + (drop + (block $l5 (result i32) + (global.set $global-mut + (i32.const 1) + ) + (br_if $l5 + (i32.const 1) + (ref.is_null + (br_if $l4 + (ref.func $dummy) + (i32.const 3) + ) + ) + ) + ) + ) + (ref.null) + ) + ) + ) ) |