[llvm] 77638a5 - [llvm] Set the default for -bbsections-cold-text-prefix to .text.split.

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 14 12:29:08 PDT 2020


Author: Snehasish Kumar
Date: 2020-10-14T12:16:36-07:00
New Revision: 77638a5343d5b4c1a87ec2b7fb3671ccb108a059

URL: https://github.com/llvm/llvm-project/commit/77638a5343d5b4c1a87ec2b7fb3671ccb108a059
DIFF: https://github.com/llvm/llvm-project/commit/77638a5343d5b4c1a87ec2b7fb3671ccb108a059.diff

LOG: [llvm] Set the default for -bbsections-cold-text-prefix to .text.split.

After using this for a while, we find that it is generally useful to
have it set to .text.split. by default, removing the need for an
additional -mllvm option.

Differential Revision: https://reviews.llvm.org/D88997

Added: 
    

Modified: 
    llvm/lib/CodeGen/BasicBlockSections.cpp
    llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    llvm/test/CodeGen/X86/basic-block-sections-clusters-branches.ll
    llvm/test/CodeGen/X86/basic-block-sections-clusters.ll
    llvm/test/CodeGen/X86/basic-block-sections-cold.ll
    llvm/test/CodeGen/X86/machine-function-splitter.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/BasicBlockSections.cpp b/llvm/lib/CodeGen/BasicBlockSections.cpp
index 5c47481d45b3..7499ea8b42d4 100644
--- a/llvm/lib/CodeGen/BasicBlockSections.cpp
+++ b/llvm/lib/CodeGen/BasicBlockSections.cpp
@@ -81,12 +81,12 @@ using namespace llvm;
 
 // 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<std::string> 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
index 92ffbec168eb..de0071685799 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -867,7 +867,7 @@ MCSection *TargetLoweringObjectFileELF::getSectionForMachineBasicBlock(
   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
index ec90c279e6ff..914ebd0cff7a 100644
--- 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 @@ declare i32 @baz() #1
 ; LINUX-SECTIONS1:		.section        .text.foo,"ax", at progbits,unique,1
 ; LINUX-SECTIONS1-LABEL:	foo.1:
 ; LINUX-SECTIONS1:		jmp foo.cold
-; LINUX-SECTIONS1:		.section        .text.unlikely.foo,"ax", at progbits
+; LINUX-SECTIONS1:		.section        .text.split.foo,"ax", at progbits
 ; LINUX-SECTIONS1-LABEL:	foo.cold:
 
 ; LINUX-SECTIONS2:		.section        .text.foo,"ax", at progbits

diff  --git a/llvm/test/CodeGen/X86/basic-block-sections-clusters.ll b/llvm/test/CodeGen/X86/basic-block-sections-clusters.ll
index 1fd76f470cfa..ce0e7589c096 100644
--- a/llvm/test/CodeGen/X86/basic-block-sections-clusters.ll
+++ b/llvm/test/CodeGen/X86/basic-block-sections-clusters.ll
@@ -50,7 +50,7 @@ declare i32 @baz() #1
 ; 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", at progbits
+; LINUX-SECTIONS1:		.section        .text.split.foo,"ax", at 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
index d9d456ad90dd..be016df7061b 100644
--- 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 @@ declare i32 @_Z3foov() #1
 ; Check that the basic block with id 1 doesn't get a section.
 ; LINUX-SECTIONS-NOT: .section        .text._Z3bazb._Z3bazb.1,"ax", at 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", at progbits
+; LINUX-SECTIONS: .section	.text.split._Z3bazb,"ax", at progbits
 ; LINUX-SECTIONS: _Z3bazb.cold:
 ; LINUX-SECTIONS-NOT: .section        .text._Z3bazb._Z3bazb.2,"ax", at progbits,unique
 ; LINUX-SECTIONS: .LBB0_2:
 ; LINUX-SECTIONS: .size   _Z3bazb, .Lfunc_end{{[0-9]}}-_Z3bazb
 
-; LINUX-SPLIT:      .section	.text.split._Z3bazb,"ax", at progbits
+; LINUX-SPLIT:      .section	.text.unlikely._Z3bazb,"ax", at 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
index ff95dafc9bcc..188e4716349d 100644
--- 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 @foo3(i1 zeroext %0) nounwind !section_prefix !15 {
 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 @foo4(i1 zeroext %0, i1 zeroext %1) nounwind !prof !20 {
 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 void @foo6(i1 zeroext %0) nounwind section "nosplit" !prof !14 {
 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", at progbits
+; MFS-DEFAULTS:       .section        .text.split.foo7,"ax", at progbits
 ; MFS-DEFAULTS-NEXT:  foo7.cold:
 ; MFS-DEFAULTS-NOT:   callq   _Unwind_Resume
 ; MFS-DEFAULTS:       callq   baz


        


More information about the llvm-commits mailing list