[llvm] 49cf69a - [SystemZ] Avoid repeated hash lookups (NFC) (#130392)

via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 8 01:02:52 PST 2025


Author: Kazu Hirata
Date: 2025-03-08T01:02:47-08:00
New Revision: 49cf69a46b0527eaa7ac2eb1f4be898dd99727ba

URL: https://github.com/llvm/llvm-project/commit/49cf69a46b0527eaa7ac2eb1f4be898dd99727ba
DIFF: https://github.com/llvm/llvm-project/commit/49cf69a46b0527eaa7ac2eb1f4be898dd99727ba.diff

LOG: [SystemZ] Avoid repeated hash lookups (NFC) (#130392)

Added: 
    

Modified: 
    llvm/lib/Target/SystemZ/SystemZMachineScheduler.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/SystemZ/SystemZMachineScheduler.cpp b/llvm/lib/Target/SystemZ/SystemZMachineScheduler.cpp
index 4bc979de795dc..5e2365f1dc513 100644
--- a/llvm/lib/Target/SystemZ/SystemZMachineScheduler.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZMachineScheduler.cpp
@@ -94,14 +94,16 @@ void SystemZPostRASchedStrategy::enterMBB(MachineBasicBlock *NextMBB) {
   // scheduled. If this is not possible, we are done.
   MachineBasicBlock *SinglePredMBB =
     getSingleSchedPred(MBB, MLI->getLoopFor(MBB));
-  if (SinglePredMBB == nullptr ||
-      SchedStates.find(SinglePredMBB) == SchedStates.end())
+  if (SinglePredMBB == nullptr)
+    return;
+  auto It = SchedStates.find(SinglePredMBB);
+  if (It == SchedStates.end())
     return;
 
   LLVM_DEBUG(dbgs() << "** Continued scheduling from "
                     << printMBBReference(*SinglePredMBB) << "\n";);
 
-  HazardRec->copyState(SchedStates[SinglePredMBB]);
+  HazardRec->copyState(It->second);
   LLVM_DEBUG(HazardRec->dumpState(););
 
   // Emit incoming terminator(s). Be optimistic and assume that branch


        


More information about the llvm-commits mailing list