[llvm] [PowerPC] Avoid repeated hash lookups (NFC) (PR #129193)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 27 21:44:07 PST 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/129193

None

>From 867db31815bf3410bfe9224f3621face5bb2d59e Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 27 Feb 2025 01:56:13 -0800
Subject: [PATCH] [PowerPC] Avoid repeated hash lookups (NFC)

---
 llvm/lib/Target/PowerPC/PPCInstrInfo.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
index 9b526066fe75b..f12400490832b 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -5427,8 +5427,8 @@ void PPCInstrInfo::promoteInstr32To64ForElimEXTSW(const Register &Reg,
   --Iter;
   MachineInstrBuilder MIBuilder(*Iter->getMF(), Iter);
   for (unsigned i = 1; i < MI->getNumOperands(); i++) {
-    if (PromoteRegs.find(i) != PromoteRegs.end())
-      MIBuilder.addReg(PromoteRegs[i], RegState::Kill);
+    if (auto It = PromoteRegs.find(i); It != PromoteRegs.end())
+      MIBuilder.addReg(It->second, RegState::Kill);
     else
       Iter->addOperand(MI->getOperand(i));
   }



More information about the llvm-commits mailing list