Skip to content

Commit 4b05489

Browse files
authored
Simplify function lists in RemoveUnusedModuleElements (NFC) (#2147)
It looks there's no need to maintain `functions` and `functionImports` separately.
1 parent 4b223a3 commit 4b05489

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

src/passes/RemoveUnusedModuleElements.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,12 @@ struct ReachabilityAnalyzer : public PostWalker<ReachabilityAnalyzer> {
120120
// Finds function type usage
121121

122122
struct FunctionTypeAnalyzer : public PostWalker<FunctionTypeAnalyzer> {
123-
std::vector<Function*> functionImports;
124123
std::vector<Function*> functions;
125124
std::vector<CallIndirect*> indirectCalls;
126125

127126
void visitFunction(Function* curr) {
128127
if (curr->type.is()) {
129-
if (curr->imported()) {
130-
functionImports.push_back(curr);
131-
} else {
132-
functions.push_back(curr);
133-
}
128+
functions.push_back(curr);
134129
}
135130
}
136131

@@ -271,9 +266,6 @@ struct RemoveUnusedModuleElements : public Pass {
271266
}
272267
};
273268
// canonicalize all uses of function types
274-
for (auto* import : analyzer.functionImports) {
275-
import->type = canonicalize(import->type);
276-
}
277269
for (auto* func : analyzer.functions) {
278270
func->type = canonicalize(func->type);
279271
}

0 commit comments

Comments
 (0)