summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-03-29 11:33:52 -0700
committerGitHub <noreply@github.com>2021-03-29 11:33:52 -0700
commit1a6efdb4233a077bc6e5e8a340baf5672bb5bced (patch)
treef814f47930fe8a2312cd23848ea63ff7e13bb9dc /src/tools
parent9c1d69f6596b76fe83bff17709b92f8cc2054a31 (diff)
downloadbinaryen-1a6efdb4233a077bc6e5e8a340baf5672bb5bced.tar.gz
binaryen-1a6efdb4233a077bc6e5e8a340baf5672bb5bced.tar.bz2
binaryen-1a6efdb4233a077bc6e5e8a340baf5672bb5bced.zip
Inlining: Always inline single-use functions (#3730)
This implements emscripten-core/emscripten#13744 Inlining functions with a single use allows us to remove the function afterward. That looks highly beneficial, shrinking every single benchmark in emscripten's benchmark suite, by an average of 2% on the macrobenchmarks and 3.5% on all of them. Speed also improves, although mostly on the microbenchmarks so that might be less realistic. There may be a slight downside to startup time due to emitting larger functions, but given the baseline compilers in VMs these days it seems worth it, as the delay would be just to get to the upper tier. On the benchmark suite the risk seems low. See more details in the PR above.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/optimization-options.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/tools/optimization-options.h b/src/tools/optimization-options.h
index 4f5c9e0d1..0e6157473 100644
--- a/src/tools/optimization-options.h
+++ b/src/tools/optimization-options.h
@@ -155,13 +155,12 @@ struct OptimizationOptions : public ToolOptions {
.add("--one-caller-inline-max-function-size",
"-ocimfs",
"Max size of functions that are inlined when there is only one "
- "caller (default " +
- std::to_string(InliningOptions().oneCallerInlineMaxSize) +
- "). Reason this is not unbounded is that some "
- "implementations may have a hard time optimizing really large "
- "functions",
+ "caller (default -1, which means all such functions are inlined)",
Options::Arguments::One,
[this](Options* o, const std::string& argument) {
+ static_assert(InliningOptions().oneCallerInlineMaxSize ==
+ Index(-1),
+ "the help text here is written to assume -1");
passOptions.inlining.oneCallerInlineMaxSize =
static_cast<Index>(atoi(argument.c_str()));
})