aboutsummaryrefslogtreecommitdiff
path: root/bolt/lib/Passes/ReorderAlgorithm.cpp
AgeCommit message (Collapse)AuthorFilesLines
2023-12-06[BOLT] [Passes] Fix two compile warnings in BOLT (#73086)Ho Cheung1-2/+2
Fix build issue on Windows. issue:#73085 @maksfb PTAL thank you
2023-09-21[CodeLayout] Refactor std::vector uses, namespace, and EdgeCountT. NFCFangrui Song1-5/+5
* Place types and functions in the llvm::codelayout namespace * Change EdgeCountT from pair<pair<uint64_t, uint64_t>, uint64_t> to a struct and utilize structured bindings. It is not conventional to use the "T" suffix for structure types. * Remove a redundant copy in ChainT::merge. * Change {ExtTSPImpl,CDSortImpl}::run to use return value instead of an output parameter * Rename applyCDSLayout to computeCacheDirectedLayout: (a) avoid rare abbreviation "CDS" (cache-directed sort) (b) "compute" is more conventional for the specific use case * Change the parameter types from std::vector to ArrayRef so that SmallVector arguments can be used. * Similarly, rename applyExtTspLayout to computeExtTspLayout. Reviewed By: Amir Differential Revision: https://reviews.llvm.org/D159526
2022-09-19[BOLT] Unifying implementations of ext-tspspupyrev1-0/+51
After BOLT's merge to LLVM, there are two (almost identical) versions of the code layout algorithm. The diff unifies the implementations by keeping the one in LLVM. There are mild changes in the resulting block orders. I tested the changes extensively both on the clang binary and on prod services. Didn't see stat sig differences on average. Reviewed By: Amir Differential Revision: https://reviews.llvm.org/D129895
2022-08-24[BOLT] Towards FunctionLayout const-correctnessFabian Parzefall1-12/+12
A const-qualified reference to function layout allows accessing non-const qualified basic blocks on a const-qualified function. This patch adds or removes const-qualifiers where necessary to indicate where basic blocks are used in a non-const manner. Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D132049
2022-08-24Revert "[BOLT] Towards FunctionLayout const-correctness"Fabian Parzefall1-12/+12
This reverts commit 587d2653420d75ef10f30bd612d86f1e08fe9ea7.
2022-08-24[BOLT] Towards FunctionLayout const-correctnessFabian Parzefall1-12/+12
A const-qualified reference to function layout allows accessing non-const qualified basic blocks on a const-qualified function. This patch adds or removes const-qualifiers where necessary to indicate where basic blocks are used in a non-const manner. Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D132049
2022-07-30[bolt] Remove redundaunt control-flow statements (NFC)Kazu Hirata1-1/+0
Identified with readability-redundant-control-flow.
2022-07-16[BOLT] Add function layout classFabian Parzefall1-17/+19
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
2022-06-23[BOLT][NFC] Use range-based STL wrappersAmir Ayupov1-2/+2
Replace `std::` algorithms taking begin/end iterators with `llvm::` counterparts accepting ranges. Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D128154
2022-06-05[bolt] Remove unneeded cl::ZeroOrMore for cl::opt optionsFangrui Song1-14/+6
2022-01-13[BOLT][NFC] Remove uses of `std::vector<bool>`Amir Ayupov1-1/+1
Summary: LLVM Programmer’s Manual strongly discourages the use of `std::vector<bool>` and suggests `llvm::BitVector` as a possible replacement.
2021-12-28[BOLT][NFC] Fix braces usage in PassesAmir Ayupov1-10/+6
Summary: Refactor bolt/*/Passes to follow the braces rule for if/else/loop from [LLVM Coding Standards](https://llvm.org/docs/CodingStandards.html). (cherry picked from FBD33344642)
2021-12-21[BOLT][NFC] Fix file-description commentsMaksim Panchenko1-2/+3
Summary: Fix comments at the start of source files. (cherry picked from FBD33274597)
2021-12-14[BOLT][NFC] Reformat with clang-formatMaksim Panchenko1-41/+39
Summary: Selectively apply clang-format to BOLT code base. (cherry picked from FBD33119052)
2021-10-08Rebase: [NFC] Refactor sources to be buildable in shared modeRafael Auler1-0/+739
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)