#
07f63b0a |
| 25-Aug-2022 |
Fabian Parzefall <parzefall@fb.com> |
[BOLT] Allocate FunctionFragment on heap
This changes `FunctionFragment` from being used as a temporary proxy object to access basic block ranges to a heap-allocated object that can store fragment-s
[BOLT] Allocate FunctionFragment on heap
This changes `FunctionFragment` from being used as a temporary proxy object to access basic block ranges to a heap-allocated object that can store fragment-specific information.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D132050
show more ...
|
#
5065134a |
| 24-Aug-2022 |
Fabian Parzefall <parzefall@fb.com> |
Revert "[BOLT] Allocate FunctionFragment on heap"
This reverts commit 101344af1af82d1633c773b718788eaa813d7f79.
|
#
101344af |
| 24-Aug-2022 |
Fabian Parzefall <parzefall@fb.com> |
[BOLT] Allocate FunctionFragment on heap
This changes `FunctionFragment` from being used as a temporary proxy object to access basic block ranges to a heap-allocated object that can store fragment-s
[BOLT] Allocate FunctionFragment on heap
This changes `FunctionFragment` from being used as a temporary proxy object to access basic block ranges to a heap-allocated object that can store fragment-specific information.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D132050
show more ...
|
#
258531b7 |
| 21-Aug-2022 |
Kazu Hirata <kazu@google.com> |
Remove redundant initialization of Optional (NFC)
|
#
0f74d191 |
| 19-Aug-2022 |
Fabian Parzefall <parzefall@fb.com> |
[BOLT] Generate sections for multiple fragments
This patch adds support to generate any number of sections that are assigned to fragments of functions that are split more than two-way. With this, a
[BOLT] Generate sections for multiple fragments
This patch adds support to generate any number of sections that are assigned to fragments of functions that are split more than two-way. With this, a function's *nth* split fragment goes into section `.text.cold.n`.
This also changes `FunctionLayout::erase` to make sure, that there are no empty fragments at the end of the function. This sometimes happens when blocks are erased from the function. To avoid creating symbols pointing to these fragments, they need to be removed.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D130521
show more ...
|
#
275e075c |
| 19-Aug-2022 |
Fabian Parzefall <parzefall@fb.com> |
[BOLT] Support passing fragments to code emission
This changes code emission such that it can emit specific function fragments instead of scanning all basic blocks of a function and just emitting th
[BOLT] Support passing fragments to code emission
This changes code emission such that it can emit specific function fragments instead of scanning all basic blocks of a function and just emitting those that are hot or cold.
To implement this, `FunctionLayout` explicitly distinguishes the "main" fragment (i.e. the one that contains the entry block and is associated with the original symbol) from "split" fragments. Additionally, `BinaryFunction` receives support for multiple cold symbols - one for each split fragment.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D130052
show more ...
|
#
055f9f6d |
| 18-Aug-2022 |
Amir Ayupov <aaupov@fb.com> |
[BOLT][NFC] Simplify debug logging in case of JT heuristic failure
Move logging into LLVM_DEBUG scope. Remove redundant printing of jump table parents:
Old logging: ``` failed to analyze jump table
[BOLT][NFC] Simplify debug logging in case of JT heuristic failure
Move logging into LLVM_DEBUG scope. Remove redundant printing of jump table parents:
Old logging: ``` failed to analyze jump table in function _ZN12_GLOBAL__N_116InitHeaderSearch23Ad dDefaultCIncludePathsERKN4llvm6TripleERKN5clang19HeaderSearchOptionsE/1(*2) PIC Jump table JUMP_TABLE/_ZN12_GLOBAL__N_116InitHeaderSearch23AddDefaultCInclud ePathsERKN4llvm6TripleERKN5clang19HeaderSearchOptionsE/1.1 for function _ZN12_GL OBAL__N_116InitHeaderSearch23AddDefaultCIncludePathsERKN4llvm6TripleERKN5clang19 HeaderSearchOptionsE/1(*2) at 0x65996e0 with a total count of 0: 0x9dc
next jump table at 0x659a810 belongs to function _ZN5clang5Lexer40LexDependencyD irectiveTokenWhileSkippingERNS_5TokenE PIC Jump table JUMP_TABLE/_ZN5clang5Lexer40LexDependencyDirectiveTokenWhileSkipp ingERNS_5TokenE.0 for function _ZN5clang5Lexer40LexDependencyDirectiveTokenWhile SkippingERNS_5TokenE at 0x659a810 with a total count of 0:
jump table heuristic failure ```
New logging: ``` failed to analyze PIC Jump table JUMP_TABLE/_ZN12_GLOBAL__N_116InitHeaderSearch2 3AddDefaultCIncludePathsERKN4llvm6TripleERKN5clang19HeaderSearchOptionsE/1.1 for function _ZN12_GLOBAL__N_116InitHeaderSearch23AddDefaultCIncludePathsERKN4llvm6T ripleERKN5clang19HeaderSearchOptionsE/1(*2) at 0x65996e0 with a total count of 0: absolute offset: 0x52ac58c
next PIC Jump table JUMP_TABLE/_ZN5clang5Lexer40LexDependencyDirectiveTokenWhile SkippingERNS_5TokenE.0 for function _ZN5clang5Lexer40LexDependencyDirectiveToken WhileSkippingERNS_5TokenE at 0x659a810 with a total count of 0:
jump table heuristic failure ```
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D131243
show more ...
|
#
556efdba |
| 16-Aug-2022 |
Amir Ayupov <aaupov@fb.com> |
[BOLT][NFC] Extend debug logging in analyzeJumpTable
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D131918
|
Revision tags: llvmorg-15.0.0-rc2 |
|
#
0c925861 |
| 06-Aug-2022 |
Thorsten Schütt <schuett@gmail.com> |
[bolt] silence unused variables warnings
|
#
7651522b |
| 01-Aug-2022 |
David Blaikie <dblaikie@gmail.com> |
Fold assert-used variable into assert
Fixes #56724
|
#
468d4f6d |
| 30-Jul-2022 |
Amir Ayupov <aaupov@fb.com> |
Revert "[BOLT] Ignore functions accessing false positive jump tables"
This diff uncovers an ASAN leak in getOrCreateJumpTable: ``` Indirect leak of 264 byte(s) in 1 object(s) allocated from: #1
Revert "[BOLT] Ignore functions accessing false positive jump tables"
This diff uncovers an ASAN leak in getOrCreateJumpTable: ``` Indirect leak of 264 byte(s) in 1 object(s) allocated from: #1 0x4f6e48c in llvm::bolt::BinaryContext::getOrCreateJumpTable ... ``` The removal of an assertion needs to be accompanied by proper deallocation of a `JumpTable` object for which `analyzeJumpTable` was unsuccessful.
This reverts commit 52cd00cabf479aa7eb6dbb063b7ba41ea57bce9e.
show more ...
|
Revision tags: llvmorg-15.0.0-rc1 |
|
#
52cd00ca |
| 29-Jul-2022 |
Huan Nguyen <nhuhuan@yahoo.com> |
[BOLT] Ignore functions accessing false positive jump tables
Disassembly and branch target analysis are not decoupled, so any analysis that depends on disassembly may not operate properly.
In speci
[BOLT] Ignore functions accessing false positive jump tables
Disassembly and branch target analysis are not decoupled, so any analysis that depends on disassembly may not operate properly.
In specific, analyzeJumpTable uses instruction bounds check property. A jump table was analyzed twice: (a) during disassembly, and (b) after disassembly, so there are potentially some mismatched results.
In this update, functions that access JTs which fail the second check will be marked as ignored.
Test Plan: ``` ninja check-bolt ```
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D130431
show more ...
|
Revision tags: llvmorg-16-init |
|
#
05523dc3 |
| 14-Jul-2022 |
Huan Nguyen <nhuhuan@yahoo.com> |
[BOLT] Support multiple parents for split jump table
There are two assumptions regarding jump table: (a) It is accessed by only one fragment, say, Parent (b) All entries target instructions in Paren
[BOLT] Support multiple parents for split jump table
There are two assumptions regarding jump table: (a) It is accessed by only one fragment, say, Parent (b) All entries target instructions in Parent
For (a), BOLT stores jump table entries as relative offset to Parent. For (b), BOLT treats jump table entries target somewhere out of Parent as INVALID_OFFSET, including fragment of same split function.
In this update, we extend (a) and (b) to include fragment of same split functinon. For (a), we store jump table entries in absolute offset instead. In addition, jump table will store all fragments that access it. A fragment uses this information to only create label for jump table entries that target to that fragment.
For (b), using absolute offset allows jump table entries to target fragments of same split function, i.e., extend support for split jump table. This can be done using relocation (fragment start/size) and fragment detection heuristics (e.g., using symbol name pattern for non-stripped binaries).
For jump table targets that can only be reached by one fragment, we mark them as local label; otherwise, they would be the secondary function entry to the target fragment.
Test Plan ``` ninja check-bolt ```
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D128474
show more ...
|
#
35efe1d8 |
| 06-Jul-2022 |
Vladislav Khmelevsky <och95@yandex.ru> |
[BOLT][AArch64] Handle gold linker veneers
The gold linker veneers are written between functions without symbols, so we to handle it specially in BOLT.
Vladislav Khmelevsky, Advanced Software Techn
[BOLT][AArch64] Handle gold linker veneers
The gold linker veneers are written between functions without symbols, so we to handle it specially in BOLT.
Vladislav Khmelevsky, Advanced Software Technology Lab, Huawei
Differential Revision: https://reviews.llvm.org/D129260
show more ...
|
#
75641678 |
| 12-Jul-2022 |
Denis Revunov <revunov.denis@huawei-partners.com> |
[BOLT][AArch64] Use all supported CPU features on AArch64
Since we now have +all feature for AArch64 disassembler, we can use it in BOLT and allow it to disassemble all ARM instructions supported by
[BOLT][AArch64] Use all supported CPU features on AArch64
Since we now have +all feature for AArch64 disassembler, we can use it in BOLT and allow it to disassemble all ARM instructions supported by LLVM.
Reviewed by: rafauler
Differential Revision: https://reviews.llvm.org/D129139
show more ...
|
#
e159abdb |
| 30-Jun-2022 |
Alexander Yermolovich <ayermolo@fb.com> |
[BOLT][DWARF] Support mix mode DWARF
Added support for mixing monolithic DWARF5 with legacy DWARF, and monolithic legacy and DWARF5 split dwarf.
Reviewed By: maksfb
Differential Revision: https://
[BOLT][DWARF] Support mix mode DWARF
Added support for mixing monolithic DWARF5 with legacy DWARF, and monolithic legacy and DWARF5 split dwarf.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D128232
show more ...
|
#
fc2d96c3 |
| 29-Jun-2022 |
Rafael Auler <rafaelauler@fb.com> |
Revert "[BOLT][AArch64] Handle gold linker veneers"
This reverts commit 425dda76e9fac93117289fd68a2abdfb1e4a0ba5.
This commit is currently causing BOLT to crash in one of our binaries and needs a b
Revert "[BOLT][AArch64] Handle gold linker veneers"
This reverts commit 425dda76e9fac93117289fd68a2abdfb1e4a0ba5.
This commit is currently causing BOLT to crash in one of our binaries and needs a bit more checking to make sure it is safe to land.
show more ...
|
Revision tags: llvmorg-14.0.6 |
|
#
425dda76 |
| 15-Jun-2022 |
Vladislav Khmelevsky <och95@yandex.ru> |
[BOLT][AArch64] Handle gold linker veneers
The gold linker veneers are written between functions without symbols, so we to handle it specially in BOLT.
Vladislav Khmelevsky, Advanced Software Techn
[BOLT][AArch64] Handle gold linker veneers
The gold linker veneers are written between functions without symbols, so we to handle it specially in BOLT.
Vladislav Khmelevsky, Advanced Software Technology Lab, Huawei
Differential Revision: https://reviews.llvm.org/D128082
show more ...
|
#
d2c87699 |
| 24-Jun-2022 |
Amir Ayupov <aaupov@fb.com> |
[BOLT][NFC] Use range-based STL wrappers
Replace `std::` algorithms taking begin/end iterators with `llvm::` counterparts accepting ranges.
Reviewed By: rafauler
Differential Revision: https://rev
[BOLT][NFC] Use range-based STL wrappers
Replace `std::` algorithms taking begin/end iterators with `llvm::` counterparts accepting ranges.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D128154
show more ...
|
#
28b1dcb1 |
| 17-Jun-2022 |
Huan Nguyen <nhuhuan@yahoo.com> |
[BOLT] Allow function fragments to point to one jump table
Resolve a crash related to split functions
Due to split function optimization, a function can be divided to two
fragments, and both fragm
[BOLT] Allow function fragments to point to one jump table
Resolve a crash related to split functions
Due to split function optimization, a function can be divided to two
fragments, and both fragments can access same jump table. This violates
the assumption that a jump table can only have one parent function,
which causes a crash during instrumentation.
We want to support the case: different functions cannot access same jump tables, but different fragments of same function can!
As all fragments are from same function, we point JT::Parent to one specific fragment. Right now it is the first disassembled fragment, but we can point it to the function's main fragment later.
Functions are disassembled sequentially. Previously, at the end of processing a function, JT::OffsetEntries is cleared, so other fragment can no longer reuse JT::OffsetEntries. To extend the support for split function, we only clear JT::OffsetEntries after all functions are disassembled.
Let say A.hot and A.cold access JT of three targets {X, Y, Z}, where X and Y are in A.hot, and Z is in A.cold. Suppose that A.hot is disassembled first, JT::OffsetEntries = {X',Y',INVALID_OFFSET}. When A.cold is disassembled, it cannot reuse JT::OffsetEntries above due to different fragment start. A simple solution: A.hot = {X',Y',INVALID_OFFSET} A.cold = {INVALID_OFFSET, INVALID_OFFSET, INVALID_OFFSET}
We update the assertion to allow different fragments of same function to get the same JumpTable object.
Potential improvements: A.hot = {X',Y',INVALID_OFFSET} A.cold = {INVALID_OFFSET, INVALID_OFFSET, Z'} The main issue is A.hot and A.cold have separate CFGs, thus jump table targets are still constrained within fragment bounds.
Future improvements: A.hot = {X, Y, Z} A.cold = {X, Y, Z}
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D127924
show more ...
|
#
7dee646b |
| 11-Jun-2022 |
Amir Ayupov <aaupov@fb.com> |
[BOLT][NFC] Move printDebugInfo out of BC::printInstruction
Simplify `BinaryContext::printInstruction`.
Reviewed By: ayermolo
Differential Revision: https://reviews.llvm.org/D127561
|
#
adf4142f |
| 11-Jun-2022 |
Fangrui Song <i@maskray.me> |
[MC] De-capitalize SwitchSection. NFC
Add SwitchSection to return switchSection. The API will be removed soon.
|
#
82095bd5 |
| 10-Jun-2022 |
Huan Nguyen <nhuhuan@yahoo.com> |
[BOLT] Mark fragments related to split jump table as non-simple
Mark fragments related to split jump table as non-simple.
A function could be splitted into hot and cold fragments. A split jump tabl
[BOLT] Mark fragments related to split jump table as non-simple
Mark fragments related to split jump table as non-simple.
A function could be splitted into hot and cold fragments. A split jump table is challenging for correctly reconstructing control flow graphs, so it was marked as ignored. This update marks those fragments as non-simple, allowing them to be printed and partial control flow graph construction.
Test Plan: ``` llvm-lit -a tools/bolt/test/X86/split-func-icf.s ``` This test has two functions (main, main2), each has a jump table target to the same cold portion main2.cold.1(*2). We try to print out only this cold portion. If it is ignored, it cannot be printed. If it is non-simple, it can be printed. We verify that it can be printed.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D127464
show more ...
|
Revision tags: llvmorg-14.0.5 |
|
#
b92436ef |
| 05-Jun-2022 |
Fangrui Song <i@maskray.me> |
[bolt] Remove unneeded cl::ZeroOrMore for cl::opt options
|
Revision tags: llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2 |
|
#
e290133c |
| 23-Feb-2022 |
Maksim Panchenko <maks@fb.com> |
[BOLT] Add new class for symbolizing X86 instructions
Summary: While disassembling instructions, we need to replace certain immediate operands with symbols. This symbolizing process relies on readin
[BOLT] Add new class for symbolizing X86 instructions
Summary: While disassembling instructions, we need to replace certain immediate operands with symbols. This symbolizing process relies on reading relocations against instructions. However, some X86 instructions can have multiple immediate operands and up to two relocations against them. Thus, correctly matching a relocation to an operand is not always possible without knowing the operand offset within the instruction.
Luckily, LLVM provides an interface for passing the required info from the disassembler via a virtual MCSymbolizer class. Creating a target-specific version allows a precise matching of relocations to operands.
This diff adds X86MCSymbolizer class that performs X86-specific symbolizing (currently limited to non-branch instructions).
Reviewers: yota9, Amir, ayermolo, rafauler, zr33
Differential Revision: https://reviews.llvm.org/D120928
show more ...
|