aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/SampleProfWriter.cpp
diff options
context:
space:
mode:
authorwlei <wlei@fb.com>2021-02-03 14:13:06 -0800
committerwlei <wlei@fb.com>2021-02-12 01:14:53 -0800
commitc3aeabaea16ebe7653004a9af4ac337a34ec9275 (patch)
tree3426a97ffa8af812e58abbd1d04bc7c8da728468 /llvm/lib/ProfileData/SampleProfWriter.cpp
parent16213e1f509a2e8b7ab25731192279254a2b5377 (diff)
downloadllvm-c3aeabaea16ebe7653004a9af4ac337a34ec9275.zip
llvm-c3aeabaea16ebe7653004a9af4ac337a34ec9275.tar.gz
llvm-c3aeabaea16ebe7653004a9af4ac337a34ec9275.tar.bz2
[CSSPGO][llvm-profgen] Add brackets for context id to support extended binary format
To align with https://reviews.llvm.org/D95547, we need to add brackets for context id before initializing the `SampleContext`. Also added test cases for extended binary format from llvm-profgen side. Differential Revision: https://reviews.llvm.org/D95929
Diffstat (limited to 'llvm/lib/ProfileData/SampleProfWriter.cpp')
-rw-r--r--llvm/lib/ProfileData/SampleProfWriter.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/llvm/lib/ProfileData/SampleProfWriter.cpp b/llvm/lib/ProfileData/SampleProfWriter.cpp
index b388b78..8017f2a 100644
--- a/llvm/lib/ProfileData/SampleProfWriter.cpp
+++ b/llvm/lib/ProfileData/SampleProfWriter.cpp
@@ -360,10 +360,7 @@ std::error_code SampleProfileWriterCompactBinary::write(
/// it needs to be parsed by the SampleProfileReaderText class.
std::error_code SampleProfileWriterText::writeSample(const FunctionSamples &S) {
auto &OS = *OutputStream;
- if (FunctionSamples::ProfileIsCS)
- OS << "[" << S.getNameWithContext() << "]:" << S.getTotalSamples();
- else
- OS << S.getName() << ":" << S.getTotalSamples();
+ OS << S.getNameWithContext(true) << ":" << S.getTotalSamples();
if (Indent == 0)
OS << ":" << S.getHeadSamples();
OS << "\n";