diff options
author | Taiju Tsuiki <tzik@users.noreply.github.com> | 2016-10-15 01:57:17 +0900 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-10-14 09:57:17 -0700 |
commit | 392995b646d2f5f36bf3110eac149892ebda74df (patch) | |
tree | 2c278abcd4005bb3f4450407b9b1638b512511dc /src | |
parent | 89844da32a940042f0fcd61506e5c422e82c7536 (diff) | |
download | binaryen-392995b646d2f5f36bf3110eac149892ebda74df.tar.gz binaryen-392995b646d2f5f36bf3110eac149892ebda74df.tar.bz2 binaryen-392995b646d2f5f36bf3110eac149892ebda74df.zip |
Do not use exported memory as a root set of RemoveUnusedFunctions pass (#763)
* Do not use exported memory as a root set of RemoveUnusedFunctions pass
RemoveUnusedFunctions pass of wasm-opt fails when the memory is exported.
That's due to a wrong root set handling on the exported symbols.
This CL fixes the failure by ignoring non-function exported symbol.
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/RemoveUnusedFunctions.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/passes/RemoveUnusedFunctions.cpp b/src/passes/RemoveUnusedFunctions.cpp index 78b0f0ffc..ec9e271b7 100644 --- a/src/passes/RemoveUnusedFunctions.cpp +++ b/src/passes/RemoveUnusedFunctions.cpp @@ -36,7 +36,9 @@ struct RemoveUnusedFunctions : public Pass { } // Exports are roots. for (auto& curr : module->exports) { - root.push_back(module->getFunction(curr->value)); + if (curr->kind == ExternalKind::Function) { + root.push_back(module->getFunction(curr->value)); + } } // For now, all functions that can be called indirectly are marked as roots. for (auto& segment : module->table.segments) { |