[PATCH] D108707: [SampleFDO] Set ProfileIsFS bit properly in extbinary format from the internal option

Rong Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 25 09:17:45 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG24201b6437b2: [SampleFDO] Set ProfileIsFS bit properly from the internal option (authored by xur).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108707/new/

https://reviews.llvm.org/D108707

Files:
  llvm/lib/ProfileData/SampleProfReader.cpp
  llvm/test/tools/llvm-profdata/sample-fs.test


Index: llvm/test/tools/llvm-profdata/sample-fs.test
===================================================================
--- llvm/test/tools/llvm-profdata/sample-fs.test
+++ llvm/test/tools/llvm-profdata/sample-fs.test
@@ -52,3 +52,7 @@
 RUN: llvm-profdata show --sample %p/Inputs/sample-fs.proftext -profile-isfs -fs-discriminator-pass=Pass1 -o %t3-text
 RUN: diff %t3-binary %t3-text
 
+4- ProfileIsFS is set properly in extbinary format from the internal option
+RUN: llvm-profdata merge --sample %p/Inputs/sample-fs.proftext -profile-isfs --extbinary -o %t_extbin.afdo
+RUN: llvm-profdata show --sample --show-sec-info-only %t_extbin.afdo | FileCheck %s --check-prefix=ISFSSET
+ISFSSET: Flags: {fs-discriminator}
Index: llvm/lib/ProfileData/SampleProfReader.cpp
===================================================================
--- llvm/lib/ProfileData/SampleProfReader.cpp
+++ llvm/lib/ProfileData/SampleProfReader.cpp
@@ -251,6 +251,7 @@
   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 @@
 
 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 @@
   // given a module.
   bool LoadFuncsToBeUsed = collectFuncsFromModule();
   ProfileIsFS = ProfileIsFSDisciminator;
+  FunctionSamples::ProfileIsFS = ProfileIsFS;
   std::vector<uint64_t> OffsetsToUse;
   if (!LoadFuncsToBeUsed) {
     // load all the function profiles.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108707.368667.patch
Type: text/x-patch
Size: 1742 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210825/e05c6847/attachment.bin>


More information about the llvm-commits mailing list