[llvm] [CodeGen] Avoid repeated hash lookups (NFC) (PR #123287)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 16 21:32:19 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/123287
None
>From 0ace4579aa089ce20f3c64ceba8dd201afabe829 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 16 Jan 2025 09:55:18 -0800
Subject: [PATCH] [CodeGen] Avoid repeated hash lookups (NFC)
---
llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
index a465f52bfd5936..dbc724629d3bec 100644
--- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -230,9 +230,10 @@ void FunctionVarLocs::init(FunctionVarLocsBuilder &Builder) {
for (const DbgVariableRecord &DVR : filterDbgVars(I->getDbgRecordRange())) {
// Even though DVR defines a variable location, VarLocsBeforeInst can
// still be empty if that VarLoc was redundant.
- if (!Builder.VarLocsBeforeInst.count(&DVR))
+ auto It = Builder.VarLocsBeforeInst.find(&DVR);
+ if (It == Builder.VarLocsBeforeInst.end())
continue;
- for (const VarLocInfo &VarLoc : Builder.VarLocsBeforeInst[&DVR])
+ for (const VarLocInfo &VarLoc : It->second)
VarLocRecords.emplace_back(VarLoc);
}
for (const VarLocInfo &VarLoc : P.second)
More information about the llvm-commits
mailing list