Grand Unified Flow Analysis (GUFA) by kripken · Pull Request #4598 · WebAssembly/binaryen (original) (raw)
This is far from ready for review, but @tlively was curious to see the current status, so posting.
This tracks the possible contents in the entire program all at once using a single IR. That is in contrast to say DeadArgumentElimination of LocalRefining etc., all of whom look at one particular aspect of the program (function params and returns in DAE, locals in LocalRefining). The cost is to build up an entire new IR, which takes a lot of code - ~2000 lines atm, but should be close to done. At least all that code is separable from everything else and could fit entirely in the new pass. Another cost is this new IR is very big and requires a lot of time and memory to process. The benefit is that this can find opportunities that are only obvious when looking at the entire program, and also it can track information that is more specialized than the normal type system in the IR - in particular, this can track an ExactType, which is the case where we know the value is of a particular type exactly and not a subtype. Both may end up useful, but it's too early to tell.
This passes fuzzing (but we don't fuzz --nominal
well atm, so that is somewhat limited) and a large amount of new tests, but removes too much code in dart2wasm and breaks things there. It is also too large/slow to run on j2wasm atm.
edit: now passes on dart2wasm. it removes 2% of code size and 5% of vars.
edit edit: This speeds up j2wasm microbenchmarks by 20%, and is ready for review.