diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/module-utils.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/ir/module-utils.cpp b/src/ir/module-utils.cpp index 2fd129a9c..5ebd6edef 100644 --- a/src/ir/module-utils.cpp +++ b/src/ir/module-utils.cpp @@ -598,26 +598,23 @@ void classifyTypeVisibility(Module& wasm, // We will need to traverse the types used by public types and mark them // public as well. std::vector<HeapType> workList; + std::unordered_set<RecGroup> publicGroups; auto notePublic = [&](HeapType type) { if (type.isBasic()) { - return false; + return; + } + auto group = type.getRecGroup(); + if (!publicGroups.insert(group).second) { + // The groups in this type have already been marked public. + return; } - // All the rec group members are public as well. - bool inserted = false; for (auto member : type.getRecGroup()) { if (auto it = types.find(member); it != types.end()) { - if (it->second.visibility == Visibility::Public) { - // Since we mark all elements of a group public at once, if there is a - // member that is already public, all members must already be public. - break; - } it->second.visibility = Visibility::Public; - workList.push_back(member); - inserted = true; } + workList.push_back(member); } - return inserted; }; // TODO: Consider Tags as well, but they should store HeapTypes instead of |