[llvm] 2461bc1 - [Convergence] Avoid repeated hash lookups (NFC) (#107515)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 07:40:55 PDT 2024


Author: Kazu Hirata
Date: 2024-09-06T07:40:51-07:00
New Revision: 2461bc1c7ad5a78f39f75c6e99acf502b83401d2

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

LOG: [Convergence] Avoid repeated hash lookups (NFC) (#107515)

Added: 
    

Modified: 
    llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h

Removed: 
    


################################################################################
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;


        


More information about the llvm-commits mailing list