[llvm] bc59b63 - [Vectorize] Avoid repeated hash lookups (NFC) (#107729)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 8 00:08:36 PDT 2024


Author: Kazu Hirata
Date: 2024-09-08T00:08:32-07:00
New Revision: bc59b638ae35594b55a439a5986519a3f9cc903d

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

LOG: [Vectorize] Avoid repeated hash lookups (NFC) (#107729)

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp b/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp
index 765dc983cab4fb..dfddb5b45f623d 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp
@@ -177,9 +177,8 @@ bool VPlanVerifier::verifyVPBasicBlock(const VPBasicBlock *VPBB) {
 static bool hasDuplicates(const SmallVectorImpl<VPBlockBase *> &VPBlockVec) {
   SmallDenseSet<const VPBlockBase *, 8> VPBlockSet;
   for (const auto *Block : VPBlockVec) {
-    if (VPBlockSet.count(Block))
+    if (!VPBlockSet.insert(Block).second)
       return true;
-    VPBlockSet.insert(Block);
   }
   return false;
 }


        


More information about the llvm-commits mailing list