[llvm] 2f98ae5 - [Transforms] Avoid repeated hash lookups (NFC) (#125350)

via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 2 09:30:56 PST 2025


Author: Kazu Hirata
Date: 2025-02-02T09:30:52-08:00
New Revision: 2f98ae5029a1f03793ca2016585c48075a1aa03a

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

LOG: [Transforms] Avoid repeated hash lookups (NFC) (#125350)

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/NewGVN.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp
index d8b0bd173454f4a..168f1d689d3149f 100644
--- a/llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -3056,13 +3056,8 @@ std::pair<unsigned, unsigned> NewGVN::assignDFSNumbers(BasicBlock *B,
 
 void NewGVN::updateProcessedCount(const Value *V) {
 #ifndef NDEBUG
-  if (ProcessedCount.count(V) == 0) {
-    ProcessedCount.insert({V, 1});
-  } else {
-    ++ProcessedCount[V];
-    assert(ProcessedCount[V] < 100 &&
-           "Seem to have processed the same Value a lot");
-  }
+  assert(++ProcessedCount[V] < 100 &&
+         "Seem to have processed the same Value a lot");
 #endif
 }
 


        


More information about the llvm-commits mailing list