[llvm] 16d4453 - [CodeGen][NFC] Remove redundant map lookup (#125342)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 1 06:29:36 PST 2025
Author: Balazs Benics
Date: 2025-02-01T15:29:33+01:00
New Revision: 16d4453f2f5d9554ce39507fda0f33ce9066007b
URL: https://github.com/llvm/llvm-project/commit/16d4453f2f5d9554ce39507fda0f33ce9066007b
DIFF: https://github.com/llvm/llvm-project/commit/16d4453f2f5d9554ce39507fda0f33ce9066007b.diff
LOG: [CodeGen][NFC] Remove redundant map lookup (#125342)
Added:
Modified:
llvm/lib/CodeGen/InlineSpiller.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/InlineSpiller.cpp b/llvm/lib/CodeGen/InlineSpiller.cpp
index 33915d0f7f8297..cfd247e7c3caf6 100644
--- a/llvm/lib/CodeGen/InlineSpiller.cpp
+++ b/llvm/lib/CodeGen/InlineSpiller.cpp
@@ -1320,13 +1320,16 @@ void HoistSpillHelper::addToMergeableSpills(MachineInstr &Spill, int StackSlot,
LiveInterval &OrigLI = LIS.getInterval(Original);
// save a copy of LiveInterval in StackSlotToOrigLI because the original
// LiveInterval may be cleared after all its references are spilled.
- if (!StackSlotToOrigLI.contains(StackSlot)) {
+
+ auto [Place, Inserted] = StackSlotToOrigLI.try_emplace(StackSlot);
+ if (Inserted) {
auto LI = std::make_unique<LiveInterval>(OrigLI.reg(), OrigLI.weight());
LI->assign(OrigLI, Allocator);
- StackSlotToOrigLI[StackSlot] = std::move(LI);
+ Place->second = std::move(LI);
}
+
SlotIndex Idx = LIS.getInstructionIndex(Spill);
- VNInfo *OrigVNI = StackSlotToOrigLI[StackSlot]->getVNInfoAt(Idx.getRegSlot());
+ VNInfo *OrigVNI = Place->second->getVNInfoAt(Idx.getRegSlot());
std::pair<int, VNInfo *> MIdx = std::make_pair(StackSlot, OrigVNI);
MergeableSpills[MIdx].insert(&Spill);
}
More information about the llvm-commits
mailing list