[llvm] 3a27458 - [LiveDebugValues] Avoid repeated hash lookups (NFC) (#108484)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 13 10:41:48 PDT 2024
Author: Kazu Hirata
Date: 2024-09-13T10:41:45-07:00
New Revision: 3a274584ebbcad6500efc4083bb53c1af565e294
URL: https://github.com/llvm/llvm-project/commit/3a274584ebbcad6500efc4083bb53c1af565e294
DIFF: https://github.com/llvm/llvm-project/commit/3a274584ebbcad6500efc4083bb53c1af565e294.diff
LOG: [LiveDebugValues] Avoid repeated hash lookups (NFC) (#108484)
Added:
Modified:
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index a69dbbbbdab3cd..a73a3aa59403b3 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -2231,11 +2231,9 @@ void InstrRefBasedLDV::accumulateFragmentMap(MachineInstr &MI) {
// If this is the first sighting of this variable, then we are guaranteed
// there are currently no overlapping fragments either. Initialize the set
// of seen fragments, record no overlaps for the current one, and return.
- auto SeenIt = SeenFragments.find(MIVar.getVariable());
- if (SeenIt == SeenFragments.end()) {
- SmallSet<FragmentInfo, 4> OneFragment;
- OneFragment.insert(ThisFragment);
- SeenFragments.insert({MIVar.getVariable(), OneFragment});
+ auto [SeenIt, Inserted] = SeenFragments.try_emplace(MIVar.getVariable());
+ if (Inserted) {
+ SeenIt->second.insert(ThisFragment);
OverlapFragments.insert({{MIVar.getVariable(), ThisFragment}, {}});
return;
More information about the llvm-commits
mailing list