[clang] [CodeGen] Avoid repeated hash lookup (NFC) (PR #108735)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 15 00:05:23 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/108735
None
>From 244ac0c6799d4cd1afb4134fbbd711e4250b96d4 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 13 Sep 2024 21:27:55 -0700
Subject: [PATCH] [CodeGen] Avoid repeated hash lookup (NFC)
---
clang/lib/CodeGen/CGOpenMPRuntime.cpp | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
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