This patch changes the functionality of AsmPrinter to name the basic block end labels as LBB_END${i}_${j}, with ${i} being the identifier for the function and ${j} being the identifier for the basic block. The new naming scheme is consistent with how basic block labels are named (.LBB${i}_{j}), and how function end symbol are named (.Lfunc_end${i}) and helps to write stronger tests for the upcoming patch for BB-Info section (as proposed in https://lists.llvm.org/pipermail/llvm-dev/2020-July/143512.html). The end label is used with basicblock-labels (BB-Info section in future) and basicblock-sections to compute the size of basic blocks and basic block sections, respectively. For BB sections, the section containing the entry basic block will not have a BB end label since it already gets the function end-label.
This label is cached for every basic block (CachedEndMCSymbol) like the label for the basic block (CachedMCSymbol).
Differential Revision: https://reviews.llvm.org/D83885
39 lines
1.4 KiB
LLVM
39 lines
1.4 KiB
LLVM
; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=all -unique-basic-block-section-names | FileCheck %s -check-prefix=LINUX-SECTIONS
|
|
; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -function-sections -basic-block-sections=all -unique-basic-block-section-names | FileCheck %s -check-prefix=LINUX-SECTIONS
|
|
|
|
define void @_Z3bazb(i1 zeroext) nounwind {
|
|
%2 = alloca i8, align 1
|
|
%3 = zext i1 %0 to i8
|
|
store i8 %3, i8* %2, align 1
|
|
%4 = load i8, i8* %2, align 1
|
|
%5 = trunc i8 %4 to i1
|
|
br i1 %5, label %6, label %8
|
|
|
|
6: ; preds = %1
|
|
%7 = call i32 @_Z3barv()
|
|
br label %10
|
|
|
|
8: ; preds = %1
|
|
%9 = call i32 @_Z3foov()
|
|
br label %10
|
|
|
|
10: ; preds = %8, %6
|
|
ret void
|
|
}
|
|
|
|
declare i32 @_Z3barv() #1
|
|
|
|
declare i32 @_Z3foov() #1
|
|
|
|
|
|
; LINUX-SECTIONS: .section .text._Z3bazb,"ax",@progbits
|
|
; LINUX-SECTIONS: _Z3bazb:
|
|
; LINUX-SECTIONS: .section .text._Z3bazb._Z3bazb.1,"ax",@progbits
|
|
; LINUX-SECTIONS: _Z3bazb.1:
|
|
; LINUX-SECTIONS: .LBB_END0_1:
|
|
; LINUX-SECTIONS-NEXT: .size _Z3bazb.1, .LBB_END0_1-_Z3bazb.1
|
|
; LINUX-SECTIONS: .section .text._Z3bazb._Z3bazb.2,"ax",@progbits
|
|
; LINUX-SECTIONS: _Z3bazb.2:
|
|
; LINUX-SECTIONS: .LBB_END0_2:
|
|
; LINUX-SECTIONS-NEXT: .size _Z3bazb.2, .LBB_END0_2-_Z3bazb.2
|