[llvm] d82eccc - [RegAllocFast] Avoid duplicate hash lookup (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 22 07:52:39 PST 2023


Author: Nikita Popov
Date: 2023-12-22T16:52:20+01:00
New Revision: d82eccc7524622e482d3dab2219651587eb93429

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

LOG: [RegAllocFast] Avoid duplicate hash lookup (NFC)

Added: 
    

Modified: 
    llvm/lib/CodeGen/RegAllocFast.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp
index a52013a74c2e14..d7edaa1d7ea47d 100644
--- a/llvm/lib/CodeGen/RegAllocFast.cpp
+++ b/llvm/lib/CodeGen/RegAllocFast.cpp
@@ -81,8 +81,9 @@ class InstrPosIndexes {
   /// instructions index has been reassigned.
   bool getIndex(const MachineInstr &MI, uint64_t &Index) {
     assert(MI.getParent() == CurMBB && "MI is not in CurMBB");
-    if (Instr2PosIndex.count(&MI)) {
-      Index = Instr2PosIndex[&MI];
+    auto It = Instr2PosIndex.find(&MI);
+    if (It != Instr2PosIndex.end()) {
+      Index = It->second;
       return false;
     }
 


        


More information about the llvm-commits mailing list