-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[SHT_LLVM_BB_ADDR_MAP] Change the callsite feature to emit end of callsites. #155041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…lsites instead of the beginning.
@llvm/pr-subscribers-objectyaml @llvm/pr-subscribers-llvm-binary-utilities Author: Rahman Lavaee (rlavaee) ChangesThis PR simply moves the callsite anchors from the beginning of callsites to their end. Emitting the end of callsites is more sensible as it allows breaking the basic block into subblocks which end with control transfer instructions. Patch is 21.60 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/155041.diff 14 Files Affected:
diff --git a/llvm/docs/Extensions.rst b/llvm/docs/Extensions.rst
index d8fb87b6998ad..6b1d9fe08e911 100644
--- a/llvm/docs/Extensions.rst
+++ b/llvm/docs/Extensions.rst
@@ -410,8 +410,8 @@ two years old). Each function entry starts with a version byte which specifies
the encoding version to use. This is followed by a feature byte which specifies
the features specific to this particular entry. The function base address is
stored as a full address. Other addresses in the entry (block begin and end
-addresses and callsite addresses) are stored in a running-offset fashion, as
-offsets relative to prior addresses.
+addresses and callsite end addresses) are stored in a running-offset fashion,
+as offsets relative to prior addresses.
The following versioning schemes are currently supported (newer versions support
features of the older versions).
@@ -438,8 +438,8 @@ Example:
.byte 1 # BB_1 ID
.uleb128 .LBB0_1-.LBB_END0_0 # BB_1 offset relative to the end of last block (BB_0).
.byte 2 # number of callsites in this block
- .uleb128 .LBB0_1_CS0-.LBB0_1 # offset of callsite relative to the previous offset (.LBB0_1)
- .uleb128 .LBB0_1_CS1-.LBB0_1_CS0 # offset of callsite relative to the previous offset (.LBB0_1_CS0)
+ .uleb128 .LBB0_1_CS0-.LBB0_1 # offset of callsite end relative to the previous offset (.LBB0_1)
+ .uleb128 .LBB0_1_CS1-.LBB0_1_CS0 # offset of callsite end relative to the previous offset (.LBB0_1_CS0)
.uleb128 .LBB_END0_1-.LBB0_1_CS1 # BB_1 size offset (Offset of the block end relative to the previous offset).
.byte y # BB_1 metadata
diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 91c014236f6cb..71317619098ad 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -135,12 +135,12 @@ class LLVM_ABI AsmPrinter : public MachineFunctionPass {
/// default, this is equal to CurrentFnSym.
MCSymbol *CurrentFnSymForSize = nullptr;
- /// Vector of symbols marking the position of callsites in the current
+ /// Vector of symbols marking the end of the callsites in the current
/// function, keyed by their containing basic block.
/// The callsite symbols of each block are stored in the order they appear
/// in that block.
DenseMap<const MachineBasicBlock *, SmallVector<MCSymbol *, 1>>
- CurrentFnCallsiteSymbols;
+ CurrentFnCallsiteEndSymbols;
/// Provides the profile information for constants.
const StaticDataProfileInfo *SDPI = nullptr;
@@ -332,9 +332,9 @@ class LLVM_ABI AsmPrinter : public MachineFunctionPass {
/// to emit them as well, return the whole set.
ArrayRef<MCSymbol *> getAddrLabelSymbolToEmit(const BasicBlock *BB);
- /// Creates a new symbol to be used for the beginning of a callsite at the
- /// specified basic block.
- MCSymbol *createCallsiteSymbol(const MachineBasicBlock &MBB);
+ /// Creates a new symbol to be used for the end of a callsite at the specified
+ /// basic block.
+ MCSymbol *createCallsiteEndSymbol(const MachineBasicBlock &MBB);
/// If the specified function has had any references to address-taken blocks
/// generated, but the block got deleted, return the symbol now so we can
diff --git a/llvm/include/llvm/Object/ELFTypes.h b/llvm/include/llvm/Object/ELFTypes.h
index f22b376c3ab5b..5a26e2fc31458 100644
--- a/llvm/include/llvm/Object/ELFTypes.h
+++ b/llvm/include/llvm/Object/ELFTypes.h
@@ -832,7 +832,7 @@ struct BBAddrMap {
bool BrProb : 1;
bool MultiBBRange : 1;
bool OmitBBEntries : 1;
- bool CallsiteOffsets : 1;
+ bool CallsiteEndOffsets : 1;
bool hasPGOAnalysis() const { return FuncEntryCount || BBFreq || BrProb; }
@@ -845,7 +845,7 @@ struct BBAddrMap {
(static_cast<uint8_t>(BrProb) << 2) |
(static_cast<uint8_t>(MultiBBRange) << 3) |
(static_cast<uint8_t>(OmitBBEntries) << 4) |
- (static_cast<uint8_t>(CallsiteOffsets) << 5);
+ (static_cast<uint8_t>(CallsiteEndOffsets) << 5);
}
// Decodes from minimum bit width representation and validates no
@@ -864,10 +864,10 @@ struct BBAddrMap {
bool operator==(const Features &Other) const {
return std::tie(FuncEntryCount, BBFreq, BrProb, MultiBBRange,
- OmitBBEntries, CallsiteOffsets) ==
+ OmitBBEntries, CallsiteEndOffsets) ==
std::tie(Other.FuncEntryCount, Other.BBFreq, Other.BrProb,
Other.MultiBBRange, Other.OmitBBEntries,
- Other.CallsiteOffsets);
+ Other.CallsiteEndOffsets);
}
};
@@ -918,20 +918,19 @@ struct BBAddrMap {
uint32_t Size = 0; // Size of the basic block.
Metadata MD = {false, false, false, false,
false}; // Metdata for this basic block.
- // Offsets of callsites (beginning of call instructions), relative to the
- // basic block start.
- SmallVector<uint32_t, 1> CallsiteOffsets;
+ // Offsets of end of call instructions, relative to the basic block start.
+ SmallVector<uint32_t, 1> CallsiteEndOffsets;
BBEntry(uint32_t ID, uint32_t Offset, uint32_t Size, Metadata MD,
- SmallVector<uint32_t, 1> CallsiteOffsets)
+ SmallVector<uint32_t, 1> CallsiteEndOffsets)
: ID(ID), Offset(Offset), Size(Size), MD(MD),
- CallsiteOffsets(std::move(CallsiteOffsets)) {}
+ CallsiteEndOffsets(std::move(CallsiteEndOffsets)) {}
UniqueBBID getID() const { return {ID, 0}; }
bool operator==(const BBEntry &Other) const {
return ID == Other.ID && Offset == Other.Offset && Size == Other.Size &&
- MD == Other.MD && CallsiteOffsets == Other.CallsiteOffsets;
+ MD == Other.MD && CallsiteEndOffsets == Other.CallsiteEndOffsets;
}
bool hasReturn() const { return MD.HasReturn; }
diff --git a/llvm/include/llvm/ObjectYAML/ELFYAML.h b/llvm/include/llvm/ObjectYAML/ELFYAML.h
index 3bf8c29c99581..c90591d009dcd 100644
--- a/llvm/include/llvm/ObjectYAML/ELFYAML.h
+++ b/llvm/include/llvm/ObjectYAML/ELFYAML.h
@@ -162,7 +162,7 @@ struct BBAddrMapEntry {
llvm::yaml::Hex64 AddressOffset;
llvm::yaml::Hex64 Size;
llvm::yaml::Hex64 Metadata;
- std::optional<std::vector<llvm::yaml::Hex64>> CallsiteOffsets;
+ std::optional<std::vector<llvm::yaml::Hex64>> CallsiteEndOffsets;
};
uint8_t Version;
llvm::yaml::Hex8 Feature;
@@ -183,14 +183,14 @@ struct BBAddrMapEntry {
}
// Returns if any BB entries have non-empty callsite offsets.
- bool hasAnyCallsiteOffsets() const {
+ bool hasAnyCallsiteEndOffsets() const {
if (!BBRanges)
return false;
for (const ELFYAML::BBAddrMapEntry::BBRangeEntry &BBR : *BBRanges) {
if (!BBR.BBEntries)
continue;
for (const ELFYAML::BBAddrMapEntry::BBEntry &BBE : *BBR.BBEntries)
- if (BBE.CallsiteOffsets && !BBE.CallsiteOffsets->empty())
+ if (BBE.CallsiteEndOffsets && !BBE.CallsiteEndOffsets->empty())
return true;
}
return false;
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 23a3543e9ebec..cd14a4f57f760 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) {
MCSection *BBAddrMapSection =
getObjFileLowering().getBBAddrMapSection(*MF.getSection());
assert(BBAddrMapSection && ".llvm_bb_addr_map section is not initialized.");
- bool HasCalls = !CurrentFnCallsiteSymbols.empty();
+ bool HasCalls = !CurrentFnCallsiteEndSymbols.empty();
const MCSymbol *FunctionSymbol = getFunctionBegin();
@@ -1497,13 +1497,13 @@ void AsmPrinter::emitBBAddrMapSection(const MachineFunction &MF) {
emitLabelDifferenceAsULEB128(MBBSymbol, PrevMBBEndSymbol);
const MCSymbol *CurrentLabel = MBBSymbol;
if (HasCalls) {
- auto CallsiteSymbols = CurrentFnCallsiteSymbols.lookup(&MBB);
+ auto CallsiteEndSymbols = CurrentFnCallsiteEndSymbols.lookup(&MBB);
OutStreamer->AddComment("number of callsites");
- OutStreamer->emitULEB128IntValue(CallsiteSymbols.size());
- for (const MCSymbol *CallsiteSymbol : CallsiteSymbols) {
+ OutStreamer->emitULEB128IntValue(CallsiteEndSymbols.size());
+ for (const MCSymbol *CallsiteEndSymbol : CallsiteEndSymbols) {
// Emit the callsite offset.
- emitLabelDifferenceAsULEB128(CallsiteSymbol, CurrentLabel);
- CurrentLabel = CallsiteSymbol;
+ emitLabelDifferenceAsULEB128(CallsiteEndSymbol, CurrentLabel);
+ CurrentLabel = CallsiteEndSymbol;
}
}
// Emit the offset to the end of the block, which can be used to compute
@@ -1941,8 +1941,6 @@ void AsmPrinter::emitFunctionBody() {
!MI.isDebugInstr()) {
HasAnyRealCode = true;
}
- if (MI.isCall() && MF->getTarget().Options.BBAddrMap)
- OutStreamer->emitLabel(createCallsiteSymbol(MBB));
// If there is a pre-instruction symbol, emit a label for it here.
if (MCSymbol *S = MI.getPreInstrSymbol())
@@ -2064,6 +2062,9 @@ void AsmPrinter::emitFunctionBody() {
break;
}
+ if (MI.isCall() && MF->getTarget().Options.BBAddrMap)
+ OutStreamer->emitLabel(createCallsiteEndSymbol(MBB));
+
if (TM.Options.EmitCallGraphSection && MI.isCall())
emitIndirectCalleeLabels(FuncInfo, CallSitesInfoMap, MI);
@@ -2897,11 +2898,11 @@ MCSymbol *AsmPrinter::getMBBExceptionSym(const MachineBasicBlock &MBB) {
return Res.first->second;
}
-MCSymbol *AsmPrinter::createCallsiteSymbol(const MachineBasicBlock &MBB) {
+MCSymbol *AsmPrinter::createCallsiteEndSymbol(const MachineBasicBlock &MBB) {
MCContext &Ctx = MF->getContext();
MCSymbol *Sym = Ctx.createTempSymbol("BB" + Twine(MF->getFunctionNumber()) +
"_" + Twine(MBB.getNumber()) + "_CS");
- CurrentFnCallsiteSymbols[&MBB].push_back(Sym);
+ CurrentFnCallsiteEndSymbols[&MBB].push_back(Sym);
return Sym;
}
@@ -2939,7 +2940,7 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
CurrentFnBegin = nullptr;
CurrentFnBeginLocal = nullptr;
CurrentSectionBeginSym = nullptr;
- CurrentFnCallsiteSymbols.clear();
+ CurrentFnCallsiteEndSymbols.clear();
MBBSectionRanges.clear();
MBBSectionExceptionSyms.clear();
bool NeedsLocalForSize = MAI->needsLocalForSize();
diff --git a/llvm/lib/Object/ELF.cpp b/llvm/lib/Object/ELF.cpp
index 788c6020a7f99..53699ce0d4fcf 100644
--- a/llvm/lib/Object/ELF.cpp
+++ b/llvm/lib/Object/ELF.cpp
@@ -847,7 +847,7 @@ decodeBBAddrMapImpl(const ELFFile<ELFT> &EF,
if (!FeatEnableOrErr)
return FeatEnableOrErr.takeError();
FeatEnable = *FeatEnableOrErr;
- if (FeatEnable.CallsiteOffsets && Version < 3)
+ if (FeatEnable.CallsiteEndOffsets && Version < 3)
return createError("version should be >= 3 for SHT_LLVM_BB_ADDR_MAP when "
"callsite offsets feature is enabled: version = " +
Twine(static_cast<int>(Version)) +
@@ -890,22 +890,22 @@ decodeBBAddrMapImpl(const ELFFile<ELFT> &EF,
uint32_t ID = readULEB128As<uint32_t>(Data, Cur, ULEBSizeErr);
uint32_t Offset = readULEB128As<uint32_t>(Data, Cur, ULEBSizeErr);
// Read the callsite offsets.
- uint32_t LastCallsiteOffset = 0;
- SmallVector<uint32_t, 1> CallsiteOffsets;
- if (FeatEnable.CallsiteOffsets) {
+ uint32_t LastCallsiteEndOffset = 0;
+ SmallVector<uint32_t, 1> CallsiteEndOffsets;
+ if (FeatEnable.CallsiteEndOffsets) {
uint32_t NumCallsites =
readULEB128As<uint32_t>(Data, Cur, ULEBSizeErr);
- CallsiteOffsets.reserve(NumCallsites);
+ CallsiteEndOffsets.reserve(NumCallsites);
for (uint32_t CallsiteIndex = 0;
!ULEBSizeErr && Cur && (CallsiteIndex < NumCallsites);
++CallsiteIndex) {
- LastCallsiteOffset +=
+ LastCallsiteEndOffset +=
readULEB128As<uint32_t>(Data, Cur, ULEBSizeErr);
- CallsiteOffsets.push_back(LastCallsiteOffset);
+ CallsiteEndOffsets.push_back(LastCallsiteEndOffset);
}
}
uint32_t Size = readULEB128As<uint32_t>(Data, Cur, ULEBSizeErr) +
- LastCallsiteOffset;
+ LastCallsiteEndOffset;
uint32_t MD = readULEB128As<uint32_t>(Data, Cur, ULEBSizeErr);
Expected<BBAddrMap::BBEntry::Metadata> MetadataOrErr =
BBAddrMap::BBEntry::Metadata::decode(MD);
@@ -914,7 +914,7 @@ decodeBBAddrMapImpl(const ELFFile<ELFT> &EF,
break;
}
BBEntries.push_back({ID, Offset + PrevBBEndOffset, Size,
- *MetadataOrErr, CallsiteOffsets});
+ *MetadataOrErr, CallsiteEndOffsets});
PrevBBEndOffset += Offset + Size;
}
TotalNumBlocks += BBEntries.size();
diff --git a/llvm/lib/ObjectYAML/ELFEmitter.cpp b/llvm/lib/ObjectYAML/ELFEmitter.cpp
index bc5c68d08d11f..2386a2e3e6c49 100644
--- a/llvm/lib/ObjectYAML/ELFEmitter.cpp
+++ b/llvm/lib/ObjectYAML/ELFEmitter.cpp
@@ -1487,8 +1487,8 @@ void ELFState<ELFT>::writeSectionContent(
if (!E.BBRanges)
continue;
uint64_t TotalNumBlocks = 0;
- bool EmitCallsiteOffsets =
- FeatureOrErr->CallsiteOffsets || E.hasAnyCallsiteOffsets();
+ bool EmitCallsiteEndOffsets =
+ FeatureOrErr->CallsiteEndOffsets || E.hasAnyCallsiteEndOffsets();
for (const ELFYAML::BBAddrMapEntry::BBRangeEntry &BBR : *E.BBRanges) {
// Write the base address of the range.
CBA.write<uintX_t>(BBR.BaseAddress, ELFT::Endianness);
@@ -1506,12 +1506,12 @@ void ELFState<ELFT>::writeSectionContent(
if (Section.Type == llvm::ELF::SHT_LLVM_BB_ADDR_MAP && E.Version > 1)
SHeader.sh_size += CBA.writeULEB128(BBE.ID);
SHeader.sh_size += CBA.writeULEB128(BBE.AddressOffset);
- if (EmitCallsiteOffsets) {
- size_t NumCallsiteOffsets =
- BBE.CallsiteOffsets ? BBE.CallsiteOffsets->size() : 0;
- SHeader.sh_size += CBA.writeULEB128(NumCallsiteOffsets);
- if (BBE.CallsiteOffsets) {
- for (uint32_t Offset : *BBE.CallsiteOffsets)
+ if (EmitCallsiteEndOffsets) {
+ size_t NumCallsiteEndOffsets =
+ BBE.CallsiteEndOffsets ? BBE.CallsiteEndOffsets->size() : 0;
+ SHeader.sh_size += CBA.writeULEB128(NumCallsiteEndOffsets);
+ if (BBE.CallsiteEndOffsets) {
+ for (uint32_t Offset : *BBE.CallsiteEndOffsets)
SHeader.sh_size += CBA.writeULEB128(Offset);
}
}
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index c27339de67efd..62d80a24f4787 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -1884,7 +1884,7 @@ void MappingTraits<ELFYAML::BBAddrMapEntry::BBEntry>::mapping(
IO.mapRequired("AddressOffset", E.AddressOffset);
IO.mapRequired("Size", E.Size);
IO.mapRequired("Metadata", E.Metadata);
- IO.mapOptional("CallsiteOffsets", E.CallsiteOffsets);
+ IO.mapOptional("CallsiteEndOffsets", E.CallsiteEndOffsets);
}
void MappingTraits<ELFYAML::PGOAnalysisMapEntry>::mapping(
diff --git a/llvm/test/tools/llvm-readobj/ELF/bb-addr-map.test b/llvm/test/tools/llvm-readobj/ELF/bb-addr-map.test
index 5d7bc8baa9b25..fd1492fa091a8 100644
--- a/llvm/test/tools/llvm-readobj/ELF/bb-addr-map.test
+++ b/llvm/test/tools/llvm-readobj/ELF/bb-addr-map.test
@@ -49,7 +49,7 @@
# CHECK-NEXT: {
# CHECK-NEXT: ID: 2
# CHECK-NEXT: Offset: 0x3
-# CHECK-NEXT: Callsite Offsets: [1, 3]
+# CHECK-NEXT: Callsite End Offsets: [1, 3]
# CHECK-NEXT: Size: 0x7
# CHECK-NEXT: HasReturn: Yes
# CHECK-NEXT: HasTailCall: No
@@ -159,7 +159,7 @@ Sections:
AddressOffset: 0x3
Size: 0x4
Metadata: 0x15
- CallsiteOffsets: [ 0x1 , 0x2 ]
+ CallsiteEndOffsets: [ 0x1 , 0x2 ]
- Version: 2
BBRanges:
- BaseAddress: 0x22222
diff --git a/llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml b/llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml
index 861cb94692947..dc14025689b60 100644
--- a/llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml
+++ b/llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml
@@ -39,7 +39,7 @@
# VALID-NEXT: AddressOffset: 0xA
# VALID-NEXT: Size: 0xB
# VALID-NEXT: Metadata: 0xC
-# VALID-NEXT: CallsiteOffsets: [ 0x1, 0x2 ]
+# VALID-NEXT: CallsiteEndOffsets: [ 0x1, 0x2 ]
--- !ELF
FileHeader:
@@ -79,7 +79,7 @@ Sections:
AddressOffset: 0xA
Size: 0xB
Metadata: 0xC
- CallsiteOffsets: [ 0x1, 0x2 ]
+ CallsiteEndOffsets: [ 0x1, 0x2 ]
## Check obj2yaml can dump empty .llvm_bb_addr_map sections.
diff --git a/llvm/test/tools/yaml2obj/ELF/bb-addr-map.yaml b/llvm/test/tools/yaml2obj/ELF/bb-addr-map.yaml
index 9fd0577b1e0fd..418f90ff8bafe 100644
--- a/llvm/test/tools/yaml2obj/ELF/bb-addr-map.yaml
+++ b/llvm/test/tools/yaml2obj/ELF/bb-addr-map.yaml
@@ -66,7 +66,7 @@
# CHECK-NEXT: 0000: 030800
# CHECK-NEXT: )
-# Case 9: Specify empty CallsiteOffsets.
+# Case 9: Specify empty CallsiteEndOffsets.
# CHECK: Name: .llvm_bb_addr_map (1)
# CHECK: SectionData (
# CHECK-NEXT: 0000: 03202000 00000000 0000010E 01000203
@@ -113,7 +113,7 @@ Sections:
AddressOffset: 0x00000001
Size: 0x00000002
Metadata: 0x00000003
- CallsiteOffsets: [0x1, 0x2]
+ CallsiteEndOffsets: [0x1, 0x2]
## 5) When specifying the description with Entries, the 'Address' field will be
## zero when omitted.
@@ -174,7 +174,7 @@ Sections:
AddressOffset: 0x00000001
Size: 0x00000002
Metadata: 0x00000003
- CallsiteOffsets: []
+ CallsiteEndOffsets: []
## Check we can't use Entries at the same time as either Content or Size.
# RUN: not yaml2obj --docnum=2 -DCONTENT="00" %s 2>&1 | FileCheck %s --check-prefix=INVALID
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index ade025fd3d892..a440bad130f4c 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -8106,8 +8106,8 @@ void LLVMELFDumper<ELFT>::printBBAddrMaps(bool PrettyPGOAnalysis) {
DictScope BBED(W);
W.printNumber("ID", BBE.ID);
W.printHex("Offset", BBE.Offset);
- if (!BBE.CallsiteOffsets.empty())
- W.printList("Callsite Offsets", BBE.CallsiteOffsets);
+ if (!BBE.CallsiteEndOffsets.empty())
+ W.printList("Callsite End Offsets", BBE.CallsiteEndOffsets);
W.printHex("Size", BBE.Size);
W.printBoolean("HasReturn", BBE.hasReturn());
W.printBoolean("HasTailCall", BBE.hasTailCall());
diff --git a/llvm/tools/obj2yaml/elf2yaml.cpp b/llvm/tools/obj2yaml/elf2yaml.cpp
index ab15553df1e84..ef4552f734736 100644
--- a/llvm/tools/obj2yaml/elf2yaml.cpp
+++ b/llvm/tools/obj2yaml/elf2yaml.cpp
@@ -935,19 +935,19 @@ ELFDumper<ELFT>::dumpBBAddrMapSection(const Elf_Shdr *Shdr) {
++BlockIndex) {
uint32_t ID = Version >= 2 ? Data.getULEB128(Cur) : BlockIndex;
uint64_t Offset = Data.getULEB128(Cur);
- std::optional<std::vector<llvm::yaml::Hex64>> CallsiteOffsets;
- if (FeatureOrErr->CallsiteOffsets) {
+ std::optional<std::vector<llvm::yaml::Hex64>> CallsiteEndOffsets;
+ if (FeatureOrErr->CallsiteEndOffsets) {
uint32_t NumCallsites = Data.getULEB128(Cur);
- CallsiteOffsets = std::vector<llvm::yaml::Hex64>(NumCallsites, 0);
+ ...
[truncated]
|
This PR simply moves the callsite anchors from the beginning of callsites to their end.
Emitting the end of callsites is more sensible as it allows breaking the basic block into subblocks which end with control transfer instructions.