| From 2fdc5d336ed1fdcde4700a4c23777e0959d5c8d7 Mon Sep 17 00:00:00 2001 |
| From: Rafael Auler <rafaelauler@fb.com> |
| Date: Fri, 13 May 2022 15:51:36 -0700 |
| Subject: [PATCH] [BOLT] Fix merge-fdata handling of BAT profiles |
| |
| When a profile is collected in a BOLTed binary, the generated |
| profile is tagged with a header string "boltedcollection" in the first |
| line of the fdata file. Fix merge-fdata to recognize this header |
| string and preserve it into the output. |
| |
| Reviewed By: Amir |
| |
| Differential Revision: https://reviews.llvm.org/D125591 |
| --- |
| bolt/tools/merge-fdata/merge-fdata.cpp | 5 +++-- |
| 1 file changed, 3 insertions(+), 2 deletions(-) |
| |
| diff --git a/bolt/tools/merge-fdata/merge-fdata.cpp b/bolt/tools/merge-fdata/merge-fdata.cpp |
| index 5738219247b..d0764646b0a 100644 |
| --- a/bolt/tools/merge-fdata/merge-fdata.cpp |
| +++ b/bolt/tools/merge-fdata/merge-fdata.cpp |
| @@ -257,8 +257,7 @@ void mergeLegacyProfiles(const cl::list<std::string> &Filenames) { |
| Filename, |
| "cannot mix profile collected in BOLT and non-BOLT deployments"); |
| BoltedCollection = true; |
| - if (!First) |
| - Buf = Buf.drop_front(17); |
| + Buf = Buf.drop_front(17); |
| } else { |
| if (BoltedCollection) |
| report_error( |
| @@ -282,6 +281,8 @@ void mergeLegacyProfiles(const cl::list<std::string> &Filenames) { |
| First = false; |
| } |
| |
| + if (BoltedCollection) |
| + outs() << "boltedcollection\n"; |
| for (const auto &Entry : Entries) |
| outs() << Entry.getKey() << " " << Entry.getValue() << "\n"; |
| |
| -- |
| 2.36.1.255.ge46751e96f-goog |
| |