[llvm] [Transforms] Avoid repeated hash lookups (NFC) (PR #130708)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 11 07:42:36 PDT 2025


================
@@ -148,7 +148,8 @@ void PseudoProbeVerifier::verifyProbeFactors(
   auto &PrevProbeFactors = FunctionProbeFactors[F->getName()];
   for (const auto &I : ProbeFactors) {
     float CurProbeFactor = I.second;
-    if (PrevProbeFactors.count(I.first)) {
+    auto [It, Inserted] = PrevProbeFactors.try_emplace(I.first);
+    if (!Inserted) {
       float PrevProbeFactor = PrevProbeFactors[I.first];
----------------
kazutakahirata wrote:

@nikic Oops.  Fixed.  Thank you for pointing this out!

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


More information about the llvm-commits mailing list