diff options
author | Kazu Hirata <kazu@google.com> | 2024-09-25 12:34:43 -0700 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2024-09-25 12:34:43 -0700 |
commit | 639a0afa9955a8613902e46e168767bc05c46cdd (patch) | |
tree | 6019e52986dad7fa3b6440574413ab42db1df05d | |
parent | 1911a50fae8a441b445eb835b98950710d28fc88 (diff) | |
download | llvm-639a0afa9955a8613902e46e168767bc05c46cdd.zip llvm-639a0afa9955a8613902e46e168767bc05c46cdd.tar.gz llvm-639a0afa9955a8613902e46e168767bc05c46cdd.tar.bz2 |
Revert "Deprecate the `-fbasic-block-sections=labels` option. (#107494)"
This reverts commit 1911a50fae8a441b445eb835b98950710d28fc88.
Several bots are failing:
https://lab.llvm.org/buildbot/#/builders/190/builds/6519
https://lab.llvm.org/buildbot/#/builders/3/builds/5248
https://lab.llvm.org/buildbot/#/builders/18/builds/4463
23 files changed, 79 insertions, 48 deletions
diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst index 4f03388..57d78f8 100644 --- a/clang/docs/UsersManual.rst +++ b/clang/docs/UsersManual.rst @@ -2369,16 +2369,14 @@ are listed below. $ cd $P/bar && clang -c -funique-internal-linkage-names name_conflict.c $ cd $P && clang foo/name_conflict.o && bar/name_conflict.o -.. option:: -f[no]-basic-block-address-map: - Emits a ``SHT_LLVM_BB_ADDR_MAP`` section which includes address offsets for each - basic block in the program, relative to the parent function address. - - -.. option:: -fbasic-block-sections=[all, list=<arg>, none] +.. option:: -fbasic-block-sections=[labels, all, list=<arg>, none] Controls how Clang emits text sections for basic blocks. With values ``all`` and ``list=<arg>``, each basic block or a subset of basic blocks can be placed - in its own unique section. + in its own unique section. With the "labels" value, normal text sections are + emitted, but a ``.bb_addr_map`` section is emitted which includes address + offsets for each basic block in the program, relative to the parent function + address. With the ``list=<arg>`` option, a file containing the subset of basic blocks that need to placed in unique sections can be specified. The format of the diff --git a/clang/include/clang/Basic/CodeGenOptions.h b/clang/include/clang/Basic/CodeGenOptions.h index 814d4d4..f2a707a 100644 --- a/clang/include/clang/Basic/CodeGenOptions.h +++ b/clang/include/clang/Basic/CodeGenOptions.h @@ -107,13 +107,18 @@ public: // This field stores one of the allowed values for the option // -fbasic-block-sections=. The allowed values with this option are: - // {"all", "list=<file>", "none"}. + // {"labels", "all", "list=<file>", "none"}. // + // "labels": Only generate basic block symbols (labels) for all basic + // blocks, do not generate unique sections for basic blocks. + // Use the machine basic block id in the symbol name to + // associate profile info from virtual address to machine + // basic block. // "all" : Generate basic block sections for all basic blocks. // "list=<file>": Generate basic block sections for a subset of basic blocks. // The functions and the machine basic block ids are specified // in the file. - // "none": Disable sections for basic blocks. + // "none": Disable sections/labels for basic blocks. std::string BBSections; // If set, override the default value of MCAsmInfo::BinutilsVersion. If diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index c22b07e..23bd686 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -4244,8 +4244,8 @@ defm basic_block_address_map : BoolFOption<"basic-block-address-map", def fbasic_block_sections_EQ : Joined<["-"], "fbasic-block-sections=">, Group<f_Group>, Visibility<[ClangOption, CC1Option, CC1AsOption]>, HelpText<"Place each function's basic blocks in unique sections (ELF Only)">, - DocBrief<[{Place each basic block or a subset of basic blocks in its own section.}]>, - Values<"all,none,list=">, + DocBrief<[{Generate labels for each basic block or place each basic block or a subset of basic blocks in its own section.}]>, + Values<"all,labels,none,list=">, MarshallingInfoString<CodeGenOpts<"BBSections">, [{"none"}]>; defm data_sections : BoolFOption<"data-sections", CodeGenOpts<"DataSections">, DefaultFalse, diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 62c6a57..916c92a 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -429,6 +429,7 @@ static bool initTargetOptions(DiagnosticsEngine &Diags, Options.BBSections = llvm::StringSwitch<llvm::BasicBlockSection>(CodeGenOpts.BBSections) .Case("all", llvm::BasicBlockSection::All) + .Case("labels", llvm::BasicBlockSection::Labels) .StartsWith("list=", llvm::BasicBlockSection::List) .Case("none", llvm::BasicBlockSection::None) .Default(llvm::BasicBlockSection::None); diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 9525f37..0bab48ca 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6228,13 +6228,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (Arg *A = Args.getLastArg(options::OPT_fbasic_block_sections_EQ)) { StringRef Val = A->getValue(); - if (Val == "labels") { - D.Diag(diag::warn_drv_deprecated_arg) - << A->getAsString(Args) << /*hasReplacement=*/true - << "-fbasic-block-address-map"; - CmdArgs.push_back("-fbasic-block-address-map"); - } else if (Triple.isX86() && Triple.isOSBinFormatELF()) { - if (Val != "all" && Val != "none" && !Val.starts_with("list=")) + if (Triple.isX86() && Triple.isOSBinFormatELF()) { + if (Val != "all" && Val != "labels" && Val != "none" && + !Val.starts_with("list=")) D.Diag(diag::err_drv_invalid_value) << A->getAsString(Args) << A->getValue(); else diff --git a/clang/test/Driver/fbasic-block-sections.c b/clang/test/Driver/fbasic-block-sections.c index 6dfba5f..e13cc81 100644 --- a/clang/test/Driver/fbasic-block-sections.c +++ b/clang/test/Driver/fbasic-block-sections.c @@ -22,8 +22,7 @@ // CHECK-OPT-NONE: "-fbasic-block-sections=none" // CHECK-OPT-ALL: "-fbasic-block-sections=all" // CHECK-OPT-LIST: "-fbasic-block-sections={{[^ ]*}}fbasic-block-sections.c" -// CHECK-OPT-LABELS: warning: argument '-fbasic-block-sections=labels' is deprecated, use '-fbasic-block-address-map' instead -// CHECK-OPT-LABELS: "-fbasic-block-address-map" +// CHECK-OPT-LABELS: "-fbasic-block-sections=labels" // CHECK-TRIPLE: error: unsupported option '-fbasic-block-sections=all' for target // CHECK-INVALID-VALUE: error: invalid value {{[^ ]*}} in '-fbasic-block-sections={{.*}}' // CHECK-OPT-NULL-LIST: "-fbasic-block-sections=list=" diff --git a/llvm/docs/CommandGuide/llvm-objdump.rst b/llvm/docs/CommandGuide/llvm-objdump.rst index ab9f583..7f8def7 100644 --- a/llvm/docs/CommandGuide/llvm-objdump.rst +++ b/llvm/docs/CommandGuide/llvm-objdump.rst @@ -272,7 +272,7 @@ OPTIONS When printing a PC-relative global symbol reference, print it as an offset from the leading symbol. When a bb-address-map section is present (i.e., the object file is built with - ``-fbasic-block-address-map``), labels are retrieved from that section + ``-fbasic-block-sections=labels``), labels are retrieved from that section instead. If a pgo-analysis-map is present alongside the bb-address-map, any available analyses are printed after the relevant block label. By default, any analysis with a special representation (i.e. BlockFrequency, diff --git a/llvm/docs/Extensions.rst b/llvm/docs/Extensions.rst index ea26784..abc34bc3 100644 --- a/llvm/docs/Extensions.rst +++ b/llvm/docs/Extensions.rst @@ -401,7 +401,7 @@ the symbol that belongs to the partition. It may be constructed as follows: This section stores the binary address of basic blocks along with other related metadata. This information can be used to map binary profiles (like perf profiles) directly to machine basic blocks. -This section is emitted with ``-basic-block-address-map`` and will contain +This section is emitted with ``-basic-block-sections=labels`` and will contain a BB address map table for every function. The ``SHT_LLVM_BB_ADDR_MAP`` type provides backward compatibility to allow diff --git a/llvm/include/llvm/CodeGen/MachineFunction.h b/llvm/include/llvm/CodeGen/MachineFunction.h index 997960f..5c1da4f 100644 --- a/llvm/include/llvm/CodeGen/MachineFunction.h +++ b/llvm/include/llvm/CodeGen/MachineFunction.h @@ -699,6 +699,11 @@ public: BBSectionsType == BasicBlockSection::Preset); } + /// Returns true if basic block labels are to be generated for this function. + bool hasBBLabels() const { + return BBSectionsType == BasicBlockSection::Labels; + } + void setBBSectionsType(BasicBlockSection V) { BBSectionsType = V; } /// Assign IsBeginSection IsEndSection fields for basic blocks in this diff --git a/llvm/include/llvm/Target/TargetOptions.h b/llvm/include/llvm/Target/TargetOptions.h index 88f2538..94e0fa2 100644 --- a/llvm/include/llvm/Target/TargetOptions.h +++ b/llvm/include/llvm/Target/TargetOptions.h @@ -64,6 +64,9 @@ namespace llvm { List, // Get list of functions & BBs from a file. Selectively enables // basic block sections for a subset of basic blocks which can be // used to control object size bloats from creating sections. + Labels, // Do not use Basic Block Sections but label basic blocks. This + // is useful when associating profile counts from virtual addresses + // to basic blocks. Preset, // Similar to list but the blocks are identified by passes which // seek to use Basic Block Sections, e.g. MachineFunctionSplitter. // This option cannot be set via the command line. diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 3172789..d17800d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1432,7 +1432,7 @@ void AsmPrinter::emitBBAddrMapSection(const MachineFunction &MF) { OutStreamer->AddComment("BB id"); // Emit the BB ID for this basic block. // We only emit BaseID since CloneID is unset for - // -basic-block-adress-map. + // basic-block-sections=labels. // TODO: Emit the full BBID when labels and sections can be mixed // together. OutStreamer->emitULEB128IntValue(MBB.getBBID()->BaseID); @@ -1866,7 +1866,7 @@ void AsmPrinter::emitFunctionBody() { // We must emit temporary symbol for the end of this basic block, if either // we have BBLabels enabled or if this basic blocks marks the end of a // section. - if (MF->getTarget().Options.BBAddrMap || + if (MF->hasBBLabels() || MF->getTarget().Options.BBAddrMap || (MAI->hasDotTypeDotSizeDirective() && MBB.isEndSection())) OutStreamer->emitLabel(MBB.getEndSymbol()); @@ -2021,7 +2021,7 @@ void AsmPrinter::emitFunctionBody() { // Emit section containing BB address offsets and their metadata, when // BB labels are requested for this function. Skip empty functions. if (HasAnyRealCode) { - if (MF->getTarget().Options.BBAddrMap) + if (MF->hasBBLabels() || MF->getTarget().Options.BBAddrMap) emitBBAddrMapSection(*MF); else if (PgoAnalysisMapFeatures.getBits() != 0) MF->getContext().reportWarning( @@ -2620,7 +2620,7 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) { F.hasFnAttribute("xray-instruction-threshold") || needFuncLabels(MF, *this) || NeedsLocalForSize || MF.getTarget().Options.EmitStackSizeSection || - MF.getTarget().Options.BBAddrMap) { + MF.getTarget().Options.BBAddrMap || MF.hasBBLabels()) { CurrentFnBegin = createTempSymbol("func_begin"); if (NeedsLocalForSize) CurrentFnSymForSize = CurrentFnBegin; @@ -4155,7 +4155,8 @@ bool AsmPrinter::shouldEmitLabelForBasicBlock( // With `-fbasic-block-sections=`, a label is needed for every non-entry block // in the labels mode (option `=labels`) and every section beginning in the // sections mode (`=all` and `=list=`). - if ((MF->getTarget().Options.BBAddrMap || MBB.isBeginSection()) && + if ((MF->hasBBLabels() || MF->getTarget().Options.BBAddrMap || + MBB.isBeginSection()) && !MBB.isEntryBlock()) return true; // A label is needed for any block with at least one predecessor (when that diff --git a/llvm/lib/CodeGen/BasicBlockSections.cpp b/llvm/lib/CodeGen/BasicBlockSections.cpp index 1eedfc4..0071284 100644 --- a/llvm/lib/CodeGen/BasicBlockSections.cpp +++ b/llvm/lib/CodeGen/BasicBlockSections.cpp @@ -311,6 +311,11 @@ bool BasicBlockSections::handleBBSections(MachineFunction &MF) { // original layout positions and finding the original fallthroughs. MF.RenumberBlocks(); + if (BBSectionsType == BasicBlockSection::Labels) { + MF.setBBSectionsType(BBSectionsType); + return true; + } + DenseMap<UniqueBBID, BBClusterInfo> FuncClusterInfo; if (BBSectionsType == BasicBlockSection::List) { auto [HasProfile, ClusterInfo] = @@ -377,6 +382,8 @@ bool BasicBlockSections::handleBBSections(MachineFunction &MF) { // avoids the need to store basic block IDs in the BB address map section, since // they can be determined implicitly. bool BasicBlockSections::handleBBAddrMap(MachineFunction &MF) { + if (MF.getTarget().getBBSectionsType() == BasicBlockSection::Labels) + return false; if (!MF.getTarget().Options.BBAddrMap) return false; MF.RenumberBlocks(); diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp index d180cfc..9e42deb 100644 --- a/llvm/lib/CodeGen/CommandFlags.cpp +++ b/llvm/lib/CodeGen/CommandFlags.cpp @@ -525,6 +525,8 @@ llvm::BasicBlockSection codegen::getBBSectionsMode(llvm::TargetOptions &Options) { if (getBBSections() == "all") return BasicBlockSection::All; + else if (getBBSections() == "labels") + return BasicBlockSection::Labels; else if (getBBSections() == "none") return BasicBlockSection::None; else { diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp index a0f0e27..27f0a93 100644 --- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp @@ -780,7 +780,7 @@ bool MIParser::parseBasicBlockDefinition( "' is not defined in the function '" + MF.getName() + "'"); } - auto *MBB = MF.CreateMachineBasicBlock(BB, BBID); + auto *MBB = MF.CreateMachineBasicBlock(BB); MF.insert(MF.end(), MBB); bool WasInserted = MBBSlots.insert(std::make_pair(ID, MBB)).second; if (!WasInserted) @@ -799,6 +799,13 @@ bool MIParser::parseBasicBlockDefinition( MBB->setSectionID(*SectionID); MF.setBBSectionsType(BasicBlockSection::List); } + if (BBID.has_value()) { + // BBSectionsType is set to `List` if any basic blocks has `SectionID`. + // Here, we set it to `Labels` if it hasn't been set above. + if (!MF.hasBBSections()) + MF.setBBSectionsType(BasicBlockSection::Labels); + MBB->setBBID(BBID.value()); + } MBB->setCallFrameSize(CallFrameSize); return false; } diff --git a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp index 997c428..be07fbf 100644 --- a/llvm/lib/CodeGen/MIRParser/MIRParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIRParser.cpp @@ -569,7 +569,9 @@ MIRParserImpl::initializeMachineFunction(const yaml::MachineFunction &YamlMF, return true; } // Check Basic Block Section Flags. - if (MF.hasBBSections()) { + if (MF.getTarget().getBBSectionsType() == BasicBlockSection::Labels) { + MF.setBBSectionsType(BasicBlockSection::Labels); + } else if (MF.hasBBSections()) { MF.assignBeginEndSections(); } PFS.SM = &SM; diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index b56888a..ab45663 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/lib/CodeGen/MachineFunction.cpp @@ -465,9 +465,11 @@ MachineFunction::CreateMachineBasicBlock(const BasicBlock *BB, MachineBasicBlock *MBB = new (BasicBlockRecycler.Allocate<MachineBasicBlock>(Allocator)) MachineBasicBlock(*this, BB); - // Set BBID for `-basic-block-sections=list` and `-basic-block-address-map` to - // allow robust mapping of profiles to basic blocks. - if (Target.Options.BBAddrMap || + // Set BBID for `-basic-block=sections=labels` and + // `-basic-block-sections=list` to allow robust mapping of profiles to basic + // blocks. + if (Target.getBBSectionsType() == BasicBlockSection::Labels || + Target.Options.BBAddrMap || Target.getBBSectionsType() == BasicBlockSection::List) MBB->setBBID(BBID.has_value() ? *BBID : UniqueBBID{NextBBID++, 0}); return MBB; diff --git a/llvm/test/CodeGen/X86/basic-block-address-map-function-sections.ll b/llvm/test/CodeGen/X86/basic-block-address-map-function-sections.ll index 9ff9638..d767860 100644 --- a/llvm/test/CodeGen/X86/basic-block-address-map-function-sections.ll +++ b/llvm/test/CodeGen/X86/basic-block-address-map-function-sections.ll @@ -1,3 +1,4 @@ +; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-sections=labels | FileCheck %s ; RUN: llc < %s -mtriple=x86_64 -function-sections -basic-block-address-map | FileCheck %s $_Z4fooTIiET_v = comdat any diff --git a/llvm/test/CodeGen/X86/basic-block-address-map.ll b/llvm/test/CodeGen/X86/basic-block-address-map.ll index 4f12258..6ab24b4 100644 --- a/llvm/test/CodeGen/X86/basic-block-address-map.ll +++ b/llvm/test/CodeGen/X86/basic-block-address-map.ll @@ -1,7 +1,9 @@ ; Check the basic block sections labels option ; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map | FileCheck %s --check-prefixes=CHECK,UNIQ +; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-sections=labels | FileCheck %s --check-prefixes=CHECK,UNIQ ; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=false -basic-block-address-map | FileCheck %s --check-prefixes=CHECK,NOUNIQ -; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -split-machine-functions | FileCheck %s --check-prefixes=CHECK,UNIQ +; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=false -basic-block-sections=labels | FileCheck %s --check-prefixes=CHECK,NOUNIQ +; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-sections=labels -split-machine-functions | FileCheck %s --check-prefixes=CHECK,UNIQ define void @_Z3bazb(i1 zeroext, i1 zeroext) personality ptr @__gxx_personality_v0 { br i1 %0, label %3, label %8 diff --git a/llvm/test/CodeGen/X86/basic-block-address-map-mir-parse.mir b/llvm/test/CodeGen/X86/basic-block-labels-mir-parse.mir index 86f5f27..6408f0a 100644 --- a/llvm/test/CodeGen/X86/basic-block-address-map-mir-parse.mir +++ b/llvm/test/CodeGen/X86/basic-block-labels-mir-parse.mir @@ -1,5 +1,5 @@ # Start after bbsections0-prepare and check that the BB address map is generated. -# RUN: llc -mtriple x86_64-unknown-linux-gnu -start-after=bbsections-prepare -basic-block-address-map %s -o - | FileCheck %s -check-prefix=CHECK +# RUN: llc -mtriple x86_64-unknown-linux-gnu -start-after=bbsections-prepare %s -o - | FileCheck %s -check-prefix=CHECK # How to generate the input: # foo.cc @@ -9,7 +9,7 @@ # } # # clang -O0 -S -emit-llvm foo.cc -# llc < foo.ll -stop-after=bbsections-prepare -basic-block-address-map +# llc < foo.ll -stop-after=bbsections-prepare -basic-block-sections=labels # CHECK: .section .llvm_bb_addr_map,"o",@llvm_bb_addr_map,.text --- | diff --git a/llvm/test/CodeGen/X86/basic-block-address-map-empty-block.ll b/llvm/test/CodeGen/X86/basic-block-sections-labels-empty-block.ll index 84948b7..8e0f4fa 100644 --- a/llvm/test/CodeGen/X86/basic-block-address-map-empty-block.ll +++ b/llvm/test/CodeGen/X86/basic-block-sections-labels-empty-block.ll @@ -1,5 +1,5 @@ ;; This test verifies that with -gc-empty-basic-blocks SHT_LLVM_BB_ADDR_MAP will not include entries for empty blocks. -; RUN: llc < %s -mtriple=x86_64 -O0 -basic-block-address-map -gc-empty-basic-blocks | FileCheck --check-prefix=CHECK %s +; RUN: llc < %s -mtriple=x86_64 -O0 -basic-block-sections=labels -gc-empty-basic-blocks | FileCheck --check-prefix=CHECK %s define void @foo(i1 zeroext %0) nounwind { br i1 %0, label %2, label %empty_block diff --git a/llvm/test/CodeGen/X86/basic-block-address-map-empty-function.ll b/llvm/test/CodeGen/X86/basic-block-sections-labels-empty-function.ll index 444655f..42d0921 100644 --- a/llvm/test/CodeGen/X86/basic-block-address-map-empty-function.ll +++ b/llvm/test/CodeGen/X86/basic-block-sections-labels-empty-function.ll @@ -1,6 +1,6 @@ ;; Verify that the BB address map is not emitted for empty functions. -; RUN: llc < %s -mtriple=x86_64 -basic-block-address-map | FileCheck %s --check-prefixes=CHECK,BASIC -; RUN: llc < %s -mtriple=x86_64 -basic-block-address-map -pgo-analysis-map=func-entry-count,bb-freq | FileCheck %s --check-prefixes=CHECK,PGO +; RUN: llc < %s -mtriple=x86_64 -basic-block-sections=labels | FileCheck %s --check-prefixes=CHECK,BASIC +; RUN: llc < %s -mtriple=x86_64 -basic-block-sections=labels -pgo-analysis-map=func-entry-count,bb-freq | FileCheck %s --check-prefixes=CHECK,PGO define void @empty_func() { entry: diff --git a/llvm/test/CodeGen/X86/basic-block-address-map-pgo-features.ll b/llvm/test/CodeGen/X86/basic-block-sections-labels-pgo-features.ll index 73fe4f6..92d3c88 100644 --- a/llvm/test/CodeGen/X86/basic-block-address-map-pgo-features.ll +++ b/llvm/test/CodeGen/X86/basic-block-sections-labels-pgo-features.ll @@ -1,13 +1,13 @@ ; Check the basic block sections labels option -; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map | FileCheck %s --check-prefixes=CHECK,BASIC +; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-sections=labels | FileCheck %s --check-prefixes=CHECK,BASIC ;; Also verify this holds for all PGO features enabled -; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=func-entry-count,bb-freq,br-prob | FileCheck %s --check-prefixes=CHECK,PGO-ALL,PGO-FEC,PGO-BBF,PGO-BRP +; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-sections=labels -pgo-analysis-map=func-entry-count,bb-freq,br-prob | FileCheck %s --check-prefixes=CHECK,PGO-ALL,PGO-FEC,PGO-BBF,PGO-BRP ;; Also verify that pgo extension only includes the enabled feature -; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=func-entry-count | FileCheck %s --check-prefixes=CHECK,PGO-FEC,FEC-ONLY -; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=bb-freq | FileCheck %s --check-prefixes=CHECK,PGO-BBF,BBF-ONLY -; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=br-prob | FileCheck %s --check-prefixes=CHECK,PGO-BRP,BRP-ONLY +; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-sections=labels -pgo-analysis-map=func-entry-count | FileCheck %s --check-prefixes=CHECK,PGO-FEC,FEC-ONLY +; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-sections=labels -pgo-analysis-map=bb-freq | FileCheck %s --check-prefixes=CHECK,PGO-BBF,BBF-ONLY +; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-sections=labels -pgo-analysis-map=br-prob | FileCheck %s --check-prefixes=CHECK,PGO-BRP,BRP-ONLY define void @_Z3bazb(i1 zeroext, i1 zeroext) personality ptr @__gxx_personality_v0 !prof !0 { diff --git a/llvm/test/CodeGen/X86/basic-block-sections-mir-print.ll b/llvm/test/CodeGen/X86/basic-block-sections-mir-print.ll index fec8765..17679035 100644 --- a/llvm/test/CodeGen/X86/basic-block-sections-mir-print.ll +++ b/llvm/test/CodeGen/X86/basic-block-sections-mir-print.ll @@ -1,5 +1,5 @@ ; Stop after bbsections-prepare and check MIR output for section type. -; RUN: llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basic-block-address-map -stop-after=bbsections-prepare | FileCheck %s -check-prefix=BBADDRMAP +; RUN: llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=labels -stop-after=bbsections-prepare | FileCheck %s -check-prefix=BBLABELS ; RUN: echo '!_Z3foob' > %t ; RUN: echo '!!1' >> %t ; RUN: echo '!!2' >> %t @@ -33,7 +33,7 @@ define dso_local i32 @_Z3foob(i1 zeroext %0) { ; BBSECTIONS: bb.1 (%ir-block.7, bb_id 1) ; BBSECTIONS: bb.2 (%ir-block.8, bbsections 1, bb_id 2): -; BBADDRMAP: bb.0 (%ir-block.1, bb_id 0): -; BBADDRMAP: bb.1 (%ir-block.7, bb_id 1): -; BBADDRMAP: bb.2 (%ir-block.8, bb_id 2): -; BBADDRMAP: bb.3 (%ir-block.9, bb_id 3): +; BBLABELS: bb.0 (%ir-block.1, bb_id 0): +; BBLABELS: bb.1 (%ir-block.7, bb_id 1): +; BBLABELS: bb.2 (%ir-block.8, bb_id 2): +; BBLABELS: bb.3 (%ir-block.9, bb_id 3): |