[llvm] c8ac29a - Descriptive symbol names for machine basic block sections.

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Mon May 4 12:12:23 PDT 2020


Author: Snehasish Kumar
Date: 2020-05-04T19:06:43Z
New Revision: c8ac29ab1d798f16999541cd9f08d58ebaa1b4c1

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

LOG: Descriptive symbol names for machine basic block sections.

Today symbol names generated for machine basic block sections use a
unary encoding to reduce bloat. This is essential when every basic block
in the binary is assigned a symbol however with basic block clusters
(rG05192e585ce175b55f2a26b83b4ed7882785c8e6) when we only need to
generate a few non-temporary symbols we can assign more descriptive
names making them more user friendly. With this change -

Cold cluster section for function foo is named "foo.cold"
Exception cluster section for function foo is named "foo.eh"
Other cluster sections identified by their ids are named "foo.ID"
Using this format works well with existing tools. It will demangle as
expected and works with existing symbolizers, profilers and debuggers
out of the box.

$ c++filt _Z3foov.cold
foo() [clone .cold]

$ c++filt _Z3foov.eh
foo() [clone .eh]

$c++filt _Z3foov.1234
foo() [clone 1234]

Tests for basicblock-sections are updated with some cleanup where
appropriate.

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

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineBasicBlock.cpp
    llvm/test/CodeGen/X86/basicblock-sections-clusters-branches.ll
    llvm/test/CodeGen/X86/basicblock-sections-clusters-eh.ll
    llvm/test/CodeGen/X86/basicblock-sections-clusters.ll
    llvm/test/CodeGen/X86/basicblock-sections-cold.ll
    llvm/test/CodeGen/X86/basicblock-sections-directjumps.ll
    llvm/test/CodeGen/X86/basicblock-sections-eh.ll
    llvm/test/CodeGen/X86/basicblock-sections-list.ll
    llvm/test/CodeGen/X86/basicblock-sections-listbb.ll
    llvm/test/CodeGen/X86/basicblock-sections-mir-parse.mir
    llvm/test/CodeGen/X86/basicblock-sections.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index 57dd8d315c85..09e31afef26c 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -62,30 +62,39 @@ MCSymbol *MachineBasicBlock::getSymbol() const {
     MCContext &Ctx = MF->getContext();
     auto Prefix = Ctx.getAsmInfo()->getPrivateLabelPrefix();
 
-    // We emit a non-temporary symbol for every basic block if we have BBLabels
-    // or -- with basic block sections -- when a basic block begins a section.
-    bool BasicBlockSymbols = isBeginSection() || MF->hasBBLabels();
-    auto Delimiter = BasicBlockSymbols ? "." : "_";
     assert(getNumber() >= 0 && "cannot get label for unreachable MBB");
 
-    // With Basic Block Sections, we emit a symbol for every basic block. To
-    // keep the size of strtab small, we choose a unary encoding which can
-    // compress the symbol names significantly.  The basic blocks for function
-    // foo are named a.BB.foo, aa.BB.foo, and so on.
-    if (BasicBlockSymbols) {
+    // We emit a non-temporary symbol for every basic block if we have BBLabels
+    // or -- with basic block sections -- when a basic block begins a section.
+    // With basic block symbols, we use a unary encoding which can
+    // compress the symbol names significantly. For basic block sections where
+    // this block is the first in a cluster, we use a non-temp descriptive name.
+    // Otherwise we fall back to use temp label.
+    if (MF->hasBBLabels()) {
       auto Iter = MF->getBBSectionsSymbolPrefix().begin();
       if (getNumber() < 0 ||
           getNumber() >= (int)MF->getBBSectionsSymbolPrefix().size())
         report_fatal_error("Unreachable MBB: " + Twine(getNumber()));
+      // The basic blocks for function foo are named a.BB.foo, aa.BB.foo, and
+      // so on.
       std::string Prefix(Iter + 1, Iter + getNumber() + 1);
       std::reverse(Prefix.begin(), Prefix.end());
       CachedMCSymbol =
-          Ctx.getOrCreateSymbol(Prefix + Twine(Delimiter) + "BB" +
-                                Twine(Delimiter) + Twine(MF->getName()));
+          Ctx.getOrCreateSymbol(Twine(Prefix) + ".BB." + Twine(MF->getName()));
+    } else if (MF->hasBBSections() && isBeginSection()) {
+      SmallString<5> Suffix;
+      if (SectionID == MBBSectionID::ColdSectionID) {
+        Suffix += ".cold";
+      } else if (SectionID == MBBSectionID::ExceptionSectionID) {
+        Suffix += ".eh";
+      } else {
+        Suffix += "." + std::to_string(SectionID.Number);
+      }
+      CachedMCSymbol = Ctx.getOrCreateSymbol(MF->getName() + Suffix);
     } else {
-      CachedMCSymbol = Ctx.getOrCreateSymbol(
-          Twine(Prefix) + "BB" + Twine(MF->getFunctionNumber()) +
-          Twine(Delimiter) + Twine(getNumber()));
+      CachedMCSymbol = Ctx.getOrCreateSymbol(Twine(Prefix) + "BB" +
+                                             Twine(MF->getFunctionNumber()) +
+                                             "_" + Twine(getNumber()));
     }
   }
   return CachedMCSymbol;

diff  --git a/llvm/test/CodeGen/X86/basicblock-sections-clusters-branches.ll b/llvm/test/CodeGen/X86/basicblock-sections-clusters-branches.ll
index c85f01b91984..a6f297392d94 100644
--- a/llvm/test/CodeGen/X86/basicblock-sections-clusters-branches.ll
+++ b/llvm/test/CodeGen/X86/basicblock-sections-clusters-branches.ll
@@ -17,7 +17,7 @@
 ; RUN: echo '!!1 3' >> %t2
 ; RUN: llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basicblock-sections=%t2 | FileCheck %s -check-prefix=LINUX-SECTIONS2
 
-define void @foo(i1 zeroext) {
+define void @foo(i1 zeroext) nounwind {
   %2 = alloca i8, align 1
   %3 = zext i1 %0 to i8
   store i8 %3, i8* %2, align 1
@@ -43,23 +43,23 @@ declare i32 @baz() #1
 
 ; LINUX-SECTIONS1:	   	.section	.text.foo,"ax", at progbits
 ; LINUX-SECTIONS1-LABEL:	foo:
-; LINUX-SECTIONS1:		jne a.BB.foo
+; LINUX-SECTIONS1:		jne foo.1
 ; LINUX-SECTIONS1-NOT:		{{jne|je|jmp}}
 ; LINUX-SECTIONS1-LABEL:	# %bb.2:
-; LINUX-SECTIONS1:		jmp raa.BB.foo
+; LINUX-SECTIONS1:		jmp foo.cold
 ; LINUX-SECTIONS1:		.section        .text.foo,"ax", at progbits,unique,1
-; LINUX-SECTIONS1-LABEL:	a.BB.foo:
-; LINUX-SECTIONS1:		jmp raa.BB.foo
+; LINUX-SECTIONS1-LABEL:	foo.1:
+; LINUX-SECTIONS1:		jmp foo.cold
 ; LINUX-SECTIONS1:		.section        .text.unlikely.foo,"ax", at progbits
-; LINUX-SECTIONS1-LABEL:	raa.BB.foo:
+; LINUX-SECTIONS1-LABEL:	foo.cold:
 
 ; LINUX-SECTIONS2:		.section        .text.foo,"ax", at progbits
 ; LINUX-SECTIONS2-LABEL:	foo:
-; LINUX-SECTIONS2:		jne a.BB.foo
+; LINUX-SECTIONS2:		jne foo.0
 ; LINUX-SECTIONS2-NOT:		{{jne|je|jmp}}
 ; LINUX-SECTIONS2-LABEL:	# %bb.2:
 ; LINUX-SECTIONS2:		jmp .LBB0_3
 ; LINUX-SECTIONS2:		.section        .text.foo,"ax", at progbits,unique,1
-; LINUX-SECTIONS2:		a.BB.foo:
+; LINUX-SECTIONS2:		foo.0:
 ; LINUX-SECTIONS2-NOT:		{{jne|je|jmp}}
 ; LINUX-SECTIONS2:		.LBB0_3:

diff  --git a/llvm/test/CodeGen/X86/basicblock-sections-clusters-eh.ll b/llvm/test/CodeGen/X86/basicblock-sections-clusters-eh.ll
index cadbdd355db0..60f62d4c152f 100644
--- a/llvm/test/CodeGen/X86/basicblock-sections-clusters-eh.ll
+++ b/llvm/test/CodeGen/X86/basicblock-sections-clusters-eh.ll
@@ -13,7 +13,6 @@
 ; RUN: echo '!main' > %t2
 ; RUN: echo '!!1 2 3' >> %t2
 ; RUN: llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basicblock-sections=%t2 | FileCheck %s -check-prefix=LINUX-SECTIONS2
-;
 
 @_ZTIi = external constant i8*
 
@@ -61,9 +60,9 @@ declare i32 @__gxx_personality_v0(...)
 ; LINUX-SECTIONS1-NOT: 		.section
 ; LINUX-SECTIONS1-LABEL:	.LBB0_6:
 ; LINUX-SECTIONS1: 		.section	.text.main,"ax", at progbits,unique,1
-; LINUX-SECTIONS1-LABEL:	al.BB.main:
+; LINUX-SECTIONS1-LABEL:	main.0:
 ; LINUX-SECTIONS1:		.section	.text.eh.main,"ax", at progbits
-; LINUX-SECTIONS1-LABEL: 	l.BB.main:
+; LINUX-SECTIONS1-LABEL: 	main.eh:
 ; LINUX-SECTIONS1-NOT: 		.section
 ; LINUX-SECTIONS1-LABEL:	.LBB0_3:
 ; LINUX-SECTIONS1-NOT:		.section
@@ -80,7 +79,7 @@ declare i32 @__gxx_personality_v0(...)
 ; LINUX-SECTIONS2-NOT: 		.section
 ; LINUX-SECTIONS2-LABEL:	.LBB0_6:
 ; LINUX-SECTIONS2: 		.section	.text.main,"ax", at progbits,unique,1
-; LINUX-SECTIONS2-LABEL: 	l.BB.main:
+; LINUX-SECTIONS2-LABEL: 	main.0:
 ; LINUX-SECTIONS2-NOT: 		.section
 ; LINUX-SECTIONS2-LABEL:	.LBB0_2:
 ; LINUX-SECTIONS2-NOT: 		.section

diff  --git a/llvm/test/CodeGen/X86/basicblock-sections-clusters.ll b/llvm/test/CodeGen/X86/basicblock-sections-clusters.ll
index 39d0b3898e42..2c40542f6808 100644
--- a/llvm/test/CodeGen/X86/basicblock-sections-clusters.ll
+++ b/llvm/test/CodeGen/X86/basicblock-sections-clusters.ll
@@ -14,7 +14,7 @@
 ; RUN: echo '!!1 3' >> %t2
 ; RUN: llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basicblock-sections=%t2 | FileCheck %s -check-prefix=LINUX-SECTIONS2
 
-define void @foo(i1 zeroext) {
+define void @foo(i1 zeroext) nounwind {
   %2 = alloca i8, align 1
   %3 = zext i1 %0 to i8
   store i8 %3, i8* %2, align 1
@@ -44,12 +44,12 @@ declare i32 @baz() #1
 ; LINUX-SECTIONS1-NOT:  	.section
 ; LINUX-SECTIONS1-LABEL:	# %bb.2:
 ; LINUX-SECTIONS1:		.section        .text.foo,"ax", at progbits,unique,1
-; LINUX-SECTIONS1-LABEL:	a.BB.foo:
+; LINUX-SECTIONS1-LABEL:	foo.1:
 ; LINUX-SECTIONS1-LABEL:	.Ltmp0:
-; LINUX-SECTIONS1-NEXT:		.size a.BB.foo, .Ltmp0-a.BB.foo
+; LINUX-SECTIONS1-NEXT:        .size   foo.1, .Ltmp0-foo.1
 ; LINUX-SECTIONS1-NOT:  	.section
 ; LINUX-SECTIONS1:		.section        .text.unlikely.foo,"ax", at progbits
-; LINUX-SECTIONS1-LABEL:	raa.BB.foo:
+; LINUX-SECTIONS1-LABEL:	foo.cold:
 ; LINUX-SECTIONS1:	   	.section	.text.foo,"ax", at progbits
 ; LINUX-SECTIONS1-LABEL:	.Lfunc_end0:
 ; LINUX-SECTIONS1-NEXT:		.size foo, .Lfunc_end0-foo
@@ -60,12 +60,11 @@ declare i32 @baz() #1
 ; LINUX-SECTIONS2-NOT:   	.section
 ; LINUX-SECTIONS2-LABEL:	# %bb.2:
 ; LINUX-SECTIONS2:		.section        .text.foo,"ax", at progbits,unique,1
-; LINUX-SECTIONS2-NEXT:		a.BB.foo:
+; LINUX-SECTIONS2-NEXT:		foo.0:
 ; LINUX-SECTIONS2-NOT:  	.section
 ; LINUX-SECTIONS2-LABEL:	.LBB0_3:
 ; LINUX-SECTIONS2-LABEL:	.Ltmp0:
-; LINUX-SECTIONS2-NEXT:		.size a.BB.foo, .Ltmp0-a.BB.foo
+; LINUX-SECTIONS2-NEXT:        .size   foo.0, .Ltmp0-foo.0
 ; LINUX-SECTIONS2:		.section        .text.foo,"ax", at progbits
 ; LINUX-SECTIONS2-LABEL:	.Lfunc_end0:
 ; LINUX-SECTIONS2-NEXT:		.size foo, .Lfunc_end0-foo
-

diff  --git a/llvm/test/CodeGen/X86/basicblock-sections-cold.ll b/llvm/test/CodeGen/X86/basicblock-sections-cold.ll
index b2a36e8d2ffc..c7282a1e5736 100644
--- a/llvm/test/CodeGen/X86/basicblock-sections-cold.ll
+++ b/llvm/test/CodeGen/X86/basicblock-sections-cold.ll
@@ -2,10 +2,9 @@
 ; Basic block with id 1 and 2 must be in the cold section.
 ; RUN: echo '!_Z3bazb' > %t
 ; RUN: echo '!!0' >> %t
-; RUN: cat %t
 ; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -basicblock-sections=%t -unique-bb-section-names | FileCheck %s -check-prefix=LINUX-SECTIONS
 
-define void @_Z3bazb(i1 zeroext) {
+define void @_Z3bazb(i1 zeroext) nounwind {
   %2 = alloca i8, align 1
   %3 = zext i1 %0 to i8
   store i8 %3, i8* %2, align 1
@@ -32,10 +31,10 @@ declare i32 @_Z3foov() #1
 ; LINUX-SECTIONS: .section        .text._Z3bazb,"ax", at progbits
 ; LINUX-SECTIONS: _Z3bazb:
 ; Check that the basic block with id 1 doesn't get a section.
-; LINUX-SECTIONS-NOT: .section        .text._Z3bazb.r.BB._Z3bazb,"ax", at progbits,unique
+; 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: r.BB._Z3bazb:
-; LINUX-SECTIONS-NOT: .section        .text._Z3bazb.rr.BB._Z3bazb,"ax", at progbits,unique
+; 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

diff  --git a/llvm/test/CodeGen/X86/basicblock-sections-directjumps.ll b/llvm/test/CodeGen/X86/basicblock-sections-directjumps.ll
index c961f8d32738..8604b129b54c 100644
--- a/llvm/test/CodeGen/X86/basicblock-sections-directjumps.ll
+++ b/llvm/test/CodeGen/X86/basicblock-sections-directjumps.ll
@@ -29,10 +29,10 @@ declare i32 @_Z3foov() #1
 
 ; LINUX-SECTIONS: .section        .text._Z3bazb,"ax", at progbits
 ; LINUX-SECTIONS: _Z3bazb:
-; LINUX-SECTIONS: jmp a.BB._Z3bazb
-; LINUX-SECTIONS: .section        .text._Z3bazb.a.BB._Z3bazb,"ax", at progbits
-; LINUX-SECTIONS: a.BB._Z3bazb:
-; LINUX-SECTIONS: jmp aa.BB._Z3bazb
-; LINUX-SECTIONS: .section        .text._Z3bazb.aa.BB._Z3bazb,"ax", at progbits
-; LINUX-SECTIONS: aa.BB._Z3bazb:
-; LINUX-SECTIONS: jmp raa.BB._Z3bazb
+; LINUX-SECTIONS: jmp _Z3bazb.1
+; LINUX-SECTIONS: .section        .text._Z3bazb._Z3bazb.1,"ax", at progbits
+; LINUX-SECTIONS: _Z3bazb.1:
+; LINUX-SECTIONS: jmp _Z3bazb.2
+; LINUX-SECTIONS: .section        .text._Z3bazb._Z3bazb.2,"ax", at progbits
+; LINUX-SECTIONS: _Z3bazb.2:
+; LINUX-SECTIONS: jmp _Z3bazb.3

diff  --git a/llvm/test/CodeGen/X86/basicblock-sections-eh.ll b/llvm/test/CodeGen/X86/basicblock-sections-eh.ll
index 2d1fd88cbd4d..7e5f4a2fe392 100644
--- a/llvm/test/CodeGen/X86/basicblock-sections-eh.ll
+++ b/llvm/test/CodeGen/X86/basicblock-sections-eh.ll
@@ -80,5 +80,6 @@ declare void @__cxa_end_catch()
 
 ;LINUX-SECTIONS: .section	.text._Z3foob,"ax", at progbits
 ;LINUX-SECTIONS: _Z3foob:
-;LINUX-SECTIONS: .section       .text._Z3foob.laara.BB._Z3foob,"ax", at progbits
-;LINUX-SECTIONS: l{{[a|r]*}}.BB._Z3foob:
+;LINUX-SECTIONS: .section       .text._Z3foob._Z3foob.{{[0-9]+}},"ax", at progbits
+;LINUX-SECTIONS-LABEL: _Z3foob.{{[0-9]+}}:
+;LINUX-SECTIONS:        calll   __cxa_begin_catch

diff  --git a/llvm/test/CodeGen/X86/basicblock-sections-list.ll b/llvm/test/CodeGen/X86/basicblock-sections-list.ll
index 55524ce6b454..9a5056af39ed 100644
--- a/llvm/test/CodeGen/X86/basicblock-sections-list.ll
+++ b/llvm/test/CodeGen/X86/basicblock-sections-list.ll
@@ -2,7 +2,7 @@
 ; RUN: echo '!_Z3foob' > %t
 ; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -basicblock-sections=%t -unique-bb-section-names | FileCheck %s -check-prefix=LINUX-SECTIONS
 
-define i32 @_Z3foob(i1 zeroext %0) #0 {
+define i32 @_Z3foob(i1 zeroext %0) nounwind {
   %2 = alloca i32, align 4
   %3 = alloca i8, align 1
   %4 = zext i1 %0 to i8
@@ -31,7 +31,7 @@ define i32 @_Z3foob(i1 zeroext %0) #0 {
 declare i32 @_Z3barv() #1
 declare i32 @_Z3bazv() #1
 
-define i32 @_Z3zipb(i1 zeroext %0) #0 {
+define i32 @_Z3zipb(i1 zeroext %0) nounwind {
   %2 = alloca i32, align 4
   %3 = alloca i8, align 1
   %4 = zext i1 %0 to i8
@@ -59,18 +59,14 @@ define i32 @_Z3zipb(i1 zeroext %0) #0 {
 
 ; LINUX-SECTIONS: .section        .text._Z3foob,"ax", at progbits
 ; LINUX-SECTIONS: _Z3foob:
-; LINUX-SECTIONS: .section        .text._Z3foob.a.BB._Z3foob,"ax", at progbits
-; LINUX-SECTIONS: a.BB._Z3foob:
-; LINUX-SECTIONS: .section        .text._Z3foob.aa.BB._Z3foob,"ax", at progbits
-; LINUX-SECTIONS: aa.BB._Z3foob:
-; LINUX-SECTIONS: .section        .text._Z3foob.raa.BB._Z3foob,"ax", at progbits
-; LINUX-SECTIONS: raa.BB._Z3foob:
+; LINUX-SECTIONS: .section        .text._Z3foob._Z3foob.1,"ax", at progbits
+; LINUX-SECTIONS: _Z3foob.1:
+; LINUX-SECTIONS: .section        .text._Z3foob._Z3foob.2,"ax", at progbits
+; LINUX-SECTIONS: _Z3foob.2:
+; LINUX-SECTIONS: .section        .text._Z3foob._Z3foob.3,"ax", at progbits
+; LINUX-SECTIONS: _Z3foob.3:
 
 ; LINUX-SECTIONS: .section        .text._Z3zipb,"ax", at progbits
 ; LINUX-SECTIONS: _Z3zipb:
-; LINUX-SECTIONS-NOT: .section        .text._Z3zipb.a.BB._Z3zipb,"ax", at progbits
-; LINUX-SECTIONS-NOT: a.BB._Z3zipb:
-; LINUX-SECTIONS-NOT: .section        .text._Z3zipb.aa.BB._Z3zipb,"ax", at progbits
-; LINUX-SECTIONS-NOT: aa.BB._Z3zipb:
-; LINUX-SECTIONS-NOT: .section        .text._Z3zipb.raa.BB._Z3zipb,"ax", at progbits
-; LINUX-SECTIONS-NOT: raa.BB._Z3zipb:
+; LINUX-SECTIONS-NOT: .section        .text._Z3zipb._Z3zipb.{{[0-9]+}},"ax", at progbits
+; LINUX-SECTIONS-NOT: _Z3zipb.{{[0-9]+}}:

diff  --git a/llvm/test/CodeGen/X86/basicblock-sections-listbb.ll b/llvm/test/CodeGen/X86/basicblock-sections-listbb.ll
index a93ca9fdc2ff..ac17a461d7af 100644
--- a/llvm/test/CodeGen/X86/basicblock-sections-listbb.ll
+++ b/llvm/test/CodeGen/X86/basicblock-sections-listbb.ll
@@ -4,7 +4,7 @@
 ; RUN: echo '!!2' >> %t
 ; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -basicblock-sections=%t -unique-bb-section-names | FileCheck %s -check-prefix=LINUX-SECTIONS
 
-define void @_Z3bazb(i1 zeroext) {
+define void @_Z3bazb(i1 zeroext) nounwind {
   %2 = alloca i8, align 1
   %3 = zext i1 %0 to i8
   store i8 %3, i8* %2, align 1
@@ -28,12 +28,16 @@ declare i32 @_Z3barv() #1
 
 declare i32 @_Z3foov() #1
 
+; Check that the correct block is found using the call insts for foo and bar.
+;
 ; LINUX-SECTIONS: .section        .text._Z3bazb,"ax", at progbits
 ; LINUX-SECTIONS: _Z3bazb:
 ; Check that the basic block with id 1 doesn't get a section.
-; LINUX-SECTIONS-NOT: .section        .text._Z3bazb.r.BB._Z3bazb,"ax", at progbits
-; LINUX-SECTIONS: # %bb.1:
-; LINUX-SECTIONS: .section        .text._Z3bazb.rr.BB._Z3bazb,"ax", at progbits
-; LINUX-SECTIONS: rr.BB._Z3bazb:
+; LINUX-SECTIONS-NOT: .section        .text._Z3bazb._Z3bazb.{{[0-9]+}},"ax", at progbits
+; LINUX-SECTIONS-LABEL: # %bb.1:
+; LINUX-SECTIONS-NEXT:        callq   _Z3barv
+; LINUX-SECTIONS: .section        .text._Z3bazb._Z3bazb.{{[0-9]+}},"ax", at progbits
+; LINUX-SECTIONS-LABEL: _Z3bazb.{{[0-9]+}}:
+; LINUX-SECTIONS-NEXT:        callq   _Z3foov
 ; LINUX-SECTIONS: .Ltmp0:
-; LINUX-SECTIONS-NEXT: .size   rr.BB._Z3bazb, .Ltmp0-rr.BB._Z3bazb
+; LINUX-SECTIONS-NEXT: .size   _Z3bazb.{{[0-9]+}}, .Ltmp0-_Z3bazb.{{[0-9]+}}

diff  --git a/llvm/test/CodeGen/X86/basicblock-sections-mir-parse.mir b/llvm/test/CodeGen/X86/basicblock-sections-mir-parse.mir
index 0c80b32e143c..6011342a6f00 100644
--- a/llvm/test/CodeGen/X86/basicblock-sections-mir-parse.mir
+++ b/llvm/test/CodeGen/X86/basicblock-sections-mir-parse.mir
@@ -124,8 +124,8 @@ body:             |
 
 # CHECK: _Z3foob:
 # CHECK: .section	.text,"ax", at progbits,unique
-# CHECK: a.BB._Z3foob:
+# CHECK: _Z3foob.1:
 # CHECK: .section	.text,"ax", at progbits,unique
-# CHECK: aa.BB._Z3foob:
+# CHECK: _Z3foob.2:
 # CHECK: .section	.text,"ax", at progbits,unique
-# CHECK: aaa.BB._Z3foob:
+# CHECK: _Z3foob.3:

diff  --git a/llvm/test/CodeGen/X86/basicblock-sections.ll b/llvm/test/CodeGen/X86/basicblock-sections.ll
index 85b7e1fc9ac5..5c17b755fa70 100644
--- a/llvm/test/CodeGen/X86/basicblock-sections.ll
+++ b/llvm/test/CodeGen/X86/basicblock-sections.ll
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -basicblock-sections=all -unique-bb-section-names | FileCheck %s -check-prefix=LINUX-SECTIONS
 ; RUN: llc < %s -mtriple=i386-unknown-linux-gnu  -function-sections -basicblock-sections=all -unique-bb-section-names | FileCheck %s -check-prefix=LINUX-SECTIONS
 
-define void @_Z3bazb(i1 zeroext) {
+define void @_Z3bazb(i1 zeroext) nounwind {
   %2 = alloca i8, align 1
   %3 = zext i1 %0 to i8
   store i8 %3, i8* %2, align 1
@@ -28,11 +28,11 @@ declare i32 @_Z3foov() #1
 
 ; LINUX-SECTIONS: .section        .text._Z3bazb,"ax", at progbits
 ; LINUX-SECTIONS: _Z3bazb:
-; LINUX-SECTIONS: .section        .text._Z3bazb.r.BB._Z3bazb,"ax", at progbits
-; LINUX-SECTIONS: r.BB._Z3bazb:
+; LINUX-SECTIONS: .section        .text._Z3bazb._Z3bazb.1,"ax", at progbits
+; LINUX-SECTIONS: _Z3bazb.1:
 ; LINUX-SECTIONS: .Ltmp0:
-; LINUX-SECTIONS-NEXT: .size   r.BB._Z3bazb, .Ltmp0-r.BB._Z3bazb
-; LINUX-SECTIONS: .section        .text._Z3bazb.rr.BB._Z3bazb,"ax", at progbits
-; LINUX-SECTIONS: rr.BB._Z3bazb:
+; LINUX-SECTIONS-NEXT: .size   _Z3bazb.1, .Ltmp0-_Z3bazb.1
+; LINUX-SECTIONS: .section        .text._Z3bazb._Z3bazb.2,"ax", at progbits
+; LINUX-SECTIONS: _Z3bazb.2:
 ; LINUX-SECTIONS: .Ltmp1:
-; LINUX-SECTIONS-NEXT: .size   rr.BB._Z3bazb, .Ltmp1-rr.BB._Z3bazb
+; LINUX-SECTIONS-NEXT: .size   _Z3bazb.2, .Ltmp1-_Z3bazb.2


        


More information about the llvm-commits mailing list