[llvm] e7bf6a4 - [CodeGen] Avoid repeated map lookups (NFC) (#127025)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 09:11:21 PST 2025


Author: Kazu Hirata
Date: 2025-02-13T09:11:17-08:00
New Revision: e7bf6a4e042fba2b1492be8fc5f430df3e9a43d2

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

LOG: [CodeGen] Avoid repeated map lookups (NFC) (#127025)

Added: 
    

Modified: 
    llvm/lib/CodeGen/LiveStacks.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/LiveStacks.cpp b/llvm/lib/CodeGen/LiveStacks.cpp
index d615caf48c0ad..c07d985a09d1f 100644
--- a/llvm/lib/CodeGen/LiveStacks.cpp
+++ b/llvm/lib/CodeGen/LiveStacks.cpp
@@ -62,8 +62,8 @@ LiveStacks::getOrCreateInterval(int Slot, const TargetRegisterClass *RC) {
     S2RCMap.insert(std::make_pair(Slot, RC));
   } else {
     // Use the largest common subclass register class.
-    const TargetRegisterClass *OldRC = S2RCMap[Slot];
-    S2RCMap[Slot] = TRI->getCommonSubClass(OldRC, RC);
+    const TargetRegisterClass *&OldRC = S2RCMap[Slot];
+    OldRC = TRI->getCommonSubClass(OldRC, RC);
   }
   return I->second;
 }


        


More information about the llvm-commits mailing list