Skip to content

Commit 915fe84

Browse files
[ctx_prof] Simplify ingestContext (NFC) (#109902)
try_emplace can default-construct the value, so: try_emplace(CSId, CallTargetMapTy()) try_emplace(CSId) are equivalent to each other. We can further simplify the function using the fact that Map.try_emplace(Key).first->second is the same as Map[Key].
1 parent e1365ce commit 915fe84

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

llvm/include/llvm/ProfileData/PGOCtxProfReader.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ class PGOCtxProfContext final {
6868
CallsiteMapTy &callsites() { return Callsites; }
6969

7070
void ingestContext(uint32_t CSId, PGOCtxProfContext &&Other) {
71-
auto [Iter, _] = callsites().try_emplace(CSId, CallTargetMapTy());
72-
Iter->second.emplace(Other.guid(), std::move(Other));
71+
callsites()[CSId].emplace(Other.guid(), std::move(Other));
7372
}
7473

7574
void ingestAllContexts(uint32_t CSId, CallTargetMapTy &&Other) {

0 commit comments

Comments
 (0)