[clang] [llvm] [clang][CodeGen] Place constructor/destructor functions in .text.startup/.text… (PR #200221)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 24 08:48:59 PDT 2026


================
@@ -1864,7 +1864,8 @@ bool TargetInstrInfo::isFunctionSafeToSplit(const MachineFunction &MF) const {
   // or functions of unknown hotness. Lukewarm functions have no prefix.
   std::optional<StringRef> SectionPrefix = MF.getFunction().getSectionPrefix();
   if (SectionPrefix &&
-      (*SectionPrefix == "unlikely" || *SectionPrefix == "unknown")) {
+      (*SectionPrefix == "unlikely" || *SectionPrefix == "unknown" ||
+       *SectionPrefix == "startup" || *SectionPrefix == "exit")) {
----------------
Jiang-XueZhi wrote:

Thank you for the reminder. I have updated the corresponding test case in llvm/test/CodeGen/Generic/machine-function-splitter.ll. 

The test now demonstrates that when the section prefix contains either startup or exit, the affected function is not subjected to splitting.

https://github.com/llvm/llvm-project/pull/200221


More information about the cfe-commits mailing list