[PATCH] D88997: Set the default for -bbsections-cold-text-prefix to .text.split.

Snehasish Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 7 11:54:49 PDT 2020


snehasish created this revision.
snehasish added reviewers: tmsriram, echristo.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
snehasish requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88997

Files:
  llvm/lib/CodeGen/BasicBlockSections.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


Index: llvm/test/CodeGen/X86/basic-block-sections-cold.ll
===================================================================
--- llvm/test/CodeGen/X86/basic-block-sections-cold.ll
+++ 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", 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:
Index: llvm/test/CodeGen/X86/basic-block-sections-clusters.ll
===================================================================
--- llvm/test/CodeGen/X86/basic-block-sections-clusters.ll
+++ 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", 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
Index: llvm/test/CodeGen/X86/basic-block-sections-clusters-branches.ll
===================================================================
--- llvm/test/CodeGen/X86/basic-block-sections-clusters-branches.ll
+++ llvm/test/CodeGen/X86/basic-block-sections-clusters-branches.ll
@@ -50,7 +50,7 @@
 ; 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
Index: llvm/lib/CodeGen/BasicBlockSections.cpp
===================================================================
--- llvm/lib/CodeGen/BasicBlockSections.cpp
+++ 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<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 {
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88997.296760.patch
Type: text/x-patch
Size: 4068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201007/3b23e2ed/attachment.bin>


More information about the llvm-commits mailing list