[llvm] [DebugInfo] Avoid repeated hash lookups (NFC) (PR #108486)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 12 20:39:34 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-platform-windows

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/108486.diff


1 Files Affected:

- (modified) llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp (+2-5) 


``````````diff
diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
index 59d57e83fc1038..801fa06cf3ab7f 100644
--- a/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
@@ -39,11 +39,8 @@ class FunctionArgEnumerator : public IPDBEnumChildren<PDBSymbolData> {
     auto DataChildren = Func.findAllChildren<PDBSymbolData>();
     while (auto Child = DataChildren->getNext()) {
       if (Child->getDataKind() == PDB_DataKind::Param) {
-        std::string Name = Child->getName();
-        if (SeenNames.find(Name) != SeenNames.end())
-          continue;
-        Args.push_back(std::move(Child));
-        SeenNames.insert(Name);
+        if (SeenNames.insert(Child->getName()).second)
+          Args.push_back(std::move(Child));
       }
     }
     reset();

``````````

</details>


https://github.com/llvm/llvm-project/pull/108486


More information about the llvm-commits mailing list