diff options
author | Daniel Hoekwater <hoekwater@google.com> | 2024-02-14 18:58:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-14 10:58:07 -0800 |
commit | ea06384bf667c635f78660f0bcfaa01372735b99 (patch) | |
tree | 38ce4ebb172e8b26cf3f16be79f412e158d32efa /llvm/lib/CodeGen/BasicBlockSections.cpp | |
parent | 2d5fb27db71b57f299793160181ef28fea5573e7 (diff) | |
download | llvm-ea06384bf667c635f78660f0bcfaa01372735b99.zip llvm-ea06384bf667c635f78660f0bcfaa01372735b99.tar.gz llvm-ea06384bf667c635f78660f0bcfaa01372735b99.tar.bz2 |
[CodeGen][AArch64] Only split safe blocks in BBSections (#81553)
Some types of machine function and machine basic block are unsafe to
split on AArch64: basic blocks that contain jump table dispatch or
targets (D157124), and blocks that contain inline ASM GOTO blocks
or their targets (D158647) all cause issues and have been excluded
from Machine Function Splitting on AArch64.
These issues are caused by any transformation pass that places
same-function basic blocks in different text sections
(MachineFunctionSplitter and BasicBlockSections) and must be
special-cased in both passes.
Diffstat (limited to 'llvm/lib/CodeGen/BasicBlockSections.cpp')
-rw-r--r-- | llvm/lib/CodeGen/BasicBlockSections.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/BasicBlockSections.cpp b/llvm/lib/CodeGen/BasicBlockSections.cpp index eb3f9e7..09e45ea 100644 --- a/llvm/lib/CodeGen/BasicBlockSections.cpp +++ b/llvm/lib/CodeGen/BasicBlockSections.cpp @@ -208,9 +208,14 @@ assignSections(MachineFunction &MF, if (I != FuncClusterInfo.end()) { MBB.setSectionID(I->second.ClusterID); } else { - // BB goes into the special cold section if it is not specified in the - // cluster info map. - MBB.setSectionID(MBBSectionID::ColdSectionID); + const TargetInstrInfo &TII = + *MBB.getParent()->getSubtarget().getInstrInfo(); + + if (TII.isMBBSafeToSplitToCold(MBB)) { + // BB goes into the special cold section if it is not specified in the + // cluster info map. + MBB.setSectionID(MBBSectionID::ColdSectionID); + } } } |