aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/SampleProfReader.cpp
diff options
context:
space:
mode:
authorRong Xu <xur@google.com>2021-08-25 09:07:34 -0700
committerRong Xu <xur@google.com>2021-08-25 09:07:34 -0700
commit24201b6437b2acad035fe474ec37f733e9045174 (patch)
treeabb6946968b70d2932f90b362fc5eac1034ce737 /llvm/lib/ProfileData/SampleProfReader.cpp
parenta6f15e9a49a1a5bcd1ce7f30b1201d977d8a8ede (diff)
downloadllvm-24201b6437b2acad035fe474ec37f733e9045174.zip
llvm-24201b6437b2acad035fe474ec37f733e9045174.tar.gz
llvm-24201b6437b2acad035fe474ec37f733e9045174.tar.bz2
[SampleFDO] Set ProfileIsFS bit properly from the internal option
We have "-profile-isfs" internal option for text, binary, and compactbinary format (mostly for debug and test purpose). We need to set the related flag in FunctionSamples so that ProfileIsFS is written to the header in extbinary format. Differential Revision: https://reviews.llvm.org/D108707
Diffstat (limited to 'llvm/lib/ProfileData/SampleProfReader.cpp')
-rw-r--r--llvm/lib/ProfileData/SampleProfReader.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp
index 7fc9552..b40361b 100644
--- a/llvm/lib/ProfileData/SampleProfReader.cpp
+++ b/llvm/lib/ProfileData/SampleProfReader.cpp
@@ -251,6 +251,7 @@ std::error_code SampleProfileReaderText::readImpl() {
bool SeenMetadata = false;
ProfileIsFS = ProfileIsFSDisciminator;
+ FunctionSamples::ProfileIsFS = ProfileIsFS;
for (; !LineIt.is_at_eof(); ++LineIt) {
if ((*LineIt)[(*LineIt).find_first_not_of(' ')] == '#')
continue;
@@ -599,6 +600,7 @@ SampleProfileReaderBinary::readFuncProfile(const uint8_t *Start) {
std::error_code SampleProfileReaderBinary::readImpl() {
ProfileIsFS = ProfileIsFSDisciminator;
+ FunctionSamples::ProfileIsFS = ProfileIsFS;
while (!at_eof()) {
if (std::error_code EC = readFuncProfile(Data))
return EC;
@@ -887,6 +889,7 @@ std::error_code SampleProfileReaderCompactBinary::readImpl() {
// given a module.
bool LoadFuncsToBeUsed = collectFuncsFromModule();
ProfileIsFS = ProfileIsFSDisciminator;
+ FunctionSamples::ProfileIsFS = ProfileIsFS;
std::vector<uint64_t> OffsetsToUse;
if (!LoadFuncsToBeUsed) {
// load all the function profiles.