#
3023b15f |
| 09-May-2024 |
Amir Ayupov <aaupov@fb.com> |
[BOLT] Support POSSIBLE_PIC_FIXED_BRANCH
Detect and support fixed PIC indirect jumps of the following form: ``` movslq En(%rip), %r1 leaq PIC_JUMP_TABLE(%rip), %r2 addq %r2, %r1 jmpq *%r1 ```
w
[BOLT] Support POSSIBLE_PIC_FIXED_BRANCH
Detect and support fixed PIC indirect jumps of the following form: ``` movslq En(%rip), %r1 leaq PIC_JUMP_TABLE(%rip), %r2 addq %r2, %r1 jmpq *%r1 ```
with PIC_JUMP_TABLE that looks like following:
``` JT: ---------- E1:| L1 - JT | |----------| E2:| L2 - JT | |----------| | | ...... En:| Ln - JT | ---------- ```
The code could be produced by compilers, see https://github.com/llvm/llvm-project/issues/91648.
Test Plan: updated jump-table-fixed-ref-pic.test
Reviewers: maksfb, ayermolo, dcci, rafaelauler
Reviewed By: rafaelauler
Pull Request: https://github.com/llvm/llvm-project/pull/91667
show more ...
|
#
2430a354 |
| 27-Jun-2024 |
shaw young <58664393+shawbyoung@users.noreply.github.com> |
[BOLT][NFC] Move CallGraph from Passes to Core (#96922)
Moved CallGraph and BinaryFunctionCallGraph from Passes to
Core for future use in stale matching.
|
#
52cf0711 |
| 12-Feb-2024 |
Amir Ayupov <aaupov@fb.com> |
[BOLT][NFC] Log through JournalingStreams (#81524)
Make core BOLT functionality more friendly to being used as a
library instead of in our standalone driver llvm-bolt. To
accomplish this, we augme
[BOLT][NFC] Log through JournalingStreams (#81524)
Make core BOLT functionality more friendly to being used as a
library instead of in our standalone driver llvm-bolt. To
accomplish this, we augment BinaryContext with journaling streams
that are to be used by most BOLT code whenever something needs to
be logged to the screen. Users of the library can decide if logs
should be printed to a file, no file or to the screen, as
before. To illustrate this, this patch adds a new option
`--log-file` that allows the user to redirect BOLT logging to a
file on disk or completely hide it by using
`--log-file=/dev/null`. Future BOLT code should now use
`BinaryContext::outs()` for printing important messages instead of
`llvm::outs()`. A new test log.test enforces this by verifying that
no strings are print to screen once the `--log-file` option is
used.
In previous patches we also added a new BOLTError class to report
common and fatal errors, so code shouldn't call exit(1) now. To
easily handle problems as before (by quitting with exit(1)),
callers can now use
`BinaryContext::logBOLTErrorsAndQuitOnFatal(Error)` whenever code
needs to deal with BOLT errors. To test this, we have fatal.s
that checks we are correctly quitting and printing a fatal error
to the screen.
Because this is a significant change by itself, not all code was
yet ported. Code from Profiler libs (DataAggregator and friends)
still print errors directly to screen.
Co-authored-by: Rafael Auler <rafaelauler@fb.com>
Test Plan: NFC
show more ...
|
#
a5f3d1a8 |
| 12-Feb-2024 |
Amir Ayupov <aaupov@fb.com> |
[BOLT][NFC] Return Error from BinaryFunctionPass::runOnFunctions (#81521)
As part of the effort to refactor old error handling code that
would directly call exit(1), in this patch we change the
in
[BOLT][NFC] Return Error from BinaryFunctionPass::runOnFunctions (#81521)
As part of the effort to refactor old error handling code that
would directly call exit(1), in this patch we change the
interface to `BinaryFunctionPass` to return an Error on
`runOnFunctions()`. This gives passes the ability to report a
serious problem to the caller (RewriteInstance class), so the
caller may decide how to best handle the exceptional situation.
Co-authored-by: Rafael Auler <rafaelauler@fb.com>
Test Plan: NFC
show more ...
|
#
ad8fd5b1 |
| 14-Dec-2023 |
Kazu Hirata <kazu@google.com> |
[BOLT] Use StringRef::{starts,ends}_with (NFC)
This patch replaces uses of StringRef::{starts,ends}with with StringRef::{starts,ends}_with for consistency with std::{string,string_view}::{starts,end
[BOLT] Use StringRef::{starts,ends}_with (NFC)
This patch replaces uses of StringRef::{starts,ends}with with StringRef::{starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20.
I'm planning to deprecate and eventually remove StringRef::{starts,ends}with.
show more ...
|
#
fa5486e4 |
| 06-Dec-2023 |
Ho Cheung <17492865+gz83@users.noreply.github.com> |
[BOLT] [Passes] Fix two compile warnings in BOLT (#73086)
Fix build issue on Windows.
issue:#73085
@maksfb PTAL thank you
|
#
7f031d1c |
| 06-Nov-2023 |
maksfb <maks@fb.com> |
[BOLT] Fix address mapping for ICP code (#70136)
When we create new code for indirect code promotion optimization, we
should mark it as originating from the indirect jump instruction for
BOLT addr
[BOLT] Fix address mapping for ICP code (#70136)
When we create new code for indirect code promotion optimization, we
should mark it as originating from the indirect jump instruction for
BOLT address translation (BAT) to map it to the original instruction.
show more ...
|
#
f9306f6d |
| 25-Oct-2023 |
Kazu Hirata <kazu@google.com> |
[ADT] Rename llvm::erase_value to llvm::erase (NFC) (#70156)
C++20 comes with std::erase to erase a value from std::vector. This
patch renames llvm::erase_value to llvm::erase for consistency with
[ADT] Rename llvm::erase_value to llvm::erase (NFC) (#70156)
C++20 comes with std::erase to erase a value from std::vector. This
patch renames llvm::erase_value to llvm::erase for consistency with
C++20.
We could make llvm::erase more similar to std::erase by having it
return the number of elements removed, but I'm not doing that for now
because nobody seems to care about that in our code base.
Since there are only 50 occurrences of erase_value in our code base,
this patch replaces all of them with llvm::erase and deprecates
llvm::erase_value.
show more ...
|
#
16e67e69 |
| 14-Mar-2023 |
Amir Ayupov <aaupov@fb.com> |
[BOLT][NFC] Remove BB::getBranchInfo accepting MCSymbol ptr
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/D144924
|
#
72e5b14f |
| 02-Feb-2023 |
Amir Ayupov <aaupov@fb.com> |
[BOLT][NFC] Use llvm::make_second_range
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/D143019
|
#
9966b3e7 |
| 30-Sep-2022 |
Gabriel Ravier <gabravier@gmail.com> |
[BOLT] Fixed some typos
I went over the output of the following mess of a command:
`(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --igno
[BOLT] Fixed some typos
I went over the output of the following mess of a command:
`(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)`
and proceeded to spend a few days looking at it to find probable typos and fixed a few hundred of them in all of the llvm project (note, the ones I found are not anywhere near all of them, but it seems like a good start).
Reviewed By: Amir, maksfb
Differential Revision: https://reviews.llvm.org/D130824
show more ...
|
#
31abde43 |
| 08-Sep-2022 |
Amir Ayupov <aaupov@fb.com> |
[BOLT] Restrict ICP for functions with unknown control flow
ICP has two modes: jump table promotion and indirect call promotion. The selection is based on whether an instruction has a jump table or
[BOLT] Restrict ICP for functions with unknown control flow
ICP has two modes: jump table promotion and indirect call promotion. The selection is based on whether an instruction has a jump table or not. An instruction with unknown control flow doesn't have a jump table and will fall under indirect call promotion policy which might be incorrect/unsafe (if an instruction is not a tail call, i.e. has local jump targets).
Prevent ICP for functions containing instructions with unknown control flow.
Follow-up to https://reviews.llvm.org/D128870.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D132882
show more ...
|
#
a191ea7d |
| 19-Aug-2022 |
Fabian Parzefall <parzefall@fb.com> |
[BOLT] Make exception handling fragment aware
This adds basic fragment awareness in the exception handling passes and generates the necessary symbols for fragments.
Reviewed By: rafauler
Different
[BOLT] Make exception handling fragment aware
This adds basic fragment awareness in the exception handling passes and generates the necessary symbols for fragments.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D130520
show more ...
|
#
8477bc67 |
| 17-Jul-2022 |
Fabian Parzefall <parzefall@fb.com> |
[BOLT] Add function layout class
This patch adds a dedicated class to keep track of each function's layout. It also lays the groundwork for splitting functions into multiple fragments (as opposed to
[BOLT] Add function layout class
This patch adds a dedicated class to keep track of each function's layout. It also lays the groundwork for splitting functions into multiple fragments (as opposed to a strict hot/cold split).
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D129518
show more ...
|
#
d55dfeaf |
| 14-Jul-2022 |
Fabian Parzefall <parzefall@fb.com> |
[BOLT] Replace uses of layout with basic block list
As we are moving towards support for multiple fragments, loops that iterate over all basic blocks of a function, but do not depend on the order of
[BOLT] Replace uses of layout with basic block list
As we are moving towards support for multiple fragments, loops that iterate over all basic blocks of a function, but do not depend on the order of basic blocks in the final layout, should iterate over binary functions directly, rather than the layout.
Eventually, all loops using the layout list should either iterate over the function, or be aware of multiple layouts. This patch replaces references to binary function's block layout with the binary function itself where only little code changes are necessary.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D129585
show more ...
|
#
d58b5a06 |
| 27-Jun-2022 |
Amir Ayupov <aaupov@fb.com> |
[BOLT] Restrict icp-inline to callsites
ICP peel for inline mode only makes sense for calls, not jump tables. Plus, add a check that the Target BinaryFunction is found.
Reviewed By: rafauler
Diffe
[BOLT] Restrict icp-inline to callsites
ICP peel for inline mode only makes sense for calls, not jump tables. Plus, add a check that the Target BinaryFunction is found.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D128404
show more ...
|
#
0d477f63 |
| 27-Jun-2022 |
Amir Ayupov <aaupov@fb.com> |
[BOLT][NFC] Add aliases for ICP flags
- `indirect-call-promotion` -> `icp` - `indirect-call-promotion-mispredict-threshold` -> `icp-mp-threshold` - `indirect-call-promotion-use-mispredicts` -> `icp-
[BOLT][NFC] Add aliases for ICP flags
- `indirect-call-promotion` -> `icp` - `indirect-call-promotion-mispredict-threshold` -> `icp-mp-threshold` - `indirect-call-promotion-use-mispredicts` -> `icp-use-mp` - `indirect-call-promotion-topn` -> `icp-topn` - `indirect-call-promotion-calls-topn` -> `icp-calls-topn` - `indirect-call-promotion-jump-tables-topn` -> `icp-jt-topn` - `icp-jump-table-targets` -> `icp-jt-targets`
This also fixes an inconsistency in ICP flag names that some start with `indirect-call-promotion` while others start with `icp`.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D128375
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 ...
|
#
8228c703 |
| 16-Jun-2022 |
Maksim Panchenko <maks@fb.com> |
[BOLT][NFCI] Refactor interface for adding basic blocks
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D127935
|
#
b92436ef |
| 05-Jun-2022 |
Fangrui Song <i@maskray.me> |
[bolt] Remove unneeded cl::ZeroOrMore for cl::opt options
|
#
36c7d79d |
| 04-Jun-2022 |
Fangrui Song <i@maskray.me> |
Remove unneeded cl::ZeroOrMore for cl::opt options
Similar to 557efc9a8b68628c2c944678c6471dac30ed9e8e. This commit handles options where cl::ZeroOrMore is more than one line below cl::opt.
|
#
e2142ff4 |
| 03-Jun-2022 |
Amir Ayupov <aaupov@fb.com> |
[BOLT][NFC] Make ICP::verifyProfile static
Follow LLVM style guide suggestion to avoid function definitions in anonymous namespaces: https://llvm.org/docs/CodingStandards.html#anonymous-namespaces
[BOLT][NFC] Make ICP::verifyProfile static
Follow LLVM style guide suggestion to avoid function definitions in anonymous namespaces: https://llvm.org/docs/CodingStandards.html#anonymous-namespaces
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D124896
show more ...
|
#
c2d40f1d |
| 11-May-2022 |
Amir Ayupov <aaupov@fb.com> |
[BOLT] Add icp-inline option
Add an option to only peel ICP targets that can be subsequently inlined. Yet there's no guarantee that they will be inlined.
The mode is independent from the heuristic
[BOLT] Add icp-inline option
Add an option to only peel ICP targets that can be subsequently inlined. Yet there's no guarantee that they will be inlined.
The mode is independent from the heuristic used to choose ICP targets: by exec count, mispredictions, or memory profile.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D124900
show more ...
|
#
2ad1c754 |
| 04-May-2022 |
Amir Ayupov <aaupov@fb.com> |
[BOLT][NFC] Minor cleanup in ICP getCallTargets and canPromoteCallsite
Minor refactoring. NFC.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D124898
|
#
60957a5a |
| 04-May-2022 |
Amir Ayupov <aaupov@fb.com> |
[BOLT] Fix ICPJumpTablesTopN option use
Fix non-sensical `opts::ICPJumpTablesTopN != 0 ? opts::ICPTopN : opts::ICPTopN`. Refactor/simplify another similar assignment.
Reviewed By: rafauler
Differe
[BOLT] Fix ICPJumpTablesTopN option use
Fix non-sensical `opts::ICPJumpTablesTopN != 0 ? opts::ICPTopN : opts::ICPTopN`. Refactor/simplify another similar assignment.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D124880
show more ...
|