diff options
author | Heejin Ahn <aheejin@gmail.com> | 2020-04-14 17:27:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-14 17:27:05 -0700 |
commit | e04d25e2e6cab2df0dfda5e4a206714a202313bc (patch) | |
tree | 295d25bc3b66ce02035ba4d8381e2ef36365d359 /test/passes/precompute_all-features.txt | |
parent | 359525bc5c04798e394a6e0a48c40fbfed7366db (diff) | |
download | binaryen-e04d25e2e6cab2df0dfda5e4a206714a202313bc.tar.gz binaryen-e04d25e2e6cab2df0dfda5e4a206714a202313bc.tar.bz2 binaryen-e04d25e2e6cab2df0dfda5e4a206714a202313bc.zip |
Fix reuse of constant nodes in Precompute (#2764)
Previously we tried to reuse `Const` node if a precomputed value is a
constant node. But now we have two more kinds of constant node
(`RefNull` and `RefFunc`), so we shouldn't reuse them interchangeably,
meaning we shouldn't try to reuse a `Const` node when the value at hand
is a `RefNull`. This correctly checks the type of node and tries to
reuse only if the types of nodes match.
Fixes #2759.
Diffstat (limited to 'test/passes/precompute_all-features.txt')
-rw-r--r-- | test/passes/precompute_all-features.txt | 50 |
1 files changed, 50 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) + ) + ) + ) ) |