Skip to content

Commit

Permalink
[CodeGen] Avoid repeated hash lookups (NFC) (llvm#126343)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata authored and Icohedron committed Feb 11, 2025
1 parent aa0b95c commit 90cdb98
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions llvm/lib/CodeGen/MachineCopyPropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 90cdb98

Please sign in to comment.