From f5b8221e9759c37ef44158c2d2858dcee51b6c1f Mon Sep 17 00:00:00 2001 From: "Alon Zakai (kripken)" Date: Sat, 1 Dec 2018 18:32:32 -0800 Subject: Improve selectification in remove-unused-brs We turned an if into a select when optimizing for size (and if side effects etc. allow so). This patch improves that, doing it not just when optimizing for size, but also when it looks beneficial given the amount of work on both sides of the if. As a result we can create selects in -O3 etc. --- test/binaryen.js/optimize-levels.js.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/binaryen.js') diff --git a/test/binaryen.js/optimize-levels.js.txt b/test/binaryen.js/optimize-levels.js.txt index 8cb0dfea5..5381722c0 100644 --- a/test/binaryen.js/optimize-levels.js.txt +++ b/test/binaryen.js/optimize-levels.js.txt @@ -52,10 +52,10 @@ shrinkLevel=0 (type $i (func (param i32) (result i32))) (export "test" (func $test)) (func $test (; 0 ;) (type $i) (param $0 i32) (result i32) - (if (result i32) - (get_local $0) + (select (get_local $0) (i32.const 0) + (get_local $0) ) ) ) -- cgit v1.2.3