[llvm] [CodeLayout] Size-aware machine block placement (PR #109711)
David Li via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 14:00:42 PDT 2024
================
@@ -3545,15 +3559,19 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &MF) {
}
}
- // Apply a post-processing optimizing block placement.
- if (MF.size() >= 3 && EnableExtTspBlockPlacement &&
- (ApplyExtTspWithoutProfile || MF.getFunction().hasProfileData()) &&
- MF.size() <= ExtTspBlockPlacementMaxBlocks) {
- // Find a new placement and modify the layout of the blocks in the function.
- applyExtTsp();
-
- // Re-create CFG chain so that we can optimizeBranches and alignBlocks.
- createCFGChainExtTsp();
+ // Apply a post-processing optimizing block placement:
+ // - find a new placement and modify the layout of the blocks in the function;
+ // - re-create CFG chains so that we can optimizeBranches and alignBlocks.
+ if (MF.size() >= 3) {
+ if (EnableExtTspBlockPlacement &&
+ (ApplyExtTspWithoutProfile || MF.getFunction().hasProfileData()) &&
+ MF.size() <= ExtTspBlockPlacementMaxBlocks) {
+ applyExtTsp(false);
+ createCFGChainExtTsp();
+ } else if (UseExtTspForSize) {
+ applyExtTsp(true);
+ createCFGChainExtTsp();
----------------
david-xl wrote:
Factorize this call out?
https://github.com/llvm/llvm-project/pull/109711
More information about the llvm-commits
mailing list