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

via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 7 16:14:51 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/107729.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp (+1-2) 


``````````diff
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;
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/107729


More information about the llvm-commits mailing list