[llvm] 2fa59b3 - [Analysis] Avoid repeated hash lookups (NFC) (#132512)

via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 22 08:08:02 PDT 2025


Author: Kazu Hirata
Date: 2025-03-22T08:07:59-07:00
New Revision: 2fa59b3371e6d749436d56057c54bcbf89c6995b

URL: https://github.com/llvm/llvm-project/commit/2fa59b3371e6d749436d56057c54bcbf89c6995b
DIFF: https://github.com/llvm/llvm-project/commit/2fa59b3371e6d749436d56057c54bcbf89c6995b.diff

LOG: [Analysis] Avoid repeated hash lookups (NFC) (#132512)

Added: 
    

Modified: 
    llvm/lib/Analysis/IRSimilarityIdentifier.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
index e1daf02ee6bba..ca011362702ac 100644
--- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
+++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
@@ -728,11 +728,10 @@ bool IRSimilarityCandidate::compareAssignmentMapping(
     for (unsigned OtherVal : ValueMappingIt->second) {
       if (OtherVal == InstValB)
         continue;
-      if (!ValueNumberMappingA.contains(OtherVal))
+      auto OtherValIt = ValueNumberMappingA.find(OtherVal);
+      if (OtherValIt == ValueNumberMappingA.end())
         continue;
-      if (!ValueNumberMappingA[OtherVal].contains(InstValA))
-        continue;
-      ValueNumberMappingA[OtherVal].erase(InstValA);
+      OtherValIt->second.erase(InstValA);
     }
     ValueNumberMappingA.erase(ValueMappingIt);
     std::tie(ValueMappingIt, WasInserted) = ValueNumberMappingA.insert(


        


More information about the llvm-commits mailing list