From d57848828e7be5af2ddd85de29c2a7d6d43c0eee Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Fri, 2 Apr 2021 11:55:22 -0700 Subject: [PATCH] Avoid a redundant set operation in ProfileFuncs::MergeInProfile() --- src/script_opt/ProfileFunc.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/script_opt/ProfileFunc.cc b/src/script_opt/ProfileFunc.cc index ac7fa241da..29d873dd34 100644 --- a/src/script_opt/ProfileFunc.cc +++ b/src/script_opt/ProfileFunc.cc @@ -458,10 +458,10 @@ void ProfileFuncs::MergeInProfile(ProfileFunc* pf) for ( auto& g : pf->Globals() ) { - if ( globals.count(g) > 0 ) - continue; + auto [it, inserted] = globals.emplace(g); - globals.insert(g); + if ( ! inserted ) + continue; auto& v = g->GetVal(); if ( v )