[llvm] [CodeGen] Avoid repeated hash lookups (NFC) (PR #126343)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 7 20:53:48 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/126343
None
>From a0bae790dd12275fdf48c3218e60b828042cfa33 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 7 Feb 2025 08:12:29 -0800
Subject: [PATCH] [CodeGen] Avoid repeated hash lookups (NFC)
---
llvm/lib/CodeGen/MachineCopyPropagation.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
index 460749a739c763a..4d9d7128f73a8b6 100644
--- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -1065,8 +1065,9 @@ void MachineCopyPropagation::ForwardCopyPropagateBlock(MachineBasicBlock &MBB) {
assert(!MRI->isReserved(DestReg));
// Update matching debug values, if any.
- SmallVector<MachineInstr *> MaybeDeadDbgUsers(
- CopyDbgUsers[MaybeDead].begin(), CopyDbgUsers[MaybeDead].end());
+ const auto &DbgUsers = CopyDbgUsers[MaybeDead];
+ SmallVector<MachineInstr *> MaybeDeadDbgUsers(DbgUsers.begin(),
+ DbgUsers.end());
MRI->updateDbgUsersToReg(DestReg.asMCReg(), SrcReg.asMCReg(),
MaybeDeadDbgUsers);
@@ -1238,8 +1239,9 @@ void MachineCopyPropagation::BackwardCopyPropagateBlock(
isCopyInstr(*Copy, *TII, UseCopyInstr);
Register Src = CopyOperands->Source->getReg();
Register Def = CopyOperands->Destination->getReg();
- SmallVector<MachineInstr *> MaybeDeadDbgUsers(CopyDbgUsers[Copy].begin(),
- CopyDbgUsers[Copy].end());
+ const auto &DbgUsers = CopyDbgUsers[Copy];
+ SmallVector<MachineInstr *> MaybeDeadDbgUsers(DbgUsers.begin(),
+ DbgUsers.end());
MRI->updateDbgUsersToReg(Src.asMCReg(), Def.asMCReg(), MaybeDeadDbgUsers);
Copy->eraseFromParent();
More information about the llvm-commits
mailing list