diff --git a/llvm/lib/CodeGen/BasicBlockSections.cpp b/llvm/lib/CodeGen/BasicBlockSections.cpp --- a/llvm/lib/CodeGen/BasicBlockSections.cpp +++ b/llvm/lib/CodeGen/BasicBlockSections.cpp @@ -81,12 +81,12 @@ // Placing the cold clusters in a separate section mitigates against poor // profiles and allows optimizations such as hugepage mapping to be applied at a -// section granularity. Where necessary, users should set this to ".text.split." -// which is recognized by lld via the `-z keep-text-section-prefix` flag. +// section granularity. Defaults to ".text.split." which is recognized by lld +// via the `-z keep-text-section-prefix` flag. cl::opt llvm::BBSectionsColdTextPrefix( "bbsections-cold-text-prefix", cl::desc("The text prefix to use for cold basic block clusters"), - cl::init(".text.unlikely."), cl::Hidden); + cl::init(".text.split."), cl::Hidden); namespace { diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -867,7 +867,7 @@ assert(MBB.isBeginSection() && "Basic block does not start a section!"); unsigned UniqueID = MCContext::GenericSectionID; - // For cold sections use the .text.unlikely prefix along with the parent + // For cold sections use the .text.split. prefix along with the parent // function name. All cold blocks for the same function go to the same // section. Similarly all exception blocks are grouped by symbol name // under the .text.eh prefix. For regular sections, we either use a unique diff --git a/llvm/test/CodeGen/X86/basic-block-sections-clusters-branches.ll b/llvm/test/CodeGen/X86/basic-block-sections-clusters-branches.ll --- a/llvm/test/CodeGen/X86/basic-block-sections-clusters-branches.ll +++ b/llvm/test/CodeGen/X86/basic-block-sections-clusters-branches.ll @@ -50,7 +50,7 @@ ; LINUX-SECTIONS1: .section .text.foo,"ax",@progbits,unique,1 ; LINUX-SECTIONS1-LABEL: foo.1: ; LINUX-SECTIONS1: jmp foo.cold -; LINUX-SECTIONS1: .section .text.unlikely.foo,"ax",@progbits +; LINUX-SECTIONS1: .section .text.split.foo,"ax",@progbits ; LINUX-SECTIONS1-LABEL: foo.cold: ; LINUX-SECTIONS2: .section .text.foo,"ax",@progbits diff --git a/llvm/test/CodeGen/X86/basic-block-sections-clusters.ll b/llvm/test/CodeGen/X86/basic-block-sections-clusters.ll --- a/llvm/test/CodeGen/X86/basic-block-sections-clusters.ll +++ b/llvm/test/CodeGen/X86/basic-block-sections-clusters.ll @@ -50,7 +50,7 @@ ; LINUX-SECTIONS1-LABEL: .LBB_END0_1: ; LINUX-SECTIONS1-NEXT: .size foo.1, .LBB_END0_1-foo.1 ; LINUX-SECTIONS1-NOT: .section -; LINUX-SECTIONS1: .section .text.unlikely.foo,"ax",@progbits +; LINUX-SECTIONS1: .section .text.split.foo,"ax",@progbits ; LINUX-SECTIONS1-LABEL: foo.cold: ; LINUX-SECTIONS1-LABEL: .LBB_END0_3: ; LINUX-SECTIONS1-NEXT: .size foo.cold, .LBB_END0_3-foo.cold diff --git a/llvm/test/CodeGen/X86/basic-block-sections-cold.ll b/llvm/test/CodeGen/X86/basic-block-sections-cold.ll --- a/llvm/test/CodeGen/X86/basic-block-sections-cold.ll +++ b/llvm/test/CodeGen/X86/basic-block-sections-cold.ll @@ -3,7 +3,7 @@ ; RUN: echo '!_Z3bazb' > %t ; RUN: echo '!!0' >> %t ; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t -unique-basic-block-section-names | FileCheck %s -check-prefix=LINUX-SECTIONS -; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t -unique-basic-block-section-names -bbsections-cold-text-prefix=".text.split." | FileCheck %s -check-prefix=LINUX-SPLIT +; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=%t -unique-basic-block-section-names -bbsections-cold-text-prefix=".text.unlikely." | FileCheck %s -check-prefix=LINUX-SPLIT define void @_Z3bazb(i1 zeroext %0) nounwind { br i1 %0, label %2, label %4 @@ -29,13 +29,13 @@ ; Check that the basic block with id 1 doesn't get a section. ; LINUX-SECTIONS-NOT: .section .text._Z3bazb._Z3bazb.1,"ax",@progbits,unique ; Check that a single cold section is started here and id 1 and 2 blocks are placed here. -; LINUX-SECTIONS: .section .text.unlikely._Z3bazb,"ax",@progbits +; LINUX-SECTIONS: .section .text.split._Z3bazb,"ax",@progbits ; LINUX-SECTIONS: _Z3bazb.cold: ; LINUX-SECTIONS-NOT: .section .text._Z3bazb._Z3bazb.2,"ax",@progbits,unique ; LINUX-SECTIONS: .LBB0_2: ; LINUX-SECTIONS: .size _Z3bazb, .Lfunc_end{{[0-9]}}-_Z3bazb -; LINUX-SPLIT: .section .text.split._Z3bazb,"ax",@progbits +; LINUX-SPLIT: .section .text.unlikely._Z3bazb,"ax",@progbits ; LINUX-SPLIT-NEXT: _Z3bazb.cold: ; LINUX-SPLIT-NEXT: callq _Z3barv ; LINUX-SPLIT: .LBB0_2: diff --git a/llvm/test/CodeGen/X86/machine-function-splitter.ll b/llvm/test/CodeGen/X86/machine-function-splitter.ll --- a/llvm/test/CodeGen/X86/machine-function-splitter.ll +++ b/llvm/test/CodeGen/X86/machine-function-splitter.ll @@ -3,9 +3,9 @@ ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions -mfs-psi-cutoff=950000 | FileCheck %s -check-prefix=MFS-OPTS2 define void @foo1(i1 zeroext %0) nounwind !prof !14 !section_prefix !15 { -;; Check that cold block is moved to .text.unlikely. +;; Check that cold block is moved to .text.split. ; MFS-DEFAULTS-LABEL: foo1 -; MFS-DEFAULTS: .section .text.unlikely.foo1 +; MFS-DEFAULTS: .section .text.split.foo1 ; MFS-DEFAULTS-NEXT: foo1.cold: ; MFS-DEFAULTS-NOT: callq bar ; MFS-DEFAULTS-NEXT: callq baz @@ -65,7 +65,7 @@ define void @foo4(i1 zeroext %0, i1 zeroext %1) nounwind !prof !20 { ;; Check that count threshold works. ; MFS-OPTS1-LABEL: foo4 -; MFS-OPTS1: .section .text.unlikely.foo4 +; MFS-OPTS1: .section .text.split.foo4 ; MFS-OPTS1-NEXT: foo4.cold: ; MFS-OPTS1-NOT: callq bar ; MFS-OPTS1-NOT: callq baz @@ -99,7 +99,7 @@ define void @foo5(i1 zeroext %0, i1 zeroext %1) nounwind !prof !20 { ;; Check that profile summary info cutoff works. ; MFS-OPTS2-LABEL: foo5 -; MFS-OPTS2: .section .text.unlikely.foo5 +; MFS-OPTS2: .section .text.split.foo5 ; MFS-OPTS2-NEXT: foo5.cold: ; MFS-OPTS2-NOT: callq bar ; MFS-OPTS2-NOT: callq baz @@ -152,7 +152,7 @@ define i32 @foo7(i1 zeroext %0) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) !prof !14 { ;; Check that cold ehpads are not split out. ; MFS-DEFAULTS-LABEL: foo7 -; MFS-DEFAULTS: .section .text.unlikely.foo7,"ax",@progbits +; MFS-DEFAULTS: .section .text.split.foo7,"ax",@progbits ; MFS-DEFAULTS-NEXT: foo7.cold: ; MFS-DEFAULTS-NOT: callq _Unwind_Resume ; MFS-DEFAULTS: callq baz