summaryrefslogtreecommitdiff
path: root/src/passes/RemoveUnusedFunctions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/RemoveUnusedFunctions.cpp')
-rw-r--r--src/passes/RemoveUnusedFunctions.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/passes/RemoveUnusedFunctions.cpp b/src/passes/RemoveUnusedFunctions.cpp
index a2941aff6..78b0f0ffc 100644
--- a/src/passes/RemoveUnusedFunctions.cpp
+++ b/src/passes/RemoveUnusedFunctions.cpp
@@ -39,8 +39,10 @@ struct RemoveUnusedFunctions : public Pass {
root.push_back(module->getFunction(curr->value));
}
// For now, all functions that can be called indirectly are marked as roots.
- for (auto& curr : module->table.names) {
- root.push_back(module->getFunction(curr));
+ for (auto& segment : module->table.segments) {
+ for (auto& curr : segment.data) {
+ root.push_back(module->getFunction(curr));
+ }
}
// Compute function reachability starting from the root set.
DirectCallGraphAnalyzer analyzer(module, root);