diff options
Diffstat (limited to 'src/passes/DeadArgumentElimination.cpp')
-rw-r--r-- | src/passes/DeadArgumentElimination.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/passes/DeadArgumentElimination.cpp b/src/passes/DeadArgumentElimination.cpp index 8e1da3ac5..4395fc780 100644 --- a/src/passes/DeadArgumentElimination.cpp +++ b/src/passes/DeadArgumentElimination.cpp @@ -362,7 +362,7 @@ struct DAE : public Pass { // once to remove a param, once to drop the return value). if (changed.empty()) { for (auto& func : module->functions) { - if (func->result == none) { + if (func->sig.results == Type::none) { continue; } auto name = func->name; @@ -403,15 +403,15 @@ private: std::unordered_map<Call*, Expression**> allDroppedCalls; void removeParameter(Function* func, Index i, std::vector<Call*>& calls) { - // Clear the type, which is no longer accurate. - func->type = Name(); // It's cumbersome to adjust local names - TODO don't clear them? Builder::clearLocalNames(func); // Remove the parameter from the function. We must add a new local // for uses of the parameter, but cannot make it use the same index // (in general). - auto type = func->getLocalType(i); - func->params.erase(func->params.begin() + i); + std::vector<Type> params = func->sig.params.expand(); + auto type = params[i]; + params.erase(params.begin() + i); + func->sig.params = Type(params); Index newIndex = Builder::addVar(func, type); // Update local operations. struct LocalUpdater : public PostWalker<LocalUpdater> { @@ -439,9 +439,7 @@ private: void removeReturnValue(Function* func, std::vector<Call*>& calls, Module* module) { - // Clear the type, which is no longer accurate. - func->type = Name(); - func->result = none; + func->sig.results = Type::none; Builder builder(*module); // Remove any return values. struct ReturnUpdater : public PostWalker<ReturnUpdater> { |