From e7bf6a4e042fba2b1492be8fc5f430df3e9a43d2 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Thu, 13 Feb 2025 09:11:17 -0800 Subject: [PATCH] [CodeGen] Avoid repeated map lookups (NFC) (#127025) --- llvm/lib/CodeGen/LiveStacks.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/LiveStacks.cpp b/llvm/lib/CodeGen/LiveStacks.cpp index d615caf48c0a..c07d985a09d1 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; }