[llvm] b2d0793 - [CSSPGO] Explicitly disallow Binary and Compact Binary profile format for CSSPGO
Wenlei He via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 26 09:10:41 PDT 2021
Author: Wenlei He
Date: 2021-04-26T09:10:24-07:00
New Revision: b2d079379b6c7b3942d728c9b290ae252f7921c5
URL: https://github.com/llvm/llvm-project/commit/b2d079379b6c7b3942d728c9b290ae252f7921c5
DIFF: https://github.com/llvm/llvm-project/commit/b2d079379b6c7b3942d728c9b290ae252f7921c5.diff
LOG: [CSSPGO] Explicitly disallow Binary and Compact Binary profile format 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
Added:
Modified:
llvm/lib/ProfileData/SampleProfWriter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ProfileData/SampleProfWriter.cpp b/llvm/lib/ProfileData/SampleProfWriter.cpp
index 43cfb9380a9e..73565f2a6b98 100644
--- a/llvm/lib/ProfileData/SampleProfWriter.cpp
+++ b/llvm/lib/ProfileData/SampleProfWriter.cpp
@@ -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)
More information about the llvm-commits
mailing list