[llvm] [LiveDebugValues] Avoid repeated hash lookups (NFC) (PR #109509)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 20 20:40:54 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/109509
None
>From 88f8faf36c72bb496a7d98fd4e8b096843cf644e Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 20 Sep 2024 13:34:31 -0700
Subject: [PATCH] [LiveDebugValues] Avoid repeated hash lookups (NFC)
---
llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
index 2d95ff9e05abe7..7e7d90f24fccba 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
@@ -1952,11 +1952,9 @@ void VarLocBasedLDV::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);
OverlappingFragments.insert({{MIVar.getVariable(), ThisFragment}, {}});
return;
More information about the llvm-commits
mailing list