From 44b9f5eeab63dbf7d4e4ebc87dfedca5c42708b6 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Thu, 27 Feb 2025 23:01:35 -0800 Subject: [CodeGen] Avoid repeated hash lookups (NFC) (#129190) --- llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp') diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp index dbc7246..8d91e71 100644 --- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp +++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp @@ -600,12 +600,12 @@ class MemLocFragmentFill { break; } - auto CurrentLiveInEntry = LiveIn.find(&BB); // If there's no LiveIn entry for the block yet, add it. - if (CurrentLiveInEntry == LiveIn.end()) { + auto [CurrentLiveInEntry, Inserted] = LiveIn.try_emplace(&BB); + if (Inserted) { LLVM_DEBUG(dbgs() << "change=true (first) on meet on " << BB.getName() << "\n"); - LiveIn[&BB] = std::move(BBLiveIn); + CurrentLiveInEntry->second = std::move(BBLiveIn); return /*Changed=*/true; } -- cgit v1.1