[all-commits] [llvm/llvm-project] 46d2d7: [AArch64][CodeGen] Avoid inverting hot branches du...
Daniel Hoekwater via All-commits
all-commits at lists.llvm.org
Mon Aug 21 09:46:45 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 46d2d7599d9ed5e68fb53e910feb10d47ee2667b
https://github.com/llvm/llvm-project/commit/46d2d7599d9ed5e68fb53e910feb10d47ee2667b
Author: Daniel Hoekwater <hoekwater at google.com>
Date: 2023-08-21 (Mon, 21 Aug 2023)
Changed paths:
M llvm/lib/CodeGen/BranchRelaxation.cpp
M llvm/test/CodeGen/AArch64/branch-relax-cross-section.mir
Log Message:
-----------
[AArch64][CodeGen] Avoid inverting hot branches during relaxation
Current behavior for relaxing out-of-range conditional branches
is to invert the conditional and insert a fallthrough unconditional
branch to the original destination. This approach biases the branch
predictor in the wrong direction, which can degrading performance.
Machine function splitting introduces many rarely-taken cross-section
conditional branches, which are improperly relaxed. Avoid inverting
these branches; instead, retarget them to trampolines at the end of the
function. Doing so increases the runtime cost of jumping to cold code
but eliminates the misprediction cost of jumping to hot code.
Differential Revision: https://reviews.llvm.org/D156837
More information about the All-commits
mailing list