[clang] cc96ce8 - [CodeGen] Avoid repeated hash lookup (NFC) (#108735)

via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 15 01:20:31 PDT 2024


Author: Kazu Hirata
Date: 2024-09-15T01:20:29-07:00
New Revision: cc96ce831cda8f70897926fdce6a83519fe5b31e

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

LOG: [CodeGen] Avoid repeated hash lookup (NFC) (#108735)

Added: 
    

Modified: 
    clang/lib/CodeGen/CGOpenMPRuntime.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 807f9881f53f40..7a94c4d522d0c3 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -7815,12 +7815,7 @@ class MappableExprsHandler {
             const Expr *VarRef = nullptr, bool ForDeviceAddr = false) {
           if (SkipVarSet.contains(D))
             return;
-          auto It = Info.find(D);
-          if (It == Info.end())
-            It = Info
-                     .insert(std::make_pair(
-                         D, SmallVector<SmallVector<MapInfo, 8>, 4>(Total)))
-                     .first;
+          auto It = Info.try_emplace(D, Total).first;
           It->second[Kind].emplace_back(
               L, MapType, MapModifiers, MotionModifiers, ReturnDevicePointer,
               IsImplicit, Mapper, VarRef, ForDeviceAddr);


        


More information about the cfe-commits mailing list