[llvm] c741cf1 - [CodeGen] Avoid repeated hash lookups (NFC) (#126403)

via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 9 08:55:46 PST 2025


Author: Kazu Hirata
Date: 2025-02-09T08:55:43-08:00
New Revision: c741cf1617c22d18316fd98af1c30dc244eab22e

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

LOG: [CodeGen] Avoid repeated hash lookups (NFC) (#126403)

Added: 
    

Modified: 
    llvm/lib/CodeGen/StackColoring.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/StackColoring.cpp b/llvm/lib/CodeGen/StackColoring.cpp
index 27c65d234a618c..552dfdfe16ce4e 100644
--- a/llvm/lib/CodeGen/StackColoring.cpp
+++ b/llvm/lib/CodeGen/StackColoring.cpp
@@ -1115,9 +1115,10 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
   if (WinEHFuncInfo *EHInfo = MF->getWinEHFuncInfo())
     for (WinEHTryBlockMapEntry &TBME : EHInfo->TryBlockMap)
       for (WinEHHandlerType &H : TBME.HandlerArray)
-        if (H.CatchObj.FrameIndex != std::numeric_limits<int>::max() &&
-            SlotRemap.count(H.CatchObj.FrameIndex))
-          H.CatchObj.FrameIndex = SlotRemap[H.CatchObj.FrameIndex];
+        if (H.CatchObj.FrameIndex != std::numeric_limits<int>::max())
+          if (auto It = SlotRemap.find(H.CatchObj.FrameIndex);
+              It != SlotRemap.end())
+            H.CatchObj.FrameIndex = It->second;
 
   LLVM_DEBUG(dbgs() << "Fixed " << FixedMemOp << " machine memory operands.\n");
   LLVM_DEBUG(dbgs() << "Fixed " << FixedDbg << " debug locations.\n");


        


More information about the llvm-commits mailing list