diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-04-10 10:44:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-10 10:44:07 -0700 |
commit | df19ebde22c48fba43f88c71c4870f53b8974f93 (patch) | |
tree | c9e44c9d05045954c082fabd5eaf4f4d465e7aa7 /test/debugInfo.fromasm.imprecise | |
parent | 27517701d611ad7de5b467eaee2f0d589180465f (diff) | |
download | binaryen-df19ebde22c48fba43f88c71c4870f53b8974f93.tar.gz binaryen-df19ebde22c48fba43f88c71c4870f53b8974f93.tar.bz2 binaryen-df19ebde22c48fba43f88c71c4870f53b8974f93.zip |
br_table optimizations (#1502)
Inspired by #1501
* remove unneeded appearances of the default switch target (at the front or back of the list of targets)
* optimize a switch with 0, 1 or 2 targets into an if or if-chain
* optimize a br_if br pair when they have the same target
Makes e.g. fastcomp libc++ 2% smaller. Noticeable improvements on other things like box2d etc.
Diffstat (limited to 'test/debugInfo.fromasm.imprecise')
-rw-r--r-- | test/debugInfo.fromasm.imprecise | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/test/debugInfo.fromasm.imprecise b/test/debugInfo.fromasm.imprecise index 4b268f068..e75f6c668 100644 --- a/test/debugInfo.fromasm.imprecise +++ b/test/debugInfo.fromasm.imprecise @@ -125,30 +125,24 @@ (i32.const 1369188723) ) (block $switch (result i32) - (block $switch-default - (block $switch-case - (br_table $switch-case $switch-default - (i32.sub - (get_local $1) - (i32.const -1108210269) - ) + (br_if $__rjti$0 + (i32.eqz + (i32.sub + (get_local $1) + (i32.const -1108210269) ) ) - (br $__rjti$0) ) (i32.const 0) ) (block $switch0 (result i32) - (block $switch-default2 - (block $switch-case1 - (br_table $switch-case1 $switch-default2 - (i32.sub - (get_local $1) - (i32.const 1369188723) - ) + (br_if $__rjti$0 + (i32.eqz + (i32.sub + (get_local $1) + (i32.const 1369188723) ) ) - (br $__rjti$0) ) (i32.const 0) ) |