[llvm] [Convergence] Avoid repeated hash lookups (NFC) (PR #107515)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 21:20:51 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-ir

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h (+2-3) 


``````````diff
diff --git a/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h b/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h
index 7525c9eb758bef..e076ac4a14162a 100644
--- a/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h
+++ b/llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h
@@ -210,11 +210,10 @@ void GenericConvergenceVerifier<ContextT>::verify(const DominatorTreeT &DT) {
     // Propagate token liveness
     for (auto *Succ : successors(BB)) {
       auto *SuccNode = DT.getNode(Succ);
-      auto LTIt = LiveTokenMap.find(Succ);
-      if (LTIt == LiveTokenMap.end()) {
+      auto [LTIt, Inserted] = LiveTokenMap.try_emplace(Succ);
+      if (Inserted) {
         // We're the first predecessor: all tokens which dominate the
         // successor are live for now.
-        LTIt = LiveTokenMap.try_emplace(Succ).first;
         for (auto LiveToken : LiveTokens) {
           if (!DT.dominates(DT.getNode(LiveToken->getParent()), SuccNode))
             break;

``````````

</details>


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


More information about the llvm-commits mailing list