I've just put the asm.js in that gist directly (after removing the
duplicate trailing `}`) through the optimizer registerizeHarder pass (which
-Oz should run) and it ends up combining

   - q and h
   - p and f
   - e and a
   - b and d

You can try this yourself with
`./emsdk/emscripten/incoming_64bit_optimizer/optimizer
./couldregisterize.js asm registerizeHarder last`, though the path to your
optimizer may be different (possibly under `~/.emscripten_cache`).

Unfortunately I can't compile your code because I don't know what a `val`
is (and I don't know if you're using any other compiler flags).
Aside from that, what version of emscripten are you using?

On 24 February 2016 at 23:25, Charles Vaughn <[email protected]> wrote:

> Looking at a simple test example disassembly to demonstrate Emscripten, I
> noticed a potential optimization opportunity.
>
> See the gist here: https://gist.github.com/hackcasual/e0262caec12bd60b2fe1
> C++ is in a comment on top, compiled with -Oz
>
> For example, q and p are pointers allocated on the stack, however as their
> lifetimes don't overlap couldn't p be dropped and just q used? Similar to
> what the registerization pass does.
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Aidan

Currently co-authoring a book on Docker
<http://manning.com/miell/?a_aid=aidanhs&a_bid=e0d48f62> - get 39% off with
the code 39miell

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to