summaryrefslogtreecommitdiff
path: root/src/passes/pass.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-02-02 18:47:39 -0800
committerGitHub <noreply@github.com>2018-02-02 18:47:39 -0800
commit874e89eec8ee4c56ecdb9e6cd68f8366fe983b79 (patch)
treeb2893c1106c8f8263c1932e70fbacce96418f1f9 /src/passes/pass.cpp
parent6b05f000e8b9249afd0838774b6bdaf64fcaf90a (diff)
downloadbinaryen-874e89eec8ee4c56ecdb9e6cd68f8366fe983b79.tar.gz
binaryen-874e89eec8ee4c56ecdb9e6cd68f8366fe983b79.tar.bz2
binaryen-874e89eec8ee4c56ecdb9e6cd68f8366fe983b79.zip
Inlining improvements (#1397)
Simplify inlining logic: don't special case the first iteration or change behavior based on when we are optimizing or not. Instead, use one simpler set of heuristics for both inlining and inlining-optimizing. We only run inlining-optimizing by default anyhow, no point to try to make inlining without optimizations useful by itself, it's not a realistic use case. (inlining is still useful for debugging, and if you will run optimizations anyhow later on everything, in which case inlining-optimizing might add some redundancy.) The simpler heuristics after this let us do a somewhat better job as we are no longer paranoid about inlining in multiple iterations. Also raise limit on inlining things that are obviously worth it from size 1 to size 2: things of size 2 will never lead to an increase in code size after we optimize (it takes at least 3 nodes to generate something that reads two locals and reverses their order, which would require a temp local in the outside scope etc.). Also fix infinite recursion of inlining an infinitely recursive set of calls.
Diffstat (limited to 'src/passes/pass.cpp')
-rw-r--r--src/passes/pass.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/passes/pass.cpp b/src/passes/pass.cpp
index 11575b1df..c9fc7c40e 100644
--- a/src/passes/pass.cpp
+++ b/src/passes/pass.cpp
@@ -74,8 +74,8 @@ void PassRegistry::registerPasses() {
registerPass("extract-function", "leaves just one function (useful for debugging)", createExtractFunctionPass);
registerPass("flatten", "flattens out code, removing nesting", createFlattenPass);
registerPass("func-metrics", "reports function metrics", createFunctionMetricsPass);
- registerPass("inlining", "inlines functions", createInliningPass);
- registerPass("inlining-optimizing", "inlines functions and optimizes where we inlined", createInliningOptimizingPass);
+ registerPass("inlining", "inline functions (you probably want inlining-optimizing)", createInliningPass);
+ registerPass("inlining-optimizing", "inline functions and optimizes where we inlined", createInliningOptimizingPass);
registerPass("legalize-js-interface", "legalizes i64 types on the import/export boundary", createLegalizeJSInterfacePass);
registerPass("local-cse", "common subexpression elimination inside basic blocks", createLocalCSEPass);
registerPass("log-execution", "instrument the build with logging of where execution goes", createLogExecutionPass);