diff options
author | Nicholas Guy <nicholas.guy@arm.com> | 2021-01-28 17:22:21 +0000 |
---|---|---|
committer | Nicholas Guy <nicholas.guy@arm.com> | 2021-02-08 13:28:00 +0000 |
commit | cd880442ae66561e45257f2440321a0a671acae7 (patch) | |
tree | 7a9fcc8c46ea7e186e8c90b1f165bf3ea02e458b /llvm/lib/CodeGen/MachineBlockPlacement.cpp | |
parent | 88d5c4c2eeb66e0ca62d7a502bd82ac1e902cafb (diff) | |
download | llvm-cd880442ae66561e45257f2440321a0a671acae7.zip llvm-cd880442ae66561e45257f2440321a0a671acae7.tar.gz llvm-cd880442ae66561e45257f2440321a0a671acae7.tar.bz2 |
[CodeGen][AArch64] Add TargetInstrInfo hook to modify the TailDuplicateSize default threshold
Different targets might handle branch performance differently, so this patch allows for
targets to specify the TailDuplicateSize threshold. Said threshold defines how small a branch
can be and still be duplicated to generate straight-line code instead.
This patch also specifies said override values for the AArch64 subtarget.
Differential Revision: https://reviews.llvm.org/D95631
Diffstat (limited to 'llvm/lib/CodeGen/MachineBlockPlacement.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBlockPlacement.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp index 048baa4..2e75848 100644 --- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp +++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp @@ -3337,6 +3337,13 @@ bool MachineBlockPlacement::runOnMachineFunction(MachineFunction &MF) { TailDupSize = TailDupPlacementAggressiveThreshold; } + // If there's no threshold provided through options, query the target + // information for a threshold instead. + if (TailDupPlacementThreshold.getNumOccurrences() == 0 && + (PassConfig->getOptLevel() < CodeGenOpt::Aggressive || + TailDupPlacementAggressiveThreshold.getNumOccurrences() == 0)) + TailDupSize = TII->getTailDuplicateSize(PassConfig->getOptLevel()); + if (allowTailDupPlacement()) { MPDT = &getAnalysis<MachinePostDominatorTree>(); bool OptForSize = MF.getFunction().hasOptSize() || |