aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2025-03-16 23:52:16 -0700
committerGitHub <noreply@github.com>2025-03-16 23:52:16 -0700
commit05607a3f39f97449e75358159ce8526e5d734615 (patch)
tree31813f8608b7422547ea455ba372efd1c62bfb15 /llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
parent2c35cb6f16b21d984b298e2ddf445d20f194e142 (diff)
downloadllvm-05607a3f39f97449e75358159ce8526e5d734615.zip
llvm-05607a3f39f97449e75358159ce8526e5d734615.tar.gz
llvm-05607a3f39f97449e75358159ce8526e5d734615.tar.bz2
[CodeGen] Avoid repeated hash lookups (NFC) (#131551)
Diffstat (limited to 'llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp')
-rw-r--r--llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
index 2bd3211..272749f 100644
--- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -2612,13 +2612,13 @@ removeRedundantDbgLocsUsingForwardScan(const BasicBlock *BB,
NumDefsScanned++;
DebugVariable Key(FnVarLocs.getVariable(Loc.VariableID).getVariable(),
std::nullopt, Loc.DL.getInlinedAt());
- auto VMI = VariableMap.find(Key);
+ auto [VMI, Inserted] = VariableMap.try_emplace(Key);
// Update the map if we found a new value/expression describing the
// variable, or if the variable wasn't mapped already.
- if (VMI == VariableMap.end() || VMI->second.first != Loc.Values ||
+ if (Inserted || VMI->second.first != Loc.Values ||
VMI->second.second != Loc.Expr) {
- VariableMap[Key] = {Loc.Values, Loc.Expr};
+ VMI->second = {Loc.Values, Loc.Expr};
NewDefs.push_back(Loc);
continue;
}