#
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 ...
|
#
fa7dd491 |
| 12-Feb-2024 |
Amir Ayupov <aaupov@fb.com> |
[BOLT][NFC] Add BOLTError and return it from passes (1/2) (#81522)
As part of the effort to refactor old error handling code that
would directly call exit(1), in this patch we add a new class
BOLT
[BOLT][NFC] Add BOLTError and return it from passes (1/2) (#81522)
As part of the effort to refactor old error handling code that
would directly call exit(1), in this patch we add a new class
BOLTError and auxiliary functions `createFatalBOLTError()` and
`createNonFatalBOLTError()` that allow BOLT code to bubble up the
problem to the caller by using the Error class as a return
type (or Expected). Also changes passes to use these.
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 ...
|
#
485075c0 |
| 08-Nov-2023 |
Vladislav Khmelevsky <och95@yandex.ru> |
[BOLT][AArch64] Don't change layout in PatchEntries (#71278)
Due to LongJmp pass that is executed before PatchEntries we can't ignore
the function here since it would change pre-calculated output l
[BOLT][AArch64] Don't change layout in PatchEntries (#71278)
Due to LongJmp pass that is executed before PatchEntries we can't ignore
the function here since it would change pre-calculated output layout.
The test reloc-26 relied on the wrong behavior, rewritten to unittest.
This is also attemp to fix #70771
show more ...
|
#
f119a248 |
| 19-Aug-2022 |
Amir Ayupov <aaupov@fb.com> |
[BOLT][NFC] Use llvm::any_of
Replace the imperative pattern of the following kind ``` bool IsTrue = false; for (Element : Range) { if (Condition(Element)) { IsTrue = true; break; } } ```
[BOLT][NFC] Use llvm::any_of
Replace the imperative pattern of the following kind ``` bool IsTrue = false; for (Element : Range) { if (Condition(Element)) { IsTrue = true; break; } } ``` with functional style `llvm::any_of`: ``` bool IsTrue = llvm::any_of(Range, [&](Element) { return Condition(Element); }); ```
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D132276
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
|
#
2f09f445 |
| 21-Dec-2021 |
Maksim Panchenko <maks@fb.com> |
[BOLT][NFC] Fix file-description comments
Summary: Fix comments at the start of source files.
(cherry picked from FBD33274597)
|
#
40c2e0fa |
| 15-Dec-2021 |
Maksim Panchenko <maks@fb.com> |
[BOLT][NFC] Reformat with clang-format
Summary: Selectively apply clang-format to BOLT code base.
(cherry picked from FBD33119052)
|
#
69706eaf |
| 09-Dec-2021 |
Maksim Panchenko <maks@fb.com> |
[BOLT] Refactor BinaryBasicBlock to use ADT
Summary: Refactor members of BinaryBasicBlock. Replace some std containers with ADT equivalents. The size of BinaryBasicBlock on x86-64 Linux is reduced f
[BOLT] Refactor BinaryBasicBlock to use ADT
Summary: Refactor members of BinaryBasicBlock. Replace some std containers with ADT equivalents. The size of BinaryBasicBlock on x86-64 Linux is reduced from 232 bytes to 192 bytes.
(cherry picked from FBD33081850)
show more ...
|
#
a34c753f |
| 08-Oct-2021 |
Rafael Auler <rafaelauler@fb.com> |
Rebase: [NFC] Refactor sources to be buildable in shared mode
Summary: Moves source files into separate components, and make explicit component dependency on each other, so LLVM build system knows h
Rebase: [NFC] Refactor sources to be buildable in shared mode
Summary: Moves source files into separate components, and make explicit component dependency on each other, so LLVM build system knows how to build BOLT in BUILD_SHARED_LIBS=ON.
Please use the -c merge.renamelimit=230 git option when rebasing your work on top of this change.
To achieve this, we create a new library to hold core IR files (most classes beginning with Binary in their names), a new library to hold Utils, some command line options shared across both RewriteInstance and core IR files, a new library called Rewrite to hold most classes concerned with running top-level functions coordinating the binary rewriting process, and a new library called Profile to hold classes dealing with profile reading and writing.
To remove the dependency from BinaryContext into X86-specific classes, we do some refactoring on the BinaryContext constructor to receive a reference to the specific backend directly from RewriteInstance. Then, the dependency on X86 or AArch64-specific classes is transfered to the Rewrite library. We can't have the Core library depend on targets because targets depend on Core (which would create a cycle).
Files implementing the entry point of a tool are transferred to the tools/ folder. All header files are transferred to the include/ folder. The src/ folder was renamed to lib/.
(cherry picked from FBD32746834)
show more ...
|