Utilize Binaryen's -O4

When specifying -O3 or -Oz, asc now automatically increases the optimize level to 4, then including costly non-LLVM optimizations for blocky code, in turn achieving similar results as an LLVM-based generator.
This commit is contained in:
dcodeIO
2018-06-09 14:05:33 +02:00
parent e9094bbd6f
commit c6ec5e2832
46 changed files with 14240 additions and 16223 deletions

View File

@ -13,27 +13,27 @@
(block $case2|0
(if
(i32.ne
(tee_local $1
(get_local $0)
)
(get_local $0)
(i32.const 1)
)
(block
(br_if $case2|0
(i32.eqz
(get_local $1)
(tee_local $1
(get_local $0)
)
)
)
(br_if $case4|0
(i32.or
(i32.eq
(get_local $1)
(i32.const 2)
)
(i32.eq
(get_local $1)
(i32.const 3)
)
(i32.eq
(get_local $1)
(i32.const 2)
)
)
(br_if $case4|0
(i32.eq
(get_local $1)
(i32.const 3)
)
)
(br $case2|0)
@ -55,22 +55,22 @@
(block $case2|0
(if
(i32.ne
(tee_local $1
(get_local $0)
)
(get_local $0)
(i32.const 1)
)
(block
(br_if $case2|0
(i32.or
(i32.eq
(get_local $1)
(i32.const 2)
)
(i32.eq
(get_local $1)
(i32.const 3)
(i32.eq
(tee_local $1
(get_local $0)
)
(i32.const 2)
)
)
(br_if $case2|0
(i32.eq
(get_local $1)
(i32.const 3)
)
)
(br $break|0)
@ -87,6 +87,36 @@
(i32.const 0)
)
(func $switch/doSwitchBreakCase (; 3 ;) (type $ii) (param $0 i32) (result i32)
(block $break|0
(br_if $break|0
(i32.eq
(get_local $0)
(i32.const 1)
)
)
(return
(i32.const 2)
)
)
(i32.const 1)
)
(func $switch/doSwitchBreakDefault (; 4 ;) (type $ii) (param $0 i32) (result i32)
(block $break|0
(block $case1|0
(br_if $break|0
(i32.ne
(get_local $0)
(i32.const 1)
)
)
(return
(i32.const 1)
)
)
)
(i32.const 2)
)
(func $switch/doSwitchFallThroughCase (; 5 ;) (type $ii) (param $0 i32) (result i32)
(if
(i32.ne
(get_local $0)
@ -98,7 +128,7 @@
)
(i32.const 1)
)
(func $switch/doSwitchBreakDefault (; 4 ;) (type $ii) (param $0 i32) (result i32)
(func $switch/doSwitchFallThroughDefault (; 6 ;) (type $ii) (param $0 i32) (result i32)
(if
(i32.eq
(get_local $0)
@ -110,10 +140,10 @@
)
(i32.const 2)
)
(func $switch/doSwitchEmpty (; 5 ;) (type $ii) (param $0 i32) (result i32)
(func $switch/doSwitchEmpty (; 7 ;) (type $ii) (param $0 i32) (result i32)
(i32.const 2)
)
(func $start (; 6 ;) (type $v)
(func $start (; 8 ;) (type $v)
(if
(call $switch/doSwitch
(i32.const 0)
@ -455,7 +485,7 @@
)
(if
(i32.ne
(call $switch/doSwitchBreakCase
(call $switch/doSwitchFallThroughCase
(i32.const 0)
)
(i32.const 2)
@ -472,7 +502,7 @@
)
(if
(i32.ne
(call $switch/doSwitchBreakCase
(call $switch/doSwitchFallThroughCase
(i32.const 1)
)
(i32.const 1)
@ -489,7 +519,7 @@
)
(if
(i32.ne
(call $switch/doSwitchBreakCase
(call $switch/doSwitchFallThroughCase
(i32.const 2)
)
(i32.const 2)
@ -506,7 +536,7 @@
)
(if
(i32.ne
(call $switch/doSwitchBreakDefault
(call $switch/doSwitchFallThroughDefault
(i32.const 0)
)
(i32.const 2)
@ -523,7 +553,7 @@
)
(if
(i32.ne
(call $switch/doSwitchBreakDefault
(call $switch/doSwitchFallThroughDefault
(i32.const 1)
)
(i32.const 1)
@ -540,7 +570,7 @@
)
(if
(i32.ne
(call $switch/doSwitchBreakDefault
(call $switch/doSwitchFallThroughDefault
(i32.const 2)
)
(i32.const 2)