summaryrefslogtreecommitdiff
path: root/test/passes/optimize-instructions_all-features.wast
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2020-09-13 06:11:17 +0200
committerGitHub <noreply@github.com>2020-09-13 06:11:17 +0200
commit643facd9bf6af1792db473e73e16983df940106f (patch)
tree5e02e09c480509847b6ba24a9f84855b6b9fb337 /test/passes/optimize-instructions_all-features.wast
parent0c53fb5d84afe32bfdf13231908aad760cb1d89d (diff)
downloadbinaryen-643facd9bf6af1792db473e73e16983df940106f.tar.gz
binaryen-643facd9bf6af1792db473e73e16983df940106f.tar.bz2
binaryen-643facd9bf6af1792db473e73e16983df940106f.zip
Fix RefNull issues (#3123)
* ExpressionAnalyzer: Fix `ref.null ht` equality check to include `ht`. * Precompute: Fix `ref.null ht` expression reuse to also update `ht`. * Fuzzing: Fix `ref.null func` becoming canonicalized to `ref.func $funcref` when evaluating execution results, by adding a check for `isNull`. * Fuzzing: Print actual and expected execution results when aborting. * Tests: Update `if-arms-subtype` test in `optimize-instructions` to check that identical `if` arms become folded while not identical arms are kept.
Diffstat (limited to 'test/passes/optimize-instructions_all-features.wast')
-rw-r--r--test/passes/optimize-instructions_all-features.wast13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/passes/optimize-instructions_all-features.wast b/test/passes/optimize-instructions_all-features.wast
index 6e106ad1b..c2fa16e35 100644
--- a/test/passes/optimize-instructions_all-features.wast
+++ b/test/passes/optimize-instructions_all-features.wast
@@ -4207,8 +4207,17 @@
(unreachable)
)
)
- ;; Tests when if arms are subtype of if's type
- (func $if-arms-subtype (result anyref)
+ ;; These functions test if an `if` with subtyped arms is correctly folded
+ ;; 1. if its `ifTrue` and `ifFalse` arms are identical (can fold)
+ (func $if-arms-subtype-fold (result anyref)
+ (if (result anyref)
+ (i32.const 0)
+ (ref.null extern)
+ (ref.null extern)
+ )
+ )
+ ;; 2. if its `ifTrue` and `ifFalse` arms are not identical (cannot fold)
+ (func $if-arms-subtype-nofold (result anyref)
(if (result anyref)
(i32.const 0)
(ref.null extern)