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 )