diff options
author | Alon Zakai <azakai@google.com> | 2022-04-28 11:26:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-28 11:26:37 -0700 |
commit | 408b2eb7df01f42157e24c2c58f01c4fa5c6b9d6 (patch) | |
tree | 77877306025388e73ab0e8fb771d9bbb154509f4 /src/wasm-binary.h | |
parent | 7ba0d8377dfaa9fbd24c0e5961fd2795d8349272 (diff) | |
download | binaryen-408b2eb7df01f42157e24c2c58f01c4fa5c6b9d6.tar.gz binaryen-408b2eb7df01f42157e24c2c58f01c4fa5c6b9d6.tar.bz2 binaryen-408b2eb7df01f42157e24c2c58f01c4fa5c6b9d6.zip |
RemoveUnusedModuleElements: Track CallRef/RefFunc more precisely (#4621)
If we see (ref.func $foo) that does not mean that $foo is reachable - we
must also see a (call_ref ..) of the proper type. Only after seeing both should
we mark the function as reachable, which this PR does.
This adds some complexity as we need to track intermediate state as we go,
since we could see the RefFunc before the CallRef or vice versa. We also
need to handle the case of a RefFunc without a CallRef properly: We cannot
remove the function, as the RefFunc must refer to it, but at least we can
empty out the body since we know it is never reached.
This removes an old wasm-opt test which is now superseded by a new lit
test.
On J2Wasm output this removes 3% of all functions, which account for
2.5% of total code size.
Diffstat (limited to 'src/wasm-binary.h')
0 files changed, 0 insertions, 0 deletions