[llvm] f5d3c87 - [IPO] Simplify code with StringMap::operator[] (NFC) (#112490)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 06:41:44 PDT 2024


Author: Kazu Hirata
Date: 2024-10-16T06:41:40-07:00
New Revision: f5d3c87ede965d3cb4dd58aeed0a0b94e674b997

URL: https://github.com/llvm/llvm-project/commit/f5d3c87ede965d3cb4dd58aeed0a0b94e674b997
DIFF: https://github.com/llvm/llvm-project/commit/f5d3c87ede965d3cb4dd58aeed0a0b94e674b997.diff

LOG: [IPO] Simplify code with StringMap::operator[] (NFC) (#112490)

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/IPO/SampleProfileMatcher.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/IPO/SampleProfileMatcher.h b/llvm/include/llvm/Transforms/IPO/SampleProfileMatcher.h
index 076d91adfd1dea..4e757b29961817 100644
--- a/llvm/include/llvm/Transforms/IPO/SampleProfileMatcher.h
+++ b/llvm/include/llvm/Transforms/IPO/SampleProfileMatcher.h
@@ -201,9 +201,7 @@ class SampleProfileMatcher {
   void UpdateWithSalvagedProfiles();
 
   LocToLocMap &getIRToProfileLocationMap(const Function &F) {
-    auto Ret = FuncMappings.try_emplace(
-        FunctionSamples::getCanonicalFnName(F.getName()), LocToLocMap());
-    return Ret.first->second;
+    return FuncMappings[FunctionSamples::getCanonicalFnName(F.getName())];
   }
   void distributeIRToProfileLocationMap();
   void distributeIRToProfileLocationMap(FunctionSamples &FS);


        


More information about the llvm-commits mailing list