[PATCH] D125246: [CSSPGO][llvm-profgen] Reimplement CS profile generator using context trie

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 22 22:50:14 PDT 2022


wlei added inline comments.


================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:980-981
+  assert(
+      !CheckIfHasValidFSamples(&getRootContext()) &&
+      "After the conversion, there should be no valid FunctionSamples on trie");
+}
----------------
wenlei wrote:
> wlei wrote:
> > wenlei wrote:
> > > I was thinking about checking to make sure things are valid before conversion. Checking after conversion doesn't prevent double conversion where the 2nd conversion would be wrong. We could also have a simple state boolean to represent the statefulness and use that for checks.
> > By a valid state, do you mean to check that the trie node's `getAllChildren` is not empty?
> > 
> I was thinking of valid state as an abstract term -- since the conversion destroy the original profile on trie through move etc, after conversion the function samples on the trie is no longer valid. We could simply have a boolean isProfileValidOnTrie as a state, set it to false inside convert function, and also check it is true at the beginning of conversion..  
Ah, I see, thanks for the clarification!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125246/new/

https://reviews.llvm.org/D125246



More information about the llvm-commits mailing list