From d0863fa49acc642353c99aa9c46a1aacc4be57d0 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 7 Jan 2016 16:22:46 -0800 Subject: optimize RemoveUnusedBrs some more - handle values #84 --- test/passes/remove-unused-brs.txt | 122 +++++++++++++++++++++++++++++++++++-- test/passes/remove-unused-brs.wast | 44 +++++++++++++ 2 files changed, 162 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt index b42347fc3..af5b9d1ed 100644 --- a/test/passes/remove-unused-brs.txt +++ b/test/passes/remove-unused-brs.txt @@ -44,6 +44,65 @@ ) ) ) + (func $b6 (param $i1 i32) + (block $topmost + (br_if + (i32.const 1) + $topmost + ) + ) + ) + (func $b7 (param $i1 i32) + (block $topmost + (br_if + (i32.const 1) + $topmost + (i32.const 0) + ) + ) + ) + (func $b8 (param $i1 i32) + (block $topmost + (block $inner + (br_if + (i32.const 1) + $topmost + ) + ) + ) + ) + (func $b9 (param $i1 i32) + (block $topmost + (block $inner + (br_if + (i32.const 1) + $inner + ) + ) + ) + ) + (func $b10 (param $i1 i32) + (block $topmost + (block $inner + (br_if + (i32.const 1) + $topmost + (i32.const 0) + ) + ) + ) + ) + (func $b11 (param $i1 i32) + (block $topmost + (block $inner + (br_if + (i32.const 1) + $inner + (i32.const 0) + ) + ) + ) + ) ) (module (memory 16777216 16777216) @@ -53,9 +112,7 @@ ) (func $b1 (param $i1 i32) (block $topmost - (br $topmost - (i32.const 0) - ) + (i32.const 0) ) ) (func $b2 (param $i1 i32) @@ -83,7 +140,64 @@ (func $b5 (param $i1 i32) (block $topmost (block $inner - (br $inner + (i32.const 0) + ) + ) + ) + (func $b6 (param $i1 i32) + (block $topmost + (br_if + (i32.const 1) + $topmost + ) + ) + ) + (func $b7 (param $i1 i32) + (block $topmost + (br_if + (i32.const 1) + $topmost + (i32.const 0) + ) + ) + ) + (func $b8 (param $i1 i32) + (block $topmost + (block $inner + (br_if + (i32.const 1) + $topmost + ) + ) + ) + ) + (func $b9 (param $i1 i32) + (block $topmost + (block $inner + (br_if + (i32.const 1) + $inner + ) + ) + ) + ) + (func $b10 (param $i1 i32) + (block $topmost + (block $inner + (br_if + (i32.const 1) + $topmost + (i32.const 0) + ) + ) + ) + ) + (func $b11 (param $i1 i32) + (block $topmost + (block $inner + (br_if + (i32.const 1) + $inner (i32.const 0) ) ) diff --git a/test/passes/remove-unused-brs.wast b/test/passes/remove-unused-brs.wast index e03ba8847..b4a2cc5fe 100644 --- a/test/passes/remove-unused-brs.wast +++ b/test/passes/remove-unused-brs.wast @@ -44,5 +44,49 @@ ) ) ) + (func $b6 (param $i1 i32) + (block $topmost + (br_if (i32.const 1) $topmost) + ) + ) + (func $b7 (param $i1 i32) + (block $topmost + (br_if (i32.const 1) $topmost + (i32.const 0) + ) + ) + ) + (func $b8 (param $i1 i32) + (block $topmost + (block $inner + (br_if (i32.const 1) $topmost) + ) + ) + ) + (func $b9 (param $i1 i32) + (block $topmost + (block $inner + (br_if (i32.const 1) $inner) + ) + ) + ) + (func $b10 (param $i1 i32) + (block $topmost + (block $inner + (br_if (i32.const 1) $topmost + (i32.const 0) + ) + ) + ) + ) + (func $b11 (param $i1 i32) + (block $topmost + (block $inner + (br_if (i32.const 1) $inner + (i32.const 0) + ) + ) + ) + ) ) -- cgit v1.2.3