diff options
author | Roberto Lublinerman <rluble@google.com> | 2024-05-09 14:05:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-09 14:05:53 -0700 |
commit | a816627051c67ae14f6defc8fc5c616ba427a29e (patch) | |
tree | c7f861c41915279052667e674d4a7811ea9b7c78 /test/lit/help/wasm-split.test | |
parent | 712ad9d83953101abec01e5017e306fcb4bf7f70 (diff) | |
download | binaryen-a816627051c67ae14f6defc8fc5c616ba427a29e.tar.gz binaryen-a816627051c67ae14f6defc8fc5c616ba427a29e.tar.bz2 binaryen-a816627051c67ae14f6defc8fc5c616ba427a29e.zip |
[J2Cl] Make J2clOpts more effective with transitive deps in constant intialization (#6571)
Constants that need to be hoisted sometimes are initialized by calling
getters of other constants that need to be hoisted. These getters are
non-trivial, e.g.
(func $getConst1_<once>_@X (result (ref null $A))
(block (result (ref null $A))
(if (i32.eqz (ref.is_null (global.get $$const1@X)))
(then
(return (global.get $$const1@X))
)
)
(global.set $$const1@X (struct.new $A (i32.const 2)))
(global.get $$const1@X)
)
(func $getConst2_<once>_@X (result (ref null $A))
(block (result (ref null $A))
(if (i32.eqz (ref.is_null (global.get $$const2@X)))
(then
(return (global.get $$const2@X))
)
)
(global.set $$const2@X .... expression with (call $getConst1_<once>_@X) ....))
(global.get $$const2@X)
)
and can only be simplified after the constants they initialize are hoisted. After
the constant is hoisted the getter can be inlined and constants that depend on
it for their initialization can now be hoisted.
Before this pass, inlining would happen after the pass was run by a subsequent
run of the inliner (likely as part of -O3), requiring as many runs of this pass,
interleaved with the inliner, as the depth in the call sequence.
By having a simpler inliner run as part of the loop in this pass, the pass becomes
more effective and more independent of the call depths.
Diffstat (limited to 'test/lit/help/wasm-split.test')
0 files changed, 0 insertions, 0 deletions