Skip to content

Commit 3c15943

Browse files
committed
[BOLT][AArch64] Use minimal code alignment for cold functions
On AArch64, a larger cold code size can result in more veneers, increasing potential overhead for hot code. This change minimizes cold code size when the `--use-compact-aligner` option (default) is enabled.
1 parent f440b5c commit 3c15943

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

bolt/lib/Passes/Aligner.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ static void alignCompact(BinaryFunction &Function,
7777
size_t HotSize = 0;
7878
size_t ColdSize = 0;
7979

80+
// On AArch64, larger cold code size may lead to more veneers and higher
81+
// potential overhead for hot code. Minimize the cold code size.
82+
if (!Function.hasProfile() && BC.isAArch64()) {
83+
Function.setAlignment(Function.getMinAlignment());
84+
return;
85+
}
86+
8087
for (const BinaryBasicBlock &BB : Function)
8188
if (BB.isSplit())
8289
ColdSize += BC.computeCodeSize(BB.begin(), BB.end(), Emitter);

0 commit comments

Comments
 (0)