diff options
Diffstat (limited to 'src/tools/wasm-metadce.cpp')
-rw-r--r-- | src/tools/wasm-metadce.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/tools/wasm-metadce.cpp b/src/tools/wasm-metadce.cpp index d81054d32..73d7c0691 100644 --- a/src/tools/wasm-metadce.cpp +++ b/src/tools/wasm-metadce.cpp @@ -307,9 +307,12 @@ struct MetaDCEGraph { private: // gets a unique name for the graph Name getName(std::string prefix1, std::string prefix2) { + auto base = prefix1 + '$' + prefix2; + if (nodes.find(base) == nodes.end()) { + return base; + } while (1) { - auto curr = - Name(prefix1 + '$' + prefix2 + '$' + std::to_string(nameIndex++)); + Name curr = base + '$' + std::to_string(nameIndex++); if (nodes.find(curr) == nodes.end()) { return curr; } |