[llvm] [MC] Avoid repeated hash lookups (NFC) (PR #110791)
    via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Oct  1 21:27:30 PDT 2024
    
    
  
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mc
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/110791.diff
1 Files Affected:
- (modified) llvm/lib/MC/XCOFFObjectWriter.cpp (+3-2) 
``````````diff
diff --git a/llvm/lib/MC/XCOFFObjectWriter.cpp b/llvm/lib/MC/XCOFFObjectWriter.cpp
index 124b31e8708842..c7f29c73eaac09 100644
--- a/llvm/lib/MC/XCOFFObjectWriter.cpp
+++ b/llvm/lib/MC/XCOFFObjectWriter.cpp
@@ -666,8 +666,9 @@ void XCOFFObjectWriter::recordRelocation(MCAssembler &Asm,
     // If we could not find the symbol directly in SymbolIndexMap, this symbol
     // could either be a temporary symbol or an undefined symbol. In this case,
     // we would need to have the relocation reference its csect instead.
-    return SymbolIndexMap.contains(Sym)
-               ? SymbolIndexMap[Sym]
+    auto It = SymbolIndexMap.find(Sym);
+    return It != SymbolIndexMap.end()
+               ? It->second
                : SymbolIndexMap[ContainingCsect->getQualNameSymbol()];
   };
 
``````````
</details>
https://github.com/llvm/llvm-project/pull/110791
    
    
More information about the llvm-commits
mailing list