[llvm] [SystemZ] Avoid repeated hash lookups (NFC) (PR #112072)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 11 20:18:25 PDT 2024


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

None

>From 571e40afffba36a14c6f63e81c93a06582d3c8a4 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 11 Oct 2024 09:08:46 -0700
Subject: [PATCH] [SystemZ] Avoid repeated hash lookups (NFC)

---
 llvm/lib/Target/SystemZ/SystemZISelLowering.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
index abf414fd1ffb71..c7626434efac67 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -8340,11 +8340,11 @@ static void createPHIsForSelects(SmallVector<MachineInstr*, 8> &Selects,
     if (MI->getOperand(4).getImm() == (CCValid ^ CCMask))
       std::swap(TrueReg, FalseReg);
 
-    if (RegRewriteTable.contains(TrueReg))
-      TrueReg = RegRewriteTable[TrueReg].first;
+    if (auto It = RegRewriteTable.find(TrueReg); It != RegRewriteTable.end())
+      TrueReg = It->second.first;
 
-    if (RegRewriteTable.contains(FalseReg))
-      FalseReg = RegRewriteTable[FalseReg].second;
+    if (auto It = RegRewriteTable.find(FalseReg); It != RegRewriteTable.end())
+      FalseReg = It->second.second;
 
     DebugLoc DL = MI->getDebugLoc();
     BuildMI(*SinkMBB, SinkInsertionPoint, DL, TII->get(SystemZ::PHI), DestReg)



More information about the llvm-commits mailing list