[llvm] [SLP] Avoid repeated hash lookups (NFC) (PR #115428)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 8 00:16:38 PST 2024
https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/115428
>From f33fdbaf2403b64be05d31b6e9cefc030a94ce60 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 7 Nov 2024 21:21:21 -0800
Subject: [PATCH 1/2] [SLP] Avoid repeated hash lookups (NFC)
---
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index b2f677fb84f983..782b5dc05f8791 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -2241,10 +2241,9 @@ class BoUpSLP {
HashMap[NumFreeOpsHash.Hash] = std::make_pair(1, Lane);
} else if (NumFreeOpsHash.NumOfAPOs == Min &&
NumFreeOpsHash.NumOpsWithSameOpcodeParent == SameOpNumber) {
- auto *It = HashMap.find(NumFreeOpsHash.Hash);
- if (It == HashMap.end())
- HashMap[NumFreeOpsHash.Hash] = std::make_pair(1, Lane);
- else
+ auto [It, Inserted] =
+ HashMap.try_emplace(NumFreeOpsHash.Hash, 1, Lane);
+ if (!Inserted)
++It->second.first;
}
}
>From fef1b642af4f606dc8791a27bd25afea9982d056 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 8 Nov 2024 00:16:25 -0800
Subject: [PATCH 2/2] Trigger build
More information about the llvm-commits
mailing list