[llvm] [Vectorize] Avoid repeated hash lookups (NFC) (PR #126345)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 7 20:55:34 PST 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/126345

None

>From aafc9688d57b764cb6db19ef9faa995f8fc17ba4 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 7 Feb 2025 08:11:42 -0800
Subject: [PATCH] [Vectorize] Avoid repeated hash lookups (NFC)

---
 llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
index 0b40b733ffe7ee7..04b392829f0d78d 100644
--- a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
@@ -1335,8 +1335,9 @@ void Vectorizer::mergeEquivalenceClasses(EquivalenceClassMap &EQClasses) const {
     const auto &Key = EC.first;
     EqClassReducedKey RedKey{std::get<1>(Key), std::get<2>(Key),
                              std::get<3>(Key)};
-    RedKeyToUOMap[RedKey].insert(std::get<0>(Key));
-    if (RedKeyToUOMap[RedKey].size() > 1)
+    auto &UOMap = RedKeyToUOMap[RedKey];
+    UOMap.insert(std::get<0>(Key));
+    if (UOMap.size() > 1)
       FoundPotentiallyOptimizableEC = true;
   }
   if (!FoundPotentiallyOptimizableEC)



More information about the llvm-commits mailing list