diff options
Diffstat (limited to 'src/tools/wasm-metadce.cpp')
-rw-r--r-- | src/tools/wasm-metadce.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tools/wasm-metadce.cpp b/src/tools/wasm-metadce.cpp index 23a2d0fcc..00fa87ce2 100644 --- a/src/tools/wasm-metadce.cpp +++ b/src/tools/wasm-metadce.cpp @@ -263,6 +263,12 @@ struct MetaDCEGraph { } void visitGlobalGet(GlobalGet* curr) { handleGlobal(curr->name); } void visitGlobalSet(GlobalSet* curr) { handleGlobal(curr->name); } + void visitThrow(Throw* curr) { handleTag(curr->tag); } + void visitTry(Try* curr) { + for (auto tag : curr->catchTags) { + handleTag(tag); + } + } private: MetaDCEGraph* parent; @@ -282,6 +288,17 @@ struct MetaDCEGraph { parent->nodes[parent->functionToDCENode[getFunction()->name]] .reaches.push_back(dceName); } + + void handleTag(Name name) { + Name dceName; + if (!getModule()->getTag(name)->imported()) { + dceName = parent->tagToDCENode[name]; + } else { + dceName = parent->importIdToDCENode[parent->getTagImportId(name)]; + } + parent->nodes[parent->functionToDCENode[getFunction()->name]] + .reaches.push_back(dceName); + } }; PassRunner runner(&wasm); |