diff options
Diffstat (limited to 'src/passes')
-rw-r--r-- | src/passes/DeadArgumentElimination.cpp | 2 | ||||
-rw-r--r-- | src/passes/Flatten.cpp | 2 | ||||
-rw-r--r-- | src/passes/Inlining.cpp | 19 | ||||
-rw-r--r-- | src/passes/SSAify.cpp | 2 |
4 files changed, 20 insertions, 5 deletions
diff --git a/src/passes/DeadArgumentElimination.cpp b/src/passes/DeadArgumentElimination.cpp index 59337f75d..37aaace37 100644 --- a/src/passes/DeadArgumentElimination.cpp +++ b/src/passes/DeadArgumentElimination.cpp @@ -383,7 +383,7 @@ struct DAE : public Pass { // Wonderful, nothing stands in our way! Do it. // TODO: parallelize this? removeParameter(func, i, calls); - TypeUpdating::handleNonNullableLocals(func, *module); + TypeUpdating::handleNonDefaultableLocals(func, *module); changed.insert(func); } } diff --git a/src/passes/Flatten.cpp b/src/passes/Flatten.cpp index c8f731d64..298b6241e 100644 --- a/src/passes/Flatten.cpp +++ b/src/passes/Flatten.cpp @@ -337,7 +337,7 @@ struct Flatten // the body may have preludes curr->body = getPreludesWithExpression(originalBody, curr->body); // New locals we added may be non-nullable. - TypeUpdating::handleNonNullableLocals(curr, *getModule()); + TypeUpdating::handleNonDefaultableLocals(curr, *getModule()); // We cannot handle non-nullable tuples currently, see the comment at the // top of the file. for (auto type : curr->vars) { diff --git a/src/passes/Inlining.cpp b/src/passes/Inlining.cpp index 0e6f6abe4..78f9966e7 100644 --- a/src/passes/Inlining.cpp +++ b/src/passes/Inlining.cpp @@ -52,6 +52,7 @@ struct FunctionInfo { bool hasLoops; bool hasTryDelegate; bool usedGlobally; // in a table or export + bool uninlineable; FunctionInfo() { refs = 0; @@ -60,10 +61,14 @@ struct FunctionInfo { hasLoops = false; hasTryDelegate = false; usedGlobally = false; + uninlineable = false; } // See pass.h for how defaults for these options were chosen. bool worthInlining(PassOptions& options) { + if (uninlineable) { + return false; + } // Until we have proper support for try-delegate, ignore such functions. // FIXME https://github.com/WebAssembly/binaryen/issues/3634 if (hasTryDelegate) { @@ -134,7 +139,17 @@ struct FunctionInfoScanner } void visitFunction(Function* curr) { - (*infos)[curr->name].size = Measurer::measure(curr->body); + auto& info = (*infos)[curr->name]; + + // We cannot inline a function if we cannot handle placing it in a local, as + // all params become locals. + for (auto param : curr->sig.params) { + if (!TypeUpdating::canHandleAsLocal(param)) { + info.uninlineable = true; + } + } + + info.size = Measurer::measure(curr->body); } private: @@ -298,7 +313,7 @@ doInlining(Module* module, Function* into, const InliningAction& action) { // Make the block reachable by adding a break to it block->list.push_back(builder.makeBreak(block->name)); } - TypeUpdating::handleNonNullableLocals(into, *module); + TypeUpdating::handleNonDefaultableLocals(into, *module); return block; } diff --git a/src/passes/SSAify.cpp b/src/passes/SSAify.cpp index 843015936..9f330f7b3 100644 --- a/src/passes/SSAify.cpp +++ b/src/passes/SSAify.cpp @@ -100,7 +100,7 @@ struct SSAify : public Pass { // add prepends to function addPrepends(); // Handle non-nullability in new locals we added. - TypeUpdating::handleNonNullableLocals(func, *module); + TypeUpdating::handleNonDefaultableLocals(func, *module); } void createNewIndexes(LocalGraph& graph) { |