[PATCH] D121825: [BOLT] LongJmp speedup refactoring
Vladislav Khmelevsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 16 11:40:57 PDT 2022
yota9 updated this revision to Diff 415921.
yota9 added a comment.
Clang-format
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121825/new/
https://reviews.llvm.org/D121825
Files:
bolt/lib/Passes/LongJmp.cpp
Index: bolt/lib/Passes/LongJmp.cpp
===================================================================
--- bolt/lib/Passes/LongJmp.cpp
+++ bolt/lib/Passes/LongJmp.cpp
@@ -322,14 +322,20 @@
uint32_t CurrentIndex = 0;
if (opts::HotFunctionsAtEnd) {
for (BinaryFunction *BF : SortedFunctions) {
- if (BF->hasValidIndex() && LastHotIndex == -1u)
+ if (BF->hasValidIndex()) {
LastHotIndex = CurrentIndex;
+ break;
+ }
+
++CurrentIndex;
}
} else {
for (BinaryFunction *BF : SortedFunctions) {
- if (!BF->hasValidIndex() && LastHotIndex == -1u)
+ if (!BF->hasValidIndex()) {
LastHotIndex = CurrentIndex;
+ break;
+ }
+
++CurrentIndex;
}
}
@@ -386,17 +392,23 @@
}
// Relocation mode
- uint64_t EstimatedTextSize = tentativeLayoutRelocMode(BC, SortedFunctions, 0);
+ uint64_t EstimatedTextSize = 0;
+ if (opts::UseOldText) {
+ EstimatedTextSize = tentativeLayoutRelocMode(BC, SortedFunctions, 0);
+
+ // Initial padding
+ if (EstimatedTextSize <= BC.OldTextSectionSize) {
+ DotAddress = BC.OldTextSectionAddress;
+ uint64_t Pad =
+ offsetToAlignment(DotAddress, llvm::Align(opts::AlignText));
+ if (Pad + EstimatedTextSize <= BC.OldTextSectionSize) {
+ DotAddress += Pad;
+ }
+ }
+ }
- // Initial padding
- if (opts::UseOldText && EstimatedTextSize <= BC.OldTextSectionSize) {
- DotAddress = BC.OldTextSectionAddress;
- uint64_t Pad = offsetToAlignment(DotAddress, llvm::Align(opts::AlignText));
- if (Pad + EstimatedTextSize <= BC.OldTextSectionSize)
- DotAddress += Pad;
- } else {
+ if (!EstimatedTextSize || EstimatedTextSize > BC.OldTextSectionSize)
DotAddress = alignTo(BC.LayoutStartAddress, opts::AlignText);
- }
tentativeLayoutRelocMode(BC, SortedFunctions, DotAddress);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121825.415921.patch
Type: text/x-patch
Size: 1873 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220316/2e424d3a/attachment.bin>
More information about the llvm-commits
mailing list