diff options
author | Alon Zakai <azakai@google.com> | 2020-10-09 19:51:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-09 19:51:22 -0700 |
commit | caf624d0b1b81cf93cfb66dfdb50f49c5cc51578 (patch) | |
tree | cdb61ee8ddd3f6008e30ccd2c0f700aa421d9afb /test | |
parent | 399cb3df1e2e053fc601ed77744d41fe2378e54c (diff) | |
download | binaryen-caf624d0b1b81cf93cfb66dfdb50f49c5cc51578.tar.gz binaryen-caf624d0b1b81cf93cfb66dfdb50f49c5cc51578.tar.bz2 binaryen-caf624d0b1b81cf93cfb66dfdb50f49c5cc51578.zip |
RemoveUnusedBrs fuzz fix for switches with a single target and with a value (#3220)
We turn a br_table with a single target into a br, but we reverse the order of the
condition and the value when doing so, which we forgot to take into account.
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/remove-unused-brs_enable-multivalue.txt | 22 | ||||
-rw-r--r-- | test/passes/remove-unused-brs_enable-multivalue.wast | 22 |
2 files changed, 44 insertions, 0 deletions
diff --git a/test/passes/remove-unused-brs_enable-multivalue.txt b/test/passes/remove-unused-brs_enable-multivalue.txt index ee980b523..6cbfe2373 100644 --- a/test/passes/remove-unused-brs_enable-multivalue.txt +++ b/test/passes/remove-unused-brs_enable-multivalue.txt @@ -2502,4 +2502,26 @@ ) ) ) + (func $unswitch-reordering (param $x i32) (result i32) + (block $label$1 (result i32) + (br_table $label$1 + (block $label$2 (result i32) + (i32.store + (i32.const 1) + (i32.const 2) + ) + (i32.const 3) + ) + (block $block (result i32) + (if + (local.get $x) + (return + (i32.const 5) + ) + ) + (i32.const 6) + ) + ) + ) + ) ) diff --git a/test/passes/remove-unused-brs_enable-multivalue.wast b/test/passes/remove-unused-brs_enable-multivalue.wast index b37b75776..ceefefa40 100644 --- a/test/passes/remove-unused-brs_enable-multivalue.wast +++ b/test/passes/remove-unused-brs_enable-multivalue.wast @@ -2106,4 +2106,26 @@ ) ) ) + (func $unswitch-reordering (param $x i32) (result i32) + (block $label$1 (result i32) + (br_table $label$1 + (block $label$2 (result i32) + (i32.store ;; has a possible side effect + (i32.const 1) + (i32.const 2) + ) + (i32.const 3) + ) + (block (result i32) + (if + (local.get $x) + (return + (i32.const 5) + ) + ) + (i32.const 6) + ) + ) + ) + ) ) |