[llvm] [CSSPGO]Add a flag to limit unsymbolized context depth (PR #121531)

Lei Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 6 18:09:34 PST 2025


================
@@ -172,7 +177,13 @@ std::shared_ptr<AddrBasedCtxKey> AddressStack::getContextKey() {
   std::shared_ptr<AddrBasedCtxKey> KeyStr = std::make_shared<AddrBasedCtxKey>();
   KeyStr->Context = Stack;
   CSProfileGenerator::compressRecursionContext<uint64_t>(KeyStr->Context);
-  CSProfileGenerator::trimContext<uint64_t>(KeyStr->Context);
+  int Depth = CSProfileGenerator::MaxContextDepth != -1
+                  ? CSProfileGenerator::MaxContextDepth
+                  : KeyStr->Context.size();
+  Depth = CSProfMaxUnsymbolizedCtxDepth != -1
+              ? std::min(static_cast<int>(CSProfMaxUnsymbolizedCtxDepth), Depth)
----------------
wlei-llvm wrote:

It gave error`deduced conflicting types for parameter '_Tp' ('cl::opt<int>' vs. 'int')` without the casting, it seems the deduction doesn't work very well for some environment.

https://github.com/llvm/llvm-project/pull/121531


More information about the llvm-commits mailing list