Basic block sections enables function sections implicitly, this is not needed and is inefficient with "=list" option. We had basic block sections enable function sections implicitly in clang. This is particularly inefficient with "=list" option as it places functions that do not have any basic block sections in separate sections. This causes unnecessary object file overhead for large applications. This patch disables this implicit behavior. It only creates function sections for those functions that require basic block sections. Further, there was an inconistent behavior with llc as llc was not turning on function sections by default. This patch makes llc and clang consistent and tests are added to check the new behavior. This is the first of two patches and this adds functionality in LLVM to create a new section for the entry block if function sections is not enabled. Differential Revision: https://reviews.llvm.org/D93876
42 lines
1.9 KiB
LLVM
42 lines
1.9 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=x86_64-pc-linux -basic-block-sections=all -unique-basic-block-section-names | FileCheck %s -check-prefix=LINUX-SECTIONS
|
|
; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=all -unique-basic-block-section-names -split-machine-functions | 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
|
|
; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -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.[[SECTION_LABEL_1:_Z3bazb.__part.[0-9]+]],"ax",@progbits
|
|
; LINUX-SECTIONS: [[SECTION_LABEL_1]]:
|
|
; LINUX-SECTIONS: .LBB_END0_1:
|
|
; LINUX-SECTIONS-NEXT: .size [[SECTION_LABEL_1]], .LBB_END0_1-[[SECTION_LABEL_1]]
|
|
; LINUX-SECTIONS: .section .text._Z3bazb.[[SECTION_LABEL_2:_Z3bazb.__part.[0-9]+]],"ax",@progbits
|
|
; LINUX-SECTIONS: [[SECTION_LABEL_2]]:
|
|
; LINUX-SECTIONS: .LBB_END0_2:
|
|
; LINUX-SECTIONS-NEXT: .size [[SECTION_LABEL_2]], .LBB_END0_2-[[SECTION_LABEL_2]]
|