[llvm] [SystemZ] Avoid repeated hash lookups (NFC) (PR #126005)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 5 21:00:35 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/126005
None
>From 1d8a4901166c89d429e4fcaaefdb8b858d6a7c2e Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 5 Feb 2025 09:53:33 -0800
Subject: [PATCH] [SystemZ] Avoid repeated hash lookups (NFC)
---
llvm/lib/Target/SystemZ/SystemZISelLowering.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
index 1fb31c26e20d3c1..a1e02c0c32b61dd 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -6173,8 +6173,9 @@ SystemZTargetLowering::buildVector(SelectionDAG &DAG, const SDLoc &DL, EVT VT,
for (unsigned I = 0; I < NumElements; ++I)
if (isVectorElementLoad(Elems[I])) {
SDNode *Ld = Elems[I].getNode();
- UseCounts[Ld]++;
- if (LoadMaxUses == nullptr || UseCounts[LoadMaxUses] < UseCounts[Ld])
+ auto &Count = UseCounts[Ld];
+ ++Count;
+ if (LoadMaxUses == nullptr || UseCounts[LoadMaxUses] < Count)
LoadMaxUses = Ld;
}
if (LoadMaxUses != nullptr) {
More information about the llvm-commits
mailing list