diff --git a/0008-merge-fdata-Support-process-no_lbr-profile-file.patch b/0008-merge-fdata-Support-process-no_lbr-profile-file.patch new file mode 100644 index 0000000000000000000000000000000000000000..3ba709f6bb54bb678707d533288527db6eb5a354 --- /dev/null +++ b/0008-merge-fdata-Support-process-no_lbr-profile-file.patch @@ -0,0 +1,58 @@ +From 583d41ce046670eae7a59fb678a9e959cf0af061 Mon Sep 17 00:00:00 2001 +From: liyancheng <412998149@qq.com> +Date: Tue, 10 Sep 2024 15:09:51 +0800 +Subject: [PATCH] [merge-fdata] Support processing no_lbr profile file + +--- + bolt/tools/merge-fdata/merge-fdata.cpp | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/bolt/tools/merge-fdata/merge-fdata.cpp b/bolt/tools/merge-fdata/merge-fdata.cpp +index 757f05366..147e18639 100644 +--- a/bolt/tools/merge-fdata/merge-fdata.cpp ++++ b/bolt/tools/merge-fdata/merge-fdata.cpp +@@ -261,6 +261,7 @@ bool isYAML(const StringRef Filename) { + void mergeLegacyProfiles(const SmallVectorImpl &Filenames) { + errs() << "Using legacy profile format.\n"; + std::optional BoltedCollection; ++ std::optional NoLBRMode; + std::mutex BoltedCollectionMutex; + typedef StringMap ProfileTy; + +@@ -294,6 +295,22 @@ void mergeLegacyProfiles(const SmallVectorImpl &Filenames) { + BoltedCollection = false; + } + ++ // Check if the string "no_lbr" is in the first line ++ if (Buf.startswith("no_lbr")) { ++ if (!NoLBRMode.value_or(true)) ++ report_error( ++ Filename, ++ "cannot mix profile collected with lbr and non-lbr info"); ++ NoLBRMode = true; ++ Buf = Buf.drop_front(Buf.find_first_of("\n")); ++ } else { ++ if (NoLBRMode.value_or(false)) ++ report_error( ++ Filename, ++ "cannot mix profile collected with lbr and non-lbr info"); ++ NoLBRMode = false; ++ } ++ + Profile = &Profiles[tid]; + } + +@@ -329,7 +346,9 @@ void mergeLegacyProfiles(const SmallVectorImpl &Filenames) { + MergedProfile.insert_or_assign(Key, Count); + } + +- if (BoltedCollection) ++ if (NoLBRMode) ++ output() << "no_lbr cycles:u:\n"; ++ else if (BoltedCollection) + output() << "boltedcollection\n"; + for (const auto &[Key, Value] : MergedProfile) + output() << Key << " " << Value << "\n"; +-- +2.33.0 + diff --git a/llvm-bolt.spec b/llvm-bolt.spec index cce50cdf56631dbdabc7b81d717f7e1de15fe406..832a69fd9b3f52be94f7dae83dd26988344f3eca 100644 --- a/llvm-bolt.spec +++ b/llvm-bolt.spec @@ -22,7 +22,7 @@ Name: %{pkg_name} Version: %{bolt_version} -Release: 8 +Release: 9 Summary: BOLT is a post-link optimizer developed to speed up large applications License: Apache 2.0 URL: https://github.com/llvm/llvm-project/tree/main/bolt @@ -37,6 +37,7 @@ Patch4: 0004-Bolt-Solving-pie-support-issue.patch Patch5: 0005-BOLT-AArch64-Don-t-change-layout-in-PatchEntries.patch Patch6: 0006-AArch64-Add-CFG-block-count-correction-optimization.patch Patch7: 0007-BOLT-Skip-PLT-search-for-zero-value-weak-reference-symbols.patch +Patch8: 0008-merge-fdata-Support-process-no_lbr-profile-file.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -148,6 +149,12 @@ rm -f %{buildroot}/%{_builddir}/%{bolt_srcdir}/%{_vpath_builddir}/%{_lib}/lib*.a %doc %{install_docdir} %changelog +* Tue Sep 10 2024 liyancheng <412998149@qq.com> 17.0.6-9 +- Type:Bugfix +- ID:NA +- SUG:NA +- DESC: Enable merge-fdata support processing no-lbr profile. + * Wed Sep 04 2024 rfwang07 17.0.6-8 - Type:Backport - ID:NA