[PATCH] D127031: [CSSPGO][llvm-profgen] Reimplement SampleContextTracker using context trie
Lei Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 14 12:29:41 PDT 2022
wlei added inline comments.
================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:1008
+ } else {
+ ContextTracker.freeFSamples();
+ }
----------------
hoy wrote:
> I'm wondering if these two deallocations can be combined. Maybe in `buildProfileMap` we could exclude merged contexts there and then we don't need to do `Node->setFunctionSamples(nullptr);` inside `CSPreInliner::run`?
The `merged contexts` node is removed from the trie after merging, so we can't traverse the whole trie to delete all the FSamples. That's why I was thinking to leverage the `FuncToCtxtProfiles` which stores all the FSample pointers at the beginning. And if it's not the preinliner pass, `FuncToCtxtProfiles` is empty, then we need to traverse the trie to delete them.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127031/new/
https://reviews.llvm.org/D127031
More information about the llvm-commits
mailing list