[clang] 639a0af - Revert "Deprecate the `-fbasic-block-sections=labels` option. (#107494)"
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 25 12:34:50 PDT 2024
Author: Kazu Hirata
Date: 2024-09-25T12:34:43-07:00
New Revision: 639a0afa9955a8613902e46e168767bc05c46cdd
URL: https://github.com/llvm/llvm-project/commit/639a0afa9955a8613902e46e168767bc05c46cdd
DIFF: https://github.com/llvm/llvm-project/commit/639a0afa9955a8613902e46e168767bc05c46cdd.diff
LOG: 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
Added:
llvm/test/CodeGen/X86/basic-block-labels-mir-parse.mir
llvm/test/CodeGen/X86/basic-block-sections-labels-empty-block.ll
llvm/test/CodeGen/X86/basic-block-sections-labels-empty-function.ll
llvm/test/CodeGen/X86/basic-block-sections-labels-pgo-features.ll
Modified:
clang/docs/UsersManual.rst
clang/include/clang/Basic/CodeGenOptions.h
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/fbasic-block-sections.c
llvm/docs/CommandGuide/llvm-objdump.rst
llvm/docs/Extensions.rst
llvm/include/llvm/CodeGen/MachineFunction.h
llvm/include/llvm/Target/TargetOptions.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/BasicBlockSections.cpp
llvm/lib/CodeGen/CommandFlags.cpp
llvm/lib/CodeGen/MIRParser/MIParser.cpp
llvm/lib/CodeGen/MIRParser/MIRParser.cpp
llvm/lib/CodeGen/MachineFunction.cpp
llvm/test/CodeGen/X86/basic-block-address-map-function-sections.ll
llvm/test/CodeGen/X86/basic-block-address-map.ll
llvm/test/CodeGen/X86/basic-block-sections-mir-print.ll
Removed:
llvm/test/CodeGen/X86/basic-block-address-map-empty-block.ll
llvm/test/CodeGen/X86/basic-block-address-map-empty-function.ll
llvm/test/CodeGen/X86/basic-block-address-map-mir-parse.mir
llvm/test/CodeGen/X86/basic-block-address-map-pgo-features.ll
################################################################################
diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index 4f03388bc87bd0..57d78f867bab6e 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 814d4d4c99e575..f2a707a8ba8d76 100644
--- a/clang/include/clang/Basic/CodeGenOptions.h
+++ b/clang/include/clang/Basic/CodeGenOptions.h
@@ -107,13 +107,18 @@ class CodeGenOptions : public CodeGenOptionsBase {
// 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 c22b07e9f8a6cb..23bd686a85f526 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 62c6a57e8b7c80..916c92adb89309 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 9525f3739e2214..0bab48caf1a5e2 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 6dfba5f404cee9..e13cc81e910be3 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 ab9f583e96ec64..7f8def756c6960 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 ea267842cdc353..abc34bc3202c09 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 997960fcd5d094..5c1da4fa762e84 100644
--- a/llvm/include/llvm/CodeGen/MachineFunction.h
+++ b/llvm/include/llvm/CodeGen/MachineFunction.h
@@ -699,6 +699,11 @@ class LLVM_ABI MachineFunction {
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 88f253805ca99c..94e0fa2404d6fc 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 317278911b28f6..d17800d375b7f2 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 1eedfc4b259126..0071284c862099 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 d180cfcea658c2..9e42deb94903de 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 a0f0e27478d022..27f0a9331a3e3e 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 997c428ca77dc4..be07fbf478b1d8 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 b56888a0f71fe6..ab45663436cedc 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 9ff96381c2053f..d7678604cffa2c 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 4f12258eeeea00..6ab24b494936ab 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
similarity index 97%
rename from llvm/test/CodeGen/X86/basic-block-address-map-mir-parse.mir
rename to llvm/test/CodeGen/X86/basic-block-labels-mir-parse.mir
index 86f5f27494ec40..6408f0a30af7e5 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", at 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
similarity index 83%
rename from llvm/test/CodeGen/X86/basic-block-address-map-empty-block.ll
rename to llvm/test/CodeGen/X86/basic-block-sections-labels-empty-block.ll
index 84948b7ecf6e0c..8e0f4fa7bc928e 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
similarity index 68%
rename from llvm/test/CodeGen/X86/basic-block-address-map-empty-function.ll
rename to llvm/test/CodeGen/X86/basic-block-sections-labels-empty-function.ll
index 444655fc5299f7..42d09212e66916 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
similarity index 88%
rename from llvm/test/CodeGen/X86/basic-block-address-map-pgo-features.ll
rename to llvm/test/CodeGen/X86/basic-block-sections-labels-pgo-features.ll
index 73fe4f6ffedb0e..92d3c88b4f6013 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 fec87656be195f..1767903561ce1c 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):
More information about the cfe-commits
mailing list