Skip to content

Commit

Permalink
[CSSPGO] Explicitly disallow Binary and Compact Binary profile format…
Browse files Browse the repository at this point in the history
… for CSSPGO

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.

Differential Revision: https://reviews.llvm.org/D101300
  • Loading branch information
WenleiHe committed Apr 26, 2021
1 parent 153144b commit b2d0793
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions llvm/lib/ProfileData/SampleProfWriter.cpp
Expand Up @@ -776,6 +776,11 @@ SampleProfileWriter::create(std::unique_ptr<raw_ostream> &OS,
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)
Expand Down

0 comments on commit b2d0793

Please sign in to comment.