[llvm] 72918fd - [GlobalISel] Avoid repeated hash lookups (NFC) (#124393)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 25 01:17:42 PST 2025


Author: Kazu Hirata
Date: 2025-01-25T01:17:38-08:00
New Revision: 72918fd11dd805b578bbc9c4f36bea3bc96f37b5

URL: https://github.com/llvm/llvm-project/commit/72918fd11dd805b578bbc9c4f36bea3bc96f37b5
DIFF: https://github.com/llvm/llvm-project/commit/72918fd11dd805b578bbc9c4f36bea3bc96f37b5.diff

LOG: [GlobalISel] Avoid repeated hash lookups (NFC) (#124393)

Added: 
    

Modified: 
    llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp b/llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp
index 3a9069848ca1db..0222069cfc576d 100644
--- a/llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CSEInfo.cpp
@@ -181,10 +181,7 @@ MachineInstr *GISelCSEInfo::getMachineInstrIfExists(FoldingSetNodeID &ID,
 
 void GISelCSEInfo::countOpcodeHit(unsigned Opc) {
 #ifndef NDEBUG
-  if (OpcodeHitTable.count(Opc))
-    OpcodeHitTable[Opc] += 1;
-  else
-    OpcodeHitTable[Opc] = 1;
+  ++OpcodeHitTable[Opc];
 #endif
   // Else do nothing.
 }


        


More information about the llvm-commits mailing list