[llvm] 24892b8 - [MC] Avoid repeated hash lookups (NFC) (#123502)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 19 10:58:29 PST 2025


Author: Kazu Hirata
Date: 2025-01-19T10:58:26-08:00
New Revision: 24892b868199ce67bcab60d91a58e13beba6a258

URL: https://github.com/llvm/llvm-project/commit/24892b868199ce67bcab60d91a58e13beba6a258
DIFF: https://github.com/llvm/llvm-project/commit/24892b868199ce67bcab60d91a58e13beba6a258.diff

LOG: [MC] Avoid repeated hash lookups (NFC) (#123502)

Added: 
    

Modified: 
    llvm/lib/MC/ELFObjectWriter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index bf911e29a19c44..5f586fe19a5bb4 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -1219,7 +1219,8 @@ void ELFObjectWriter::executePostLayoutBinding(MCAssembler &Asm) {
       continue;
     }
 
-    if (Renames.count(&Symbol) && Renames[&Symbol] != Alias) {
+    if (auto It = Renames.find(&Symbol);
+        It != Renames.end() && It->second != Alias) {
       Asm.getContext().reportError(S.Loc, Twine("multiple versions for ") +
                                               Symbol.getName());
       continue;


        


More information about the llvm-commits mailing list