[PATCH] D152941: [BOLT] Fixing relative ordering of cold sections under multi-way function splitting
Shatian Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 14 11:59:55 PDT 2023
shatianw_mt updated this revision to Diff 531452.
shatianw_mt added a comment.
ran git clang-format
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152941/new/
https://reviews.llvm.org/D152941
Files:
bolt/lib/Rewrite/RewriteInstance.cpp
Index: bolt/lib/Rewrite/RewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/RewriteInstance.cpp
+++ bolt/lib/Rewrite/RewriteInstance.cpp
@@ -3906,6 +3906,20 @@
CodeSections.emplace_back(&Section);
auto compareSections = [&](const BinarySection *A, const BinarySection *B) {
+ // If both A and B have names starting with ".text.cold", then
+ // - if opts::HotFunctionsAtEnd is true, we want order
+ // ".text.cold.T", ".text.cold.T-1", ... ".text.cold.1", ".text.cold"
+ // - if opts::HotFunctionsAtEnd is false, we want order
+ // ".text.cold", ".text.cold.1", ... ".text.cold.T-1", ".text.cold.T"
+ if (A->getName().startswith(BC->getColdCodeSectionName()) &&
+ B->getName().startswith(BC->getColdCodeSectionName()))
+ if (A->getName().size() != B->getName().size())
+ return (opts::HotFunctionsAtEnd)
+ ? (A->getName().size() > B->getName().size())
+ : (A->getName().size() < B->getName().size());
+ return (opts::HotFunctionsAtEnd) ? (A->getName() > B->getName())
+ : (A->getName() < B->getName());
+
// Place movers before anything else.
if (A->getName() == BC->getHotTextMoverSectionName())
return true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152941.531452.patch
Type: text/x-patch
Size: 1311 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230614/76db53f2/attachment.bin>
More information about the llvm-commits
mailing list