[llvm] [CodeGen] Avoid repeated hash lookups (NFC) (PR #123447)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 17 21:00:22 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/123447
None
>From 7980b85a4a29b9915f758e2bb0c9a6f95b539880 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 17 Jan 2025 09:25:50 -0800
Subject: [PATCH] [CodeGen] Avoid repeated hash lookups (NFC)
---
llvm/lib/CodeGen/MachineSink.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp
index 3c816f97650901..03d93cecaa5963 100644
--- a/llvm/lib/CodeGen/MachineSink.cpp
+++ b/llvm/lib/CodeGen/MachineSink.cpp
@@ -1784,11 +1784,12 @@ bool MachineSinking::SinkInstruction(MachineInstr &MI, bool &SawStore,
for (auto &MO : MI.all_defs()) {
if (!MO.getReg().isVirtual())
continue;
- if (!SeenDbgUsers.count(MO.getReg()))
+ auto It = SeenDbgUsers.find(MO.getReg());
+ if (It == SeenDbgUsers.end())
continue;
// Sink any users that don't pass any other DBG_VALUEs for this variable.
- auto &Users = SeenDbgUsers[MO.getReg()];
+ auto &Users = It->second;
for (auto &User : Users) {
MachineInstr *DbgMI = User.getPointer();
if (User.getInt()) {
More information about the llvm-commits
mailing list