[PATCH] D95929: [CSSPGO][llvm-profgen] Add brackets for context id to support extended binary format

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 3 11:10:54 PST 2021


wlei added inline comments.


================
Comment at: llvm/lib/ProfileData/SampleProfWriter.cpp:364
   if (FunctionSamples::ProfileIsCS)
-    OS << "[" << S.getNameWithContext() << "]:" << S.getTotalSamples();
+    OS << S.getNameWithContext(true) << ":" << S.getTotalSamples();
   else
----------------
hoy wrote:
> The whole `if-else` can be just replaced by `OS << S.getNameWithContext(true) << ":" << S.getTotalSamples();`
I see, thanks, `FunctionSamples::ProfileIsCS` is already checked in  `getNameWithContext`.


================
Comment at: llvm/tools/llvm-profgen/ProfileGenerator.cpp:276
+    } else {
+      OCalleeCtxStr << "[";
     }
----------------
hoy wrote:
> Should this be run unconditionally?
in line273 `ContextId.rsplit(" @ ").first.str();` has already had the '[', so only add for the else branch


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95929



More information about the llvm-commits mailing list