diff options
author | Snehasish Kumar <snehasishk@google.com> | 2020-09-16 21:40:00 -0700 |
---|---|---|
committer | Snehasish Kumar <snehasishk@google.com> | 2020-09-24 15:26:15 -0700 |
commit | d2696dec45cdcff791cd53b8b8288d33a0d8dddb (patch) | |
tree | 94c963c1c0b114cf06018a9396f32fef7466a729 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | a22814194e8ea8d581a26992bb27f808e53bbbde (diff) | |
download | llvm-d2696dec45cdcff791cd53b8b8288d33a0d8dddb.zip llvm-d2696dec45cdcff791cd53b8b8288d33a0d8dddb.tar.gz llvm-d2696dec45cdcff791cd53b8b8288d33a0d8dddb.tar.bz2 |
[llvm] Add -bbsections-cold-text-prefix to emit cold clusters to a different section.
This change adds an option to basic block sections to allow cold
clusters to be assigned a custom text prefix. With a custom prefix such
as ".text.split." (D87840), lld can place them in a separate output section.
The benefits are -
* Empirically shown to improve icache and itlb metrics by 3-5%
(absolute) compared to placing split parts in .text.unlikely.
* Mitigates against poor profiles, eg samplePGO profiles used with the
machine function splitter. Optimizations such as hugepage remapping can
make different decisions at the section granularity.
* Enables section granularity hotness monitoring (checking on the
decisions made during compilation vs sample data from production).
Differential Revision: https://reviews.llvm.org/D87813
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 0c43ec8..84fe9df 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -21,6 +21,7 @@ #include "llvm/BinaryFormat/Dwarf.h" #include "llvm/BinaryFormat/ELF.h" #include "llvm/BinaryFormat/MachO.h" +#include "llvm/CodeGen/BasicBlockSectionUtils.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineModuleInfo.h" @@ -833,7 +834,7 @@ MCSection *TargetLoweringObjectFileELF::getSectionForMachineBasicBlock( // name, or a unique ID for the section. SmallString<128> Name; if (MBB.getSectionID() == MBBSectionID::ColdSectionID) { - Name += ".text.unlikely."; + Name += BBSectionsColdTextPrefix; Name += MBB.getParent()->getName(); } else if (MBB.getSectionID() == MBBSectionID::ExceptionSectionID) { Name += ".text.eh."; |