summaryrefslogtreecommitdiff
path: root/test/passes/dwarf_with_exceptions.cpp
diff options
context:
space:
mode:
authorYuta Saito <kateinoigakukun@gmail.com>2022-03-04 07:19:43 +0900
committerGitHub <noreply@github.com>2022-03-03 14:19:43 -0800
commit6247e7cd9be619d53c926975690981aa267917f9 (patch)
tree2d89bb1bc36659ba5a303703fc39bebedecfe349 /test/passes/dwarf_with_exceptions.cpp
parent0fe26e71ac1c5b22b990ea9b73131b49b1e9e22a (diff)
downloadbinaryen-6247e7cd9be619d53c926975690981aa267917f9.tar.gz
binaryen-6247e7cd9be619d53c926975690981aa267917f9.tar.bz2
binaryen-6247e7cd9be619d53c926975690981aa267917f9.zip
MergeSimilarFunctions optimization pass (#4414)
Merge similar functions that only differs constant values (like immediate operand of const and call insts) by parameterization. Performing this pass at post-link time can merge more functions across objects. Inspired by Swift compiler's optimization which is derived from LLVM's one: https://github.com/apple/swift/blob/main/lib/LLVMPasses/LLVMMergeFunctions.cpp https://github.com/llvm/llvm-project/blob/main/llvm/docs/MergeFunctions.rst The basic ideas here are constant value parameterization and direct callee parameterization by indirection. Constant value parameterization is like below: ;; Before (func $big-const-42 (result i32) [[many instr 1]] (i32.const 44) [[many instr 2]] ) (func $big-const-43 (result i32) [[many instr 1]] (i32.const 45) [[many instr 2]] ) ;; After (func $byn$mgfn-shared$big-const-42 (result i32) [[many instr 1]] (local.get $0) ;; parameterized!! [[many instr 2]] ) (func $big-const-42 (result i32) (call $byn$mgfn-shared$big-const-42 (i32.const 42) ) ) (func $big-const-43 (result i32) (call $byn$mgfn-shared$big-const-42 (i32.const 43) ) ) Direct callee parameterization is similar to the constant value parameterization, but it parameterizes callee function i by ref.func instead. Therefore it is enabled only when reference-types and typed-function-references features are enabled. I saw 1 ~ 2 % reduction for SwiftWasm binary and Ruby's wasm port using wasi-sdk, and 3 ~ 4.5% reduction for Unity WebGL binary when -Oz.
Diffstat (limited to 'test/passes/dwarf_with_exceptions.cpp')
0 files changed, 0 insertions, 0 deletions