summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-11-27 09:26:12 -0800
committerGitHub <noreply@github.com>2018-11-27 09:26:12 -0800
commit69c93dd9fb4cf8081237c4303a416bf12dff6b58 (patch)
treebb3b14ce0a12c39a88be81dbd67395c8e2e89201 /test
parent1fc71f608c5ac60fa93edaa239803f34dc3e8a8b (diff)
downloadbinaryen-69c93dd9fb4cf8081237c4303a416bf12dff6b58.tar.gz
binaryen-69c93dd9fb4cf8081237c4303a416bf12dff6b58.tar.bz2
binaryen-69c93dd9fb4cf8081237c4303a416bf12dff6b58.zip
ReFinalize fuzz fix (#1771)
If we refinalize after adding a value that flows out of a block, we need to fix up any branches that might exist without a value, which is possible if the branches were not taken in practice Also refactor ReFinalize into a separate file.
Diffstat (limited to 'test')
-rw-r--r--test/passes/remove-unused-brs.txt23
-rw-r--r--test/passes/remove-unused-brs.wast22
2 files changed, 45 insertions, 0 deletions
diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt
index a44a62c20..774110e23 100644
--- a/test/passes/remove-unused-brs.txt
+++ b/test/passes/remove-unused-brs.txt
@@ -2208,4 +2208,27 @@
(br $label$1)
)
)
+ (func $refinalize-need-br-value (; 101 ;) (type $2) (result i32)
+ (loop $label$3 (result i32)
+ (block $label$6 (result i32)
+ (block $label$10 (result i32)
+ (unreachable)
+ (block $label$503 (result i32)
+ (br_if $label$3
+ (block $label$530 (result i32)
+ (block
+ (unreachable)
+ (drop
+ (i32.const 0)
+ )
+ )
+ (i32.const 0)
+ )
+ )
+ (i32.const 127)
+ )
+ )
+ )
+ )
+ )
)
diff --git a/test/passes/remove-unused-brs.wast b/test/passes/remove-unused-brs.wast
index 7a1943c14..d1afba4a5 100644
--- a/test/passes/remove-unused-brs.wast
+++ b/test/passes/remove-unused-brs.wast
@@ -1815,5 +1815,27 @@
(br $label$1)
)
)
+ (func $refinalize-need-br-value (result i32)
+ (loop $label$3 (result i32)
+ (block $label$6 (result i32)
+ (block $label$10
+ (unreachable)
+ (block $label$503 ;; this block will get a value flowing out
+ (br_if $label$3
+ (block $label$530 (result i32)
+ (br_if $label$503 ;; while this br does not send a value
+ (i32.const 0)
+ )
+ (i32.const 0)
+ )
+ )
+ (return
+ (i32.const 127)
+ )
+ )
+ )
+ )
+ )
+ )
)