[PATCH] D101300: [CSSPGO] Explicitly disallow Binary and Compact Binary profile format for CSSPGO

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 26 08:26:07 PDT 2021


wenlei created this revision.
wenlei added reviewers: hoy, wlei, wmi.
Herald added subscribers: modimo, lxfind, hiraditya.
wenlei requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

CSSPGO only supports text and extended binary profile now. Raw binary does not have the metadata section CSSPGO needs, and Compact binary profile needs special handling for GUID based context names, which is not yet implemented.

Disasslow these two format for CSSPGO profile writing to avoid silently generating invalid profiles.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101300

Files:
  llvm/lib/ProfileData/SampleProfWriter.cpp


Index: llvm/lib/ProfileData/SampleProfWriter.cpp
===================================================================
--- llvm/lib/ProfileData/SampleProfWriter.cpp
+++ llvm/lib/ProfileData/SampleProfWriter.cpp
@@ -776,6 +776,11 @@
   std::error_code EC;
   std::unique_ptr<SampleProfileWriter> Writer;
 
+  // Currently only Text and Extended Binary format are supported for CSSPGO.
+  if ((FunctionSamples::ProfileIsCS || FunctionSamples::ProfileIsProbeBased) &&
+      (Format == SPF_Binary || Format == SPF_Compact_Binary))
+    return sampleprof_error::unsupported_writing_format;
+
   if (Format == SPF_Binary)
     Writer.reset(new SampleProfileWriterRawBinary(OS));
   else if (Format == SPF_Ext_Binary)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101300.340534.patch
Type: text/x-patch
Size: 710 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210426/37819dc6/attachment.bin>


More information about the llvm-commits mailing list