diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-10-10 10:11:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-10 10:11:31 -0700 |
commit | de9a8687baac9695807042d6ba4e7b47dd7c5fe9 (patch) | |
tree | 323c6bd656bf2143bcef857a9ddde11f60fcc8e2 /test | |
parent | 58d13aeef288d33fa6634e31985ae6c296d88edb (diff) | |
download | binaryen-de9a8687baac9695807042d6ba4e7b47dd7c5fe9.tar.gz binaryen-de9a8687baac9695807042d6ba4e7b47dd7c5fe9.tar.bz2 binaryen-de9a8687baac9695807042d6ba4e7b47dd7c5fe9.zip |
fix a dce fuzz bug where if changed to unreachable but didn't propagate that effect up. also add set_global support in dce (#1218)
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/dce.txt | 53 | ||||
-rw-r--r-- | test/passes/dce.wast | 26 |
2 files changed, 60 insertions, 19 deletions
diff --git a/test/passes/dce.txt b/test/passes/dce.txt index d93e1251b..ec5343986 100644 --- a/test/passes/dce.txt +++ b/test/passes/dce.txt @@ -444,28 +444,19 @@ ) ) (func $replace-with-unreachable-affects-parent (type $5) (param $var$0 f32) (param $var$1 i64) - (block $top - (drop - (f32.load offset=4 - (block (result i32) - (drop - (i64.const 0) - ) - (if - (block $block (result i32) - (call $replace-with-unreachable-affects-parent - (f32.const 1) - (i64.const -15917430362925035) - ) - (i32.const 1) - ) - (unreachable) - (unreachable) - ) - ) + (drop + (i64.const 0) + ) + (if + (block $block (result i32) + (call $replace-with-unreachable-affects-parent + (f32.const 1) + (i64.const -15917430362925035) ) + (i32.const 1) ) (unreachable) + (unreachable) ) ) (func $replace-block-changes-later-when-if-goes (type $1) @@ -488,3 +479,27 @@ (i32.const 0) ) ) +(module + (type $0 (func)) + (global $global (mut f64) (f64.const 0)) + (memory $0 0) + (func $0 (type $0) + (if + (i32.const 0) + (unreachable) + (unreachable) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $0 (type $0) + (local $local f64) + (if + (i32.const 0) + (unreachable) + (unreachable) + ) + ) +) diff --git a/test/passes/dce.wast b/test/passes/dce.wast index 7a4816196..acabf6ca5 100644 --- a/test/passes/dce.wast +++ b/test/passes/dce.wast @@ -708,3 +708,29 @@ (i32.const 0) ) ) +;; if goes to unreachable, need to propagate that up to the set_global +(module + (global $global (mut f64) (f64.const 0)) + (func $0 + (set_global $global + (if (result f64) + (i32.const 0) + (unreachable) + (unreachable) + ) + ) + ) +) +(module + (func $0 + (local $local f64) + (set_local $local + (if (result f64) + (i32.const 0) + (unreachable) + (unreachable) + ) + ) + ) +) + |