| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
| |
A pass that hoists repeating constants to a local, and replaces their uses with a get of that local. This can reduce binary size, but can also *increase* gzip size, so it's mostly for experimentation and not used by default.
|
| |
|
|
|
| |
Adds --safe-heap which instruments the code to check heap loads and stores for validity (null pointer derefs, within range of valid sbrk memory, and alignment). Used in SAFE_HEAP in emscripten.
|
|
|
|
|
|
|
| |
* Improve inlining pass to inline single-use functions that are fairly small, which makes it useful for removing unnecessary global constructors from clang.
* Add an inlining-optimizing pass that also optimizes where it inlined, as new opportunities arise. enable that it by default in O2+
* In addition, in -O3+ also inline small functions with multiple uses. This helps a lot with things like safe-int-divide functions (where each int divide is replaced by a safe divide that won't trap). Inlining gets rid of around half of the overhead there.
|
|
|
|
|
|
|
|
| |
* improve inlining pass to inline single-use functions that are fairly small, which makes it useful for removing unnecessary global constructors from clang. add an inlining-optimizing pass that also optimizes where it inlined, as new opportunities arise. enable that it by default in O2+
* fix a bug where we didn't run all passes properly - refactor addDefaultGlobalOptimizationPasses() into a pre and post version. we can only run the post version in incremental optimizing builds (functions appear one by one, we optimize them first, and do global stuff when all are done), but can run both when doing a full optimize
* copy in inlining, allowing multiple inlinings of the same function in the future
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds a pass that folds code, i.e. merges it when possible. See details in comment in the pass implementation cpp.
This is enabled by default in -Os and -Oz. Seems risky to enable anywhere else, as it does add branches - likely predictable ones so maybe no slowdown, but still some risk.
Code size numbers:
wasm-backend: 196331
+ binaryen -Os (before): 182598
+ binaryen -Os (with folding): 181943
asm2wasm -Os (before): 172463
asm2wasm -Os (with folding): 168774
So this reduces wasm-backend output by an additional 0.5% than it could before. Mainly this is because the wasm backend already has code folding, whereas on asm2wasm output, where we didn't have folding before, this saves over 2%. The 0.5% improvement on the wasm backend's output might be because this can fold more types of code than LLVM can (it can fold nested control flow, in particular).
|
| |
|
|
|
|
|
|
|
| |
* Add SSA pass which ensures a single assign for each local, except for merged locals where we ensure exactly a single assign from one of the paths leading to that use
* Also add InstrumentLocals pass, useful for debugging locals (similar to InstrumentMemory but for locals)
* Fix a PickLoadSigns bug with tees not being ignored, which was not noticed until now because we ran it on flatter output by default, but the ssa pass uncovered the bug
|
|
|
|
|
|
|
| |
* validate that types are properly finalized, when in pass-debug mode (BINARYEN_PASS_DEBUG env var): check after each pass is run that the type of each node is equal to the proper type (when finalizing it, i.e., fully recomputing the type).
* fix many fuzz bugs found by that.
* in particular, fix dce bugs with type changes not being fully updated during code removal. add a new TypeUpdater helper class that lets a pass update types efficiently, by the helper tracking deps between blocks and branches etc., and updating/propagating type changes only as necessary.
|
|
|
|
|
| |
This adds a pass that converts to a CFG, runs the relooper, and re-generates wasm from that. This depends on flatten-control-flow being run before.
The main goal here is to help code generators other than asm2wasm (which already receives relooped code from fastcomp).
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This pass flattens out control flow in order to achieve 2 properties:
* Control flow structures (block, loop, if) and control flow operations (br, br_if, br_table, return, unreachable) may only be block children, a loop body, or an if-true or if-false. (I.e., they cannot be nested inside an i32.add, a drop, a call, an if-condition, etc.)
* Disallow block, loop, and if return values, i.e., do not use control flow to pass around values.
As a result, expressions cannot contain control flow, and overall control flow is simpler, more structured, and more "flat".
This should make things like re-relooping wasm code much easier, as they can run after the cfg is flattened
|
|
|
|
|
|
|
|
| |
* Add pass to instrument loads / stores
* Simplify instrumentation.
* Document.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* add debugInfo option to passes, and use it to keep debug info alive through optimizations when we need it
* add fib testcase for debug info
* when preserving debug info, do not move code around call-imports, so debug info intrinsics remain stationary
* improve wasm-module-building handling of the single-threaded case: don't create workers, which is more efficient and also nicer for debugging
* process debug info in a more precise way, reordering it from being after the node (as it was a comment in JS) to before the node
* remove unreachable hack for debug info, which is no longer needed since we reorder them, and make sure to finalize blocks in which we reorder
|
| |
|
|
|
| |
Simple local common subexpression elimination. Useful mostly to reduce code size (as VMs do GVN etc.). Enabled by default in -Oz.
|
|
|
|
|
| |
* fix BINARYEN_PASS_DEBUG option
* Add isNested property to passRunner
|
| |
|
|
|
|
| |
PickLoadSigns pass
|
|
|
|
| |
TempRet0 if needed (otherwise we might remove it before we use it)
|
|
|
|
| |
before coalesce, so that coalesce can remove all copies, then do another pass of full simplification after it
|
| |
|
| |
|
| |
|
| |
|
|
|
| |
Push code forward, potentially letting it not execute
|
| |
|
|
|
|
| |
* add PassOptions structure, and use it for new -Os param to wasm-opt
|
| |
|
|
|
|
| |
coalesce-locals, making it much faster (#783)
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* support i64 intrinsics from fastcomp, adding --wasm-only flag
* refactor callImport logic in asm2wasm to avoid recomputing wasm types again
* legalize illegal i64 params in exports and imports
* do safe i64 binary ops depending on precision
* fix addVar, only assert on names if we are using a name
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
is not yet valid
then after finalizeCalls, we must autodrop again to drop things that finalizeCalls changed
|
| |
|
| |
|
| |
|
|\
| |
| | |
Explicit registering of passes
|
| |
| |
| |
| | |
due to linker dead code elimination. Fixes #577.
|
|/
|
|
| |
trouble with some new C++11 constructs. (#581)
|
| |
|
| |
|
| |
|
|
|
|
| |
efficient parallel execution (#564)
|