[llvm] ea24836 - [IPO] Avoid repeated map lookups (NFC) (#128462)

via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 23 23:43:31 PST 2025


Author: Kazu Hirata
Date: 2025-02-23T23:43:28-08:00
New Revision: ea248365fa1539262c82943f50e28ed47687033d

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

LOG: [IPO] Avoid repeated map lookups (NFC) (#128462)

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/SampleContextTracker.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/SampleContextTracker.cpp b/llvm/lib/Transforms/IPO/SampleContextTracker.cpp
index f878e3e591a05..270ca56d04823 100644
--- a/llvm/lib/Transforms/IPO/SampleContextTracker.cpp
+++ b/llvm/lib/Transforms/IPO/SampleContextTracker.cpp
@@ -71,8 +71,8 @@ SampleContextTracker::moveContextSamples(ContextTrieNode &ToNodeParent,
   std::map<uint64_t, ContextTrieNode> &AllChildContext =
       ToNodeParent.getAllChildContext();
   assert(!AllChildContext.count(Hash) && "Node to remove must exist");
-  AllChildContext[Hash] = NodeToMove;
   ContextTrieNode &NewNode = AllChildContext[Hash];
+  NewNode = NodeToMove;
   NewNode.setCallSiteLoc(CallSite);
 
   // Walk through nodes in the moved the subtree, and update


        


More information about the llvm-commits mailing list