diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-12-17 20:28:41 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-17 20:28:41 -0800 |
commit | a0de358f7d73222501775e5f21ed4ec9838311cb (patch) | |
tree | a1bab8ff1d0a70eb769f2e7ebf760939e30a5e38 /src/binaryen-c.cpp | |
parent | dc2c05153c57b55fdd949a8827d4c8f648db8484 (diff) | |
download | binaryen-a0de358f7d73222501775e5f21ed4ec9838311cb.tar.gz binaryen-a0de358f7d73222501775e5f21ed4ec9838311cb.tar.bz2 binaryen-a0de358f7d73222501775e5f21ed4ec9838311cb.zip |
merge-locals pass (#1334)
This optimizes the situation described in #1331. Namely, when x is copied into y, then on subsequent gets of x we could use y instead, and vice versa, as their value is equal. Specifically, this seems to get rid of the definite overlap in the live ranges of x and y, as removing it allows coalesce-locals to merge them. The pass therefore does nothing if the live range of y ends there anyhow.
The danger here is that we may extend the live range so that it causes more conflicts with other things, so this is a heuristic, but I've tested it on every codebase I can find and it always produces a net win, even on one I saw a 0.4% reduction of code size, which surprised me.
This is a fairly slow pass, because it uses LocalGraph which isn't much optimized. This PR includes a minor optimization for it, but we should rewrite it. Meanwhile this is just enabled in -O3 and -Oz.
This PR also includes some fuzzing improvements, to better test stuff like this.
Diffstat (limited to 'src/binaryen-c.cpp')
0 files changed, 0 insertions, 0 deletions