[llvm] [Analysis] Avoid repeated hash lookups (NFC) (PR #132512)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 21 20:53:39 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/132512
None
>From 075f7895029f936ff3b4a71d43f0e9da2c501553 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 21 Mar 2025 08:29:52 -0700
Subject: [PATCH] [Analysis] Avoid repeated hash lookups (NFC)
---
llvm/lib/Analysis/IRSimilarityIdentifier.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
index e1daf02ee6bba..ca011362702ac 100644
--- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
+++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
@@ -728,11 +728,10 @@ bool IRSimilarityCandidate::compareAssignmentMapping(
for (unsigned OtherVal : ValueMappingIt->second) {
if (OtherVal == InstValB)
continue;
- if (!ValueNumberMappingA.contains(OtherVal))
+ auto OtherValIt = ValueNumberMappingA.find(OtherVal);
+ if (OtherValIt == ValueNumberMappingA.end())
continue;
- if (!ValueNumberMappingA[OtherVal].contains(InstValA))
- continue;
- ValueNumberMappingA[OtherVal].erase(InstValA);
+ OtherValIt->second.erase(InstValA);
}
ValueNumberMappingA.erase(ValueMappingIt);
std::tie(ValueMappingIt, WasInserted) = ValueNumberMappingA.insert(
More information about the llvm-commits
mailing list