[llvm] [Analysis] Avoid repeated hash lookups (NFC) (PR #109564)

via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 21 22:44:28 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-analysis

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) llvm/include/llvm/Analysis/GenericDomTreeUpdaterImpl.h (+1-2) 


``````````diff
diff --git a/llvm/include/llvm/Analysis/GenericDomTreeUpdaterImpl.h b/llvm/include/llvm/Analysis/GenericDomTreeUpdaterImpl.h
index 35c54a6062bfd4..b79eaef57710fa 100644
--- a/llvm/include/llvm/Analysis/GenericDomTreeUpdaterImpl.h
+++ b/llvm/include/llvm/Analysis/GenericDomTreeUpdaterImpl.h
@@ -107,8 +107,7 @@ void GenericDomTreeUpdater<DerivedT, DomTreeT, PostDomTreeT>::
     // b. If the edge doesn't exist, we can then infer that {Delete, A, B}
     // actually happened but {Insert, A, B} was an invalid update which never
     // happened. DTU will submit {Delete, A, B} in this case.
-    if (!isSelfDominance(U) && Seen.count(Edge) == 0) {
-      Seen.insert(Edge);
+    if (!isSelfDominance(U) && Seen.insert(Edge).second) {
       // If the update doesn't appear in the CFG, it means that
       // either the change isn't made or relevant operations
       // result in a no-op.

``````````

</details>


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


More information about the llvm-commits mailing list