[llvm] [CodeLayout] Size-aware machine block placement (PR #109711)
Ellis Hoag via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 15:10:16 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);
----------------
ellishg wrote:
```suggestion
applyExtTsp(/*OptForSize=*/false);
createCFGChainExtTsp();
} else if (UseExtTspForSize) {
applyExtTsp(/*OptForSize=*/true);
```
https://github.com/llvm/llvm-project/pull/109711
More information about the llvm-commits
mailing list