[llvm] [CodeGen] Avoid repeated hash lookups (NFC) (PR #132585)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 22 20:44:53 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/132585
None
>From 57f2874c3e74244cf4042f1ac1c024df3749b777 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 22 Mar 2025 08:21:50 -0700
Subject: [PATCH] [CodeGen] Avoid repeated hash lookups (NFC)
---
llvm/include/llvm/CodeGen/MachinePipeliner.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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