[CodeGen] Basic block sections should take precendence over splitting.

The use of basic block sections should take precedence over the machine
function splitting pass. Since they use the same underlying mechanism
they are kept exclusive. Updated the tests to check that split machine
functions is overridden by all flavours of basic block sections.

Differential Revision: https://reviews.llvm.org/D96392
This commit is contained in:
Snehasish Kumar 2021-02-09 19:14:47 -08:00
parent 4dc87d1010
commit d079dbc591
4 changed files with 10 additions and 5 deletions

View File

@ -1187,12 +1187,14 @@ void TargetPassConfig::addMachinePasses() {
}
// Machine function splitter uses the basic block sections feature. Both
// cannot be enabled at the same time.
if (TM->Options.EnableMachineFunctionSplitter ||
EnableMachineFunctionSplitter) {
addPass(createMachineFunctionSplitterPass());
} else if (TM->getBBSectionsType() != llvm::BasicBlockSection::None) {
// cannot be enabled at the same time. Basic block sections takes precedence.
// FIXME: In principle, BasicBlockSection::Labels and splitting can used
// together. Update this check once we have addressed any issues.
if (TM->getBBSectionsType() != llvm::BasicBlockSection::None) {
addPass(llvm::createBasicBlockSectionsPass(TM->getBBSectionsFuncListBuf()));
} else if (TM->Options.EnableMachineFunctionSplitter ||
EnableMachineFunctionSplitter) {
addPass(createMachineFunctionSplitterPass());
}
// Add passes that directly emit MI after all other MI passes.

View File

@ -1,6 +1,7 @@
; Check the basic block sections labels option
; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-sections=labels | FileCheck %s --check-prefix=UNIQ
; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=false -basic-block-sections=labels | FileCheck %s --check-prefix=NOUNIQ
; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-sections=labels -split-machine-functions | FileCheck %s --check-prefix=UNIQ
define void @_Z3bazb(i1 zeroext) personality i32 (...)* @__gxx_personality_v0 {
br i1 %0, label %2, label %7

View File

@ -1,6 +1,7 @@
; Check the basic block sections list option.
; RUN: echo '!_Z3foob' > %t
; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t -unique-basic-block-section-names | FileCheck %s -check-prefix=LINUX-SECTIONS
; RUN: llc < %s -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t -unique-basic-block-section-names -split-machine-functions | FileCheck %s -check-prefix=LINUX-SECTIONS
define i32 @_Z3foob(i1 zeroext %0) nounwind {
%2 = alloca i32, align 4

View File

@ -1,5 +1,6 @@
; 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
; 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
define void @_Z3bazb(i1 zeroext) nounwind {
%2 = alloca i8, align 1