diff options
author | Luke Lau <luke@igalia.com> | 2025-10-18 07:33:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-10-17 23:33:49 +0000 |
commit | df8956442feda0171fda79393778f698eb0385cf (patch) | |
tree | aec02bdf13a31347a77df5db78304b6cc4700c32 /lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp | |
parent | fe5b72a0e84cf2ebf6572e02bce3abb72ee0a8a0 (diff) | |
download | llvm-df8956442feda0171fda79393778f698eb0385cf.zip llvm-df8956442feda0171fda79393778f698eb0385cf.tar.gz llvm-df8956442feda0171fda79393778f698eb0385cf.tar.bz2 |
[SimpleLoopUnswitch] Don't use BlockFrequencyInfo to skip cold loops (#159522)
In https://reviews.llvm.org/D129599, non-trivial switching was disabled
for cold loops in the interest of code size. This added a dependency on
BlockFrequencyInfo with PGO, but in loop passes this is only available
on a lossy basis: see https://reviews.llvm.org/D86156
LICM moved away from BFI so as of today SimpleLoopUnswitch is the only
remaining loop pass that uses BFI, for the sole reason to prevent code
size increases in PGO builds. It doesn't use BFI if there's no profile
summary available.
After some investigation on llvm-test-suite it turns out that the lossy
BFI causes very significant deviations in block frequency, since when
new loops are deleted/created during the loop pass manager it can return
frequencies for different loops altogether.
This results in unswitchable loops being mistakenly skipped because they
are thought to be cold.
This patch removes the use of BFI from SimpleLoopUnswitch and thus the
last remaining use of BFI in a loop pass.
To recover the original intent of not unswitching cold code,
PGOForceFunctionAttrs can be used to annotate functions which can be
optimized for code size, since SimpleLoopUnswitch will respect OptSize:
https://reviews.llvm.org/D94559
This isn't 100% the same behaviour since the previous behaviour checked
for coldness at the loop level and this is now at the function level. We
could expand PGOForceFunctionAttrs to be more granular at the loop
level, https://github.com/llvm/llvm-project/issues/159595 tracks this
idea.
Diffstat (limited to 'lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp')
0 files changed, 0 insertions, 0 deletions