Compute effects for indirect calls in GlobalEffects#8609
Compute effects for indirect calls in GlobalEffects#8609stevenfontanella wants to merge 23 commits intomainfrom
Conversation
b7ce0b6 to
9fcf76b
Compare
9fcf76b to
0e28a7a
Compare
0e28a7a to
83f4b3b
Compare
83f4b3b to
3a25c2e
Compare
|
Also added some tests exercising call_indirect. |
We don't need to walk up the supertype chain for type targets of indirect calls, we already do that for function implementations which would reach the type of the indirect call anyway
|
Added a test showing two different effect types being aggregated into the same function (global-effects-closed-world-simplify-locals.wast). |
The test went wrong at some point, let me update. |
It turns out that the effects were pessimized when changing the features from |
5086816 to
79f3ead
Compare
189d543 to
2630eff
Compare
Looks like this was due to LinearExecutionWalker (used in SimplifyLocals) not taking global effects into account and unconditionally assuming that functions may throw even if we determined that they won't. I tested with #8637 and found that the test works correctly with |
|
(Messed up merging in JJ, let me try again) |
This now works after #8637
467a5aa to
259b234
Compare
Done. Merged in main with #8637 and changed the test to run with |
When running in --closed-world, compute effects for indirect calls by unioning the effects of all potential functions of that type. In --closed-world, we assume that all references originate in our module, so the only possible functions that we don't know about are imports. Previously we gave up on effects analysis for indirect calls.
Yields a very small byte count reduction in calcworker (3799354 - 3799297 = 57 bytes). Also shows no significant difference in Binaryen runtime: (0.1346069 -> 0.13375045 = <1% improvement, probably within noise). We expect more benefits after we're able to share indirect call effects with other passes, since currently they're only seen one layer up for callers of functions that indirectly call functions (see the newly-added tests for examples).
Followups:
Part of #8615.