[PATCH] D108433: [CSSPGO] split context string - compiler changes

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 20 14:50:53 PDT 2021


hoy added inline comments.


================
Comment at: llvm/include/llvm/ProfileData/SampleProf.h:473
 
-  // Reconstruct a new context with the last k frames, return the context-less
-  // name if K = 1
-  StringRef getContextWithLastKFrames(uint32_t K) {
-    if (K == 1)
-      return getNameWithoutContext();
-
-    size_t I = FullContext.size();
-    while (K--) {
-      I = FullContext.find_last_of(" @ ", I);
-      if (I == StringRef::npos)
-        return FullContext;
-      I -= 2;
-    }
-    return FullContext.slice(I + 3, StringRef::npos);
+  SampleContext(SampleContextStorageType Context,
+                ContextStateMask CState = RawContext)
----------------
wmi wrote:
> SampleContextStorageType &Context? Otherwise FullContext will refer to a temporary object.
Nice catch. This constructor should not be used. I just removed it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108433



More information about the llvm-commits mailing list