summaryrefslogtreecommitdiff
path: root/test/wasm2js/func_ptrs.2asm.js
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-10-19 09:11:36 -0700
committerGitHub <noreply@github.com>2023-10-19 16:11:36 +0000
commitbe6a3393c36ccc1a0cb0d79b116cbe48e169f93b (patch)
tree8240468a78e62b6d18d747c865557d69f01b4b9f /test/wasm2js/func_ptrs.2asm.js
parentf79b5aa26b1fc722853e56b541cd35128786ef6b (diff)
downloadbinaryen-be6a3393c36ccc1a0cb0d79b116cbe48e169f93b.tar.gz
binaryen-be6a3393c36ccc1a0cb0d79b116cbe48e169f93b.tar.bz2
binaryen-be6a3393c36ccc1a0cb0d79b116cbe48e169f93b.zip
RemoveUnusedModuleElements: Make exports skip trampolines (#6026)
If we export a function that just calls another function, we can export that one instead. Then the one in the middle may be unused, function foo() { return bar(); } export foo; // can be an export of bar This saves a few bytes in rare cases, but probably more important is that it saves the trampoline, so if this is on a hot path, we save a call. Context: emscripten-core/emscripten#20478 (comment) In general this is not needed as inlining helps us out by inlining foo() into the caller (since foo is tiny, that always ends up happening). But exports are a case the inliner cannot handle, so we do it here.
Diffstat (limited to 'test/wasm2js/func_ptrs.2asm.js')
-rw-r--r--test/wasm2js/func_ptrs.2asm.js7
1 files changed, 1 insertions, 6 deletions
diff --git a/test/wasm2js/func_ptrs.2asm.js b/test/wasm2js/func_ptrs.2asm.js
index 4b7c4fd44..ccd220152 100644
--- a/test/wasm2js/func_ptrs.2asm.js
+++ b/test/wasm2js/func_ptrs.2asm.js
@@ -27,16 +27,11 @@ function asmFunc(imports) {
return a - 2 | 0 | 0;
}
- function $6($0) {
- $0 = $0 | 0;
- print($0 | 0);
- }
-
return {
"one": $3,
"two": $4,
"three": $5,
- "four": $6
+ "four": print
};
}