[llvm] [nfc][ctx_prof] Efficient profile traversal and update (PR #110052)
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 26 17:57:52 PDT 2024
================
@@ -279,16 +278,44 @@ static void preorderVisit(ProfilesTy &Profiles,
Traverser(P);
}
-void PGOContextualProfile::update(Visitor V, const Function *F) {
- GlobalValue::GUID G = F ? getDefinedFunctionGUID(*F) : 0U;
+void PGOContextualProfile::initIndex() {
+ // Initialize the head of the index list for each function. We don't need it
+ // after this point.
+ DenseMap<GlobalValue::GUID, PGOCtxProfContext *> InsertionPoints;
----------------
mtrofin wrote:
`InsertionPoints` is for the end of the map, where we insert, `FuncInfo` holds the beginning. We don't care about inserting later. DenseMap is a good fit here, it's just a temporary tool, no need for iterator stability.
https://github.com/llvm/llvm-project/pull/110052
More information about the llvm-commits
mailing list