[llvm] [Convergence] Avoid repeated hash lookups (NFC) (PR #107515)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 5 21:20:23 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/107515
None
>From 2203672e5abfb8a9cba6edb15d1350b09130e6ee Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 5 Sep 2024 21:11:13 -0700
Subject: [PATCH] [Convergence] Avoid repeated hash lookups (NFC)
---
llvm/include/llvm/IR/GenericConvergenceVerifierImpl.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
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