From 9072c71de2bab004f377e62f06fb684350eefaf9 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Wed, 19 Mar 2025 08:00:45 -0700 Subject: [PATCH] [IPO] Avoid repeated map lookups (NFC) --- llvm/lib/Transforms/IPO/SampleContextTracker.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Transforms/IPO/SampleContextTracker.cpp b/llvm/lib/Transforms/IPO/SampleContextTracker.cpp index 270ca56d04823..c8f203e8ce3ee 100644 --- a/llvm/lib/Transforms/IPO/SampleContextTracker.cpp +++ b/llvm/lib/Transforms/IPO/SampleContextTracker.cpp @@ -189,8 +189,9 @@ ContextTrieNode *ContextTrieNode::getOrCreateChildContext( if (!AllowCreate) return nullptr; - AllChildContext[Hash] = ContextTrieNode(this, CalleeName, nullptr, CallSite); - return &AllChildContext[Hash]; + ContextTrieNode &ACC = AllChildContext[Hash]; + ACC = ContextTrieNode(this, CalleeName, nullptr, CallSite); + return &ACC; } // Profiler tracker than manages profiles and its associated context