[llvm] 6ecc1ff - [CodeGen] Avoid repeated hash lookups (NFC) (#132585)

via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 23 07:36:42 PDT 2025


Author: Kazu Hirata
Date: 2025-03-23T07:36:39-07:00
New Revision: 6ecc1ff0a45c0065d9f23b91c22d233a0443d5e0

URL: https://github.com/llvm/llvm-project/commit/6ecc1ff0a45c0065d9f23b91c22d233a0443d5e0
DIFF: https://github.com/llvm/llvm-project/commit/6ecc1ff0a45c0065d9f23b91c22d233a0443d5e0.diff

LOG: [CodeGen] Avoid repeated hash lookups (NFC) (#132585)

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/MachinePipeliner.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/MachinePipeliner.h b/llvm/include/llvm/CodeGen/MachinePipeliner.h
index 120b559c20305..fee6937e7d502 100644
--- a/llvm/include/llvm/CodeGen/MachinePipeliner.h
+++ b/llvm/include/llvm/CodeGen/MachinePipeliner.h
@@ -486,8 +486,9 @@ class NodeSet {
       if (PI.getSrc() != FirstNode || !PI.isOrderDep() ||
           !DAG->isLoopCarriedDep(PI))
         continue;
-      SUnitToDistance[FirstNode] =
-          std::max(SUnitToDistance[FirstNode], SUnitToDistance[LastNode] + 1);
+      unsigned &First = SUnitToDistance[FirstNode];
+      unsigned Last = SUnitToDistance[LastNode];
+      First = std::max(First, Last + 1);
     }
 
     // The latency is the distance from the source node to itself.


        


More information about the llvm-commits mailing list