Skip to content

Commit 9c0ea35

Browse files
committed
[SHT_LLVM_BB_ADDR_MAP] Emit callsite offsets in the section.
1 parent 6b623a6 commit 9c0ea35

11 files changed

+139
-59
lines changed

llvm/include/llvm/CodeGen/AsmPrinter.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ class LLVM_ABI AsmPrinter : public MachineFunctionPass {
173173
// function. This is used to calculate the size of the BB section.
174174
MCSymbol *CurrentSectionBeginSym = nullptr;
175175

176+
bool HasAnyCallsitesForBBAddrMap = false;
177+
176178
/// This map keeps track of which symbol is being used for the specified basic
177179
/// block's address of label.
178180
std::unique_ptr<AddrLabelMap> AddrLabelSymbols;
@@ -426,7 +428,7 @@ class LLVM_ABI AsmPrinter : public MachineFunctionPass {
426428

427429
void emitStackUsage(const MachineFunction &MF);
428430

429-
void emitBBAddrMapSection(const MachineFunction &MF);
431+
void emitBBAddrMapSection(const MachineFunction &MF, bool HasCalls);
430432

431433
void emitKCFITrapEntry(const MachineFunction &MF, const MCSymbol *Symbol);
432434
virtual void emitKCFITypeId(const MachineFunction &MF);

llvm/include/llvm/CodeGen/MachineBasicBlock.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ class MachineBasicBlock
242242
/// calculate the size of the basic block, or the BB section ending with it.
243243
mutable MCSymbol *CachedEndMCSymbol = nullptr;
244244

245+
/// Vector of symbols marking the position of callsites in the basic
246+
/// block, stored in the order they appear in the basic block.
247+
mutable SmallVector<MCSymbol *, 1> CallsiteSymbols;
248+
245249
// Intrusive list support
246250
MachineBasicBlock() = default;
247251

@@ -325,6 +329,12 @@ class MachineBasicBlock
325329
/// its label be emitted.
326330
void setLabelMustBeEmitted() { LabelMustBeEmitted = true; }
327331

332+
/// Returns the symbols marking callsites in the order they appear in the
333+
/// basic block.
334+
const SmallVectorImpl<MCSymbol *> &getCallsiteSymbols() const {
335+
return CallsiteSymbols;
336+
}
337+
328338
/// Return the MachineFunction containing this basic block.
329339
const MachineFunction *getParent() const { return xParent; }
330340
MachineFunction *getParent() { return xParent; }
@@ -725,6 +735,9 @@ class MachineBasicBlock
725735
/// Returns the MCSymbol marking the end of this basic block.
726736
LLVM_ABI MCSymbol *getEndSymbol() const;
727737

738+
/// Returns a temporary MCSymbol marking the beginning of a callsite.
739+
LLVM_ABI MCSymbol *createCallsiteSymbol() const;
740+
728741
/// Returns true if this block may have an INLINEASM_BR (overestimate, by
729742
/// checking if any of the successors are indirect targets of any inlineasm_br
730743
/// in the function).

llvm/include/llvm/MC/MCContext.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ class MCContext {
175175
/// for the LocalLabelVal and adds it to the map if needed.
176176
unsigned GetInstance(unsigned LocalLabelVal);
177177

178-
/// LLVM_BB_ADDR_MAP version to emit.
179-
uint8_t BBAddrMapVersion = 2;
178+
/// SHT_LLVM_BB_ADDR_MAP version to emit.
179+
uint8_t BBAddrMapVersion = 3;
180180

181181
/// The file name of the log file from the environment variable
182182
/// AS_SECURE_LOG_FILE. Which must be set before the .secure_log_unique

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,8 @@ static uint32_t getBBAddrMapMetadata(const MachineBasicBlock &MBB) {
13911391
}
13921392

13931393
static llvm::object::BBAddrMap::Features
1394-
getBBAddrMapFeature(const MachineFunction &MF, int NumMBBSectionRanges) {
1394+
getBBAddrMapFeature(const MachineFunction &MF, int NumMBBSectionRanges,
1395+
bool HasCalls) {
13951396
// Ensure that the user has not passed in additional options while also
13961397
// specifying all or none.
13971398
if ((PgoAnalysisMapFeatures.isSet(PGOMapFeaturesEnum::None) ||
@@ -1424,10 +1425,11 @@ getBBAddrMapFeature(const MachineFunction &MF, int NumMBBSectionRanges) {
14241425
BrProbEnabled,
14251426
MF.hasBBSections() && NumMBBSectionRanges > 1,
14261427
static_cast<bool>(BBAddrMapSkipEmitBBEntries),
1427-
false};
1428+
HasCalls};
14281429
}
14291430

1430-
void AsmPrinter::emitBBAddrMapSection(const MachineFunction &MF) {
1431+
void AsmPrinter::emitBBAddrMapSection(const MachineFunction &MF,
1432+
bool HasCalls) {
14311433
MCSection *BBAddrMapSection =
14321434
getObjFileLowering().getBBAddrMapSection(*MF.getSection());
14331435
assert(BBAddrMapSection && ".llvm_bb_addr_map section is not initialized.");
@@ -1440,7 +1442,7 @@ void AsmPrinter::emitBBAddrMapSection(const MachineFunction &MF) {
14401442
uint8_t BBAddrMapVersion = OutStreamer->getContext().getBBAddrMapVersion();
14411443
OutStreamer->emitInt8(BBAddrMapVersion);
14421444
OutStreamer->AddComment("feature");
1443-
auto Features = getBBAddrMapFeature(MF, MBBSectionRanges.size());
1445+
auto Features = getBBAddrMapFeature(MF, MBBSectionRanges.size(), HasCalls);
14441446
OutStreamer->emitInt8(Features.encode());
14451447
// Emit BB Information for each basic block in the function.
14461448
if (Features.MultiBBRange) {
@@ -1493,13 +1495,24 @@ void AsmPrinter::emitBBAddrMapSection(const MachineFunction &MF) {
14931495
// Emit the basic block offset relative to the end of the previous block.
14941496
// This is zero unless the block is padded due to alignment.
14951497
emitLabelDifferenceAsULEB128(MBBSymbol, PrevMBBEndSymbol);
1496-
// Emit the basic block size. When BBs have alignments, their size cannot
1497-
// always be computed from their offsets.
1498-
emitLabelDifferenceAsULEB128(MBB.getEndSymbol(), MBBSymbol);
1498+
const MCSymbol *CurrentLabel = MBBSymbol;
1499+
if (HasCalls) {
1500+
const SmallVectorImpl<MCSymbol *> &CallsiteSymbols =
1501+
MBB.getCallsiteSymbols();
1502+
OutStreamer->AddComment("number of callsites");
1503+
OutStreamer->emitULEB128IntValue(CallsiteSymbols.size());
1504+
for (const MCSymbol *CallsiteSymbol : CallsiteSymbols) {
1505+
// Emit the callsite offset.
1506+
emitLabelDifferenceAsULEB128(CallsiteSymbol, CurrentLabel);
1507+
CurrentLabel = CallsiteSymbol;
1508+
}
1509+
}
1510+
// Emit the offset to the end of the block, which can be used to compute
1511+
// the total block size.
1512+
emitLabelDifferenceAsULEB128(MBB.getEndSymbol(), CurrentLabel);
14991513
// Emit the Metadata.
15001514
OutStreamer->emitULEB128IntValue(getBBAddrMapMetadata(MBB));
15011515
}
1502-
15031516
PrevMBBEndSymbol = MBB.getEndSymbol();
15041517
}
15051518

@@ -1802,6 +1815,7 @@ void AsmPrinter::emitFunctionBody() {
18021815

18031816
// Print out code for the function.
18041817
bool HasAnyRealCode = false;
1818+
bool HasCalls = false;
18051819
int NumInstsInFunction = 0;
18061820
bool IsEHa = MMI->getModule()->getModuleFlag("eh-asynch");
18071821

@@ -1828,6 +1842,11 @@ void AsmPrinter::emitFunctionBody() {
18281842
!MI.isDebugInstr()) {
18291843
HasAnyRealCode = true;
18301844
}
1845+
if (MI.isCall()) {
1846+
HasCalls = true;
1847+
if (MF->getTarget().Options.BBAddrMap)
1848+
OutStreamer->emitLabel(MBB.createCallsiteSymbol());
1849+
}
18311850

18321851
// If there is a pre-instruction symbol, emit a label for it here.
18331852
if (MCSymbol *S = MI.getPreInstrSymbol())
@@ -2114,7 +2133,7 @@ void AsmPrinter::emitFunctionBody() {
21142133
// BB labels are requested for this function. Skip empty functions.
21152134
if (HasAnyRealCode) {
21162135
if (MF->getTarget().Options.BBAddrMap)
2117-
emitBBAddrMapSection(*MF);
2136+
emitBBAddrMapSection(*MF, HasCalls);
21182137
else if (PgoAnalysisMapFeatures.getBits() != 0)
21192138
MF->getContext().reportWarning(
21202139
SMLoc(), "pgo-analysis-map is enabled for function " + MF->getName() +

llvm/lib/CodeGen/MachineBasicBlock.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ MCSymbol *MachineBasicBlock::getEndSymbol() const {
112112
return CachedEndMCSymbol;
113113
}
114114

115+
MCSymbol *MachineBasicBlock::createCallsiteSymbol() const {
116+
const MachineFunction *MF = getParent();
117+
MCContext &Ctx = MF->getContext();
118+
CallsiteSymbols.push_back(
119+
Ctx.createTempSymbol("BB" + Twine(MF->getFunctionNumber()) + "_" +
120+
Twine(getNumber()) + "_CS"));
121+
return CallsiteSymbols.back();
122+
}
123+
115124
raw_ostream &llvm::operator<<(raw_ostream &OS, const MachineBasicBlock &MBB) {
116125
MBB.print(OS);
117126
return OS;

llvm/test/CodeGen/X86/basic-block-address-map-empty-function.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ entry:
1919
; CHECK: func:
2020
; CHECK: .Lfunc_begin1:
2121
; CHECK: .section .llvm_bb_addr_map,"o",@llvm_bb_addr_map,.text{{$}}
22-
; CHECK-NEXT: .byte 2 # version
22+
; CHECK-NEXT: .byte 3 # version
2323
; BASIC-NEXT: .byte 0 # feature
2424
; PGO-NEXT: .byte 3 # feature
2525
; CHECK-NEXT: .quad .Lfunc_begin1 # function address

llvm/test/CodeGen/X86/basic-block-address-map-function-sections.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ define dso_local i32 @_Z3barv() {
1010
; CHECK-LABEL: _Z3barv:
1111
; CHECK-NEXT: [[BAR_BEGIN:.Lfunc_begin[0-9]+]]:
1212
; CHECK: .section .llvm_bb_addr_map,"o",@llvm_bb_addr_map,.text._Z3barv{{$}}
13-
; CHECK-NEXT: .byte 2 # version
13+
; CHECK-NEXT: .byte 3 # version
1414
; CHECK-NEXT: .byte 0 # feature
1515
; CHECK-NEXT: .quad [[BAR_BEGIN]] # function address
1616

@@ -23,8 +23,8 @@ define dso_local i32 @_Z3foov() {
2323
; CHECK-LABEL: _Z3foov:
2424
; CHECK-NEXT: [[FOO_BEGIN:.Lfunc_begin[0-9]+]]:
2525
; CHECK: .section .llvm_bb_addr_map,"o",@llvm_bb_addr_map,.text._Z3foov{{$}}
26-
; CHECK-NEXT: .byte 2 # version
27-
; CHECK-NEXT: .byte 0 # feature
26+
; CHECK-NEXT: .byte 3 # version
27+
; CHECK-NEXT: .byte 32 # feature
2828
; CHECK-NEXT: .quad [[FOO_BEGIN]] # function address
2929

3030

@@ -36,6 +36,6 @@ define linkonce_odr dso_local i32 @_Z4fooTIiET_v() comdat {
3636
; CHECK-LABEL: _Z4fooTIiET_v:
3737
; CHECK-NEXT: [[FOOCOMDAT_BEGIN:.Lfunc_begin[0-9]+]]:
3838
; CHECK: .section .llvm_bb_addr_map,"oG",@llvm_bb_addr_map,.text._Z4fooTIiET_v,_Z4fooTIiET_v,comdat{{$}}
39-
; CHECK-NEXT: .byte 2 # version
39+
; CHECK-NEXT: .byte 3 # version
4040
; CHECK-NEXT: .byte 0 # feature
4141
; CHECK-NEXT: .quad [[FOOCOMDAT_BEGIN]] # function address

llvm/test/CodeGen/X86/basic-block-address-map-pgo-features.ll

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,36 +69,44 @@ declare i32 @__gxx_personality_v0(...)
6969
; CHECK-LABEL: .Lfunc_end0:
7070

7171
; CHECK: .section .llvm_bb_addr_map,"o",@llvm_bb_addr_map,.text._Z3bazb{{$}}
72-
; CHECK-NEXT: .byte 2 # version
73-
; BASIC-NEXT: .byte 0 # feature
74-
; PGO-ALL-NEXT: .byte 7 # feature
75-
; FEC-ONLY-NEXT:.byte 1 # feature
76-
; BBF-ONLY-NEXT:.byte 2 # feature
77-
; BRP-ONLY-NEXT:.byte 4 # feature
72+
; CHECK-NEXT: .byte 3 # version
73+
; BASIC-NEXT: .byte 32 # feature
74+
; PGO-ALL-NEXT: .byte 39 # feature
75+
; FEC-ONLY-NEXT:.byte 33 # feature
76+
; BBF-ONLY-NEXT:.byte 34 # feature
77+
; BRP-ONLY-NEXT:.byte 36 # feature
7878
; CHECK-NEXT: .quad .Lfunc_begin0 # function address
7979
; CHECK-NEXT: .byte 6 # number of basic blocks
8080
; CHECK-NEXT: .byte 0 # BB id
8181
; CHECK-NEXT: .uleb128 .Lfunc_begin0-.Lfunc_begin0
82+
; CHECK-NEXT: .byte 0 # number of callsites
8283
; CHECK-NEXT: .uleb128 .LBB_END0_0-.Lfunc_begin0
8384
; CHECK-NEXT: .byte 8
8485
; CHECK-NEXT: .byte 1 # BB id
8586
; CHECK-NEXT: .uleb128 .LBB0_1-.LBB_END0_0
86-
; CHECK-NEXT: .uleb128 .LBB_END0_1-.LBB0_1
87+
; CHECK-NEXT: .byte 1 # number of callsites
88+
; CHECK-NEXT: .uleb128 .LBB0_1_CS0-.LBB0_1
89+
; CHECK-NEXT: .uleb128 .LBB_END0_1-.LBB0_1_CS0
8790
; CHECK-NEXT: .byte 8
8891
; CHECK-NEXT: .byte 3 # BB id
8992
; CHECK-NEXT: .uleb128 .LBB0_2-.LBB_END0_1
90-
; CHECK-NEXT: .uleb128 .LBB_END0_2-.LBB0_2
93+
; CHECK-NEXT: .byte 1 # number of callsites
94+
; CHECK-NEXT: .uleb128 .LBB0_2_CS0-.LBB0_2
95+
; CHECK-NEXT: .uleb128 .LBB_END0_2-.LBB0_2_CS0
9196
; CHECK-NEXT: .byte 8
9297
; CHECK-NEXT: .byte 5 # BB id
9398
; CHECK-NEXT: .uleb128 .LBB0_3-.LBB_END0_2
99+
; CHECK-NEXT: .byte 0 # number of callsites
94100
; CHECK-NEXT: .uleb128 .LBB_END0_3-.LBB0_3
95101
; CHECK-NEXT: .byte 1
96102
; CHECK-NEXT: .byte 4 # BB id
97103
; CHECK-NEXT: .uleb128 .LBB0_4-.LBB_END0_3
104+
; CHECK-NEXT: .byte 0 # number of callsites
98105
; CHECK-NEXT: .uleb128 .LBB_END0_4-.LBB0_4
99106
; CHECK-NEXT: .byte 16
100107
; CHECK-NEXT: .byte 2 # BB id
101108
; CHECK-NEXT: .uleb128 .LBB0_5-.LBB_END0_4
109+
; CHECK-NEXT: .byte 0 # number of callsites
102110
; CHECK-NEXT: .uleb128 .LBB_END0_5-.LBB0_5
103111
; CHECK-NEXT: .byte 4
104112

@@ -138,7 +146,7 @@ declare i32 @__gxx_personality_v0(...)
138146
; PGO-BRP-NEXT: .byte 5 # successor BB ID
139147
; PGO-BRP-NEXT: .ascii "\200\200\200\200\b" # successor branch probability
140148

141-
; SKIP-BB-ENTRIES: .byte 17 # feature
149+
; SKIP-BB-ENTRIES: .byte 49 # feature
142150
; SKIP-BB-ENTRIES-NEXT: .quad .Lfunc_begin0 # function address
143151
; SKIP-BB-ENTRIES-NEXT: .byte 6 # number of basic blocks
144152
; SKIP-BB-ENTRIES-NEXT: .byte 100 # function entry count

llvm/test/CodeGen/X86/basic-block-address-map-with-basic-block-sections.ll

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,33 +39,41 @@ declare i32 @__gxx_personality_v0(...)
3939
; CHECK-LABEL: .LBB_END0_1:
4040
; CHECK: .section .text.split._Z3bazb,"ax",@progbits
4141
; CHECK-LABEL: _Z3bazb.cold:
42+
; CHECK-LABEL: .LBB0_2_CS0:
4243
; CHECK-LABEL: .LBB_END0_2:
4344
; CHECK-LABEL: .LBB0_3:
45+
; CHECK-LABEL: .LBB0_3_CS0:
4446
; CHECK-LABEL: .LBB_END0_3:
4547
; CHECK-LABEL: .Lfunc_end0:
4648

4749
; CHECK: .section .llvm_bb_addr_map,"o",@llvm_bb_addr_map,.text.hot._Z3bazb
48-
; CHECK-NEXT: .byte 2 # version
49-
; CHECK-NEXT: .byte 8 # feature
50-
; CHECK-NEXT: .byte 2 # number of basic block ranges
51-
; CHECK-NEXT: .quad .Lfunc_begin0 # base address
52-
; CHECK-NEXT: .byte 2 # number of basic blocks
53-
; CHECK-NEXT: .byte 0 # BB id
54-
; CHECK-NEXT: .uleb128 .Lfunc_begin0-.Lfunc_begin0
55-
; CHECK-NEXT: .uleb128 .LBB_END0_0-.Lfunc_begin0
56-
; CHECK-NEXT: .byte 0
57-
; CHECK-NEXT: .byte 2 # BB id
58-
; CHECK-NEXT: .uleb128 .LBB0_1-.LBB_END0_0
59-
; CHECK-NEXT: .uleb128 .LBB_END0_1-.LBB0_1
60-
; CHECK-NEXT: .byte 5
61-
; CHECK-NEXT: .quad _Z3bazb.cold # base address
62-
; CHECK-NEXT: .byte 2 # number of basic blocks
63-
; CHECK-NEXT: .byte 1 # BB id
64-
; CHECK-NEXT: .uleb128 _Z3bazb.cold-_Z3bazb.cold
65-
; CHECK-NEXT: .uleb128 .LBB_END0_2-_Z3bazb.cold
66-
; CHECK-NEXT: .byte 8
67-
; CHECK-NEXT: .byte 3 # BB id
68-
; CHECK-NEXT: .uleb128 .LBB0_3-.LBB_END0_2
69-
; CHECK-NEXT: .uleb128 .LBB_END0_3-.LBB0_3
50+
; CHECK-NEXT: .byte 3 # version
51+
; CHECK-NEXT: .byte 40 # feature
52+
; CHECK-NEXT: .byte 2 # number of basic block ranges
53+
; CHECK-NEXT: .quad .Lfunc_begin0 # base address
54+
; CHECK-NEXT: .byte 2 # number of basic blocks
55+
; CHECK-NEXT: .byte 0 # BB id
56+
; CHECK-NEXT: .uleb128 .Lfunc_begin0-.Lfunc_begin0
57+
; CHECK-NEXT: .byte 0 # number of callsites
58+
; CHECK-NEXT: .uleb128 .LBB_END0_0-.Lfunc_begin0
59+
; CHECK-NEXT: .byte 0
60+
; CHECK-NEXT: .byte 2 # BB id
61+
; CHECK-NEXT: .uleb128 .LBB0_1-.LBB_END0_0
62+
; CHECK-NEXT: .byte 0 # number of callsites
63+
; CHECK-NEXT: .uleb128 .LBB_END0_1-.LBB0_1
64+
; CHECK-NEXT: .byte 5
65+
; CHECK-NEXT: .quad _Z3bazb.cold # base address
66+
; CHECK-NEXT: .byte 2 # number of basic blocks
67+
; CHECK-NEXT: .byte 1 # BB id
68+
; CHECK-NEXT: .uleb128 _Z3bazb.cold-_Z3bazb.cold
69+
; CHECK-NEXT: .byte 1 # number of callsites
70+
; CHECK-NEXT: .uleb128 .LBB0_2_CS0-_Z3bazb.cold
71+
; CHECK-NEXT: .uleb128 .LBB_END0_2-.LBB0_2_CS0
72+
; CHECK-NEXT: .byte 8
73+
; CHECK-NEXT: .byte 3 # BB id
74+
; CHECK-NEXT: .uleb128 .LBB0_3-.LBB_END0_2
75+
; CHECK-NEXT: .byte 1 # number of callsites
76+
; CHECK-NEXT: .uleb128 .LBB0_3_CS0-.LBB0_3
77+
; CHECK-NEXT: .uleb128 .LBB_END0_3-.LBB0_3_CS0
7078
; CHECK-NEXT: .byte 1
7179

llvm/test/CodeGen/X86/basic-block-address-map-with-mfs.ll

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,32 +47,43 @@ declare i32 @qux()
4747
; CHECK-LABEL: .Lfunc_begin0:
4848
; CHECK-LABEL: .LBB_END0_0:
4949
; CHECK-LABEL: .LBB0_1:
50+
; CHECK-LABEL: .LBB0_1_CS0:
51+
; CHECK-LABEL: .LBB0_1_CS1:
5052
; CHECK-LABEL: .LBB_END0_1:
5153
; CHECK: .section .text.split.foo,"ax",@progbits
5254
; CHECK-LABEL: foo.cold:
55+
; CHECK-LABEL: .LBB0_2_CS0:
56+
; CHECK-LABEL: .LBB0_2_CS1:
5357
; CHECK-LABEL: .LBB_END0_2:
5458
; CHECK-LABEL: .Lfunc_end0:
5559

5660
; CHECK: .section .llvm_bb_addr_map,"o",@llvm_bb_addr_map,.text.hot.foo
57-
; CHECK-NEXT: .byte 2 # version
58-
; BASIC-NEXT: .byte 8 # feature
59-
; PGO-NEXT: .byte 15 # feature
61+
; CHECK-NEXT: .byte 3 # version
62+
; BASIC-NEXT: .byte 40 # feature
63+
; PGO-NEXT: .byte 47 # feature
6064
; CHECK-NEXT: .byte 2 # number of basic block ranges
6165
; CHECK-NEXT: .quad .Lfunc_begin0 # base address
6266
; CHECK-NEXT: .byte 2 # number of basic blocks
6367
; CHECK-NEXT: .byte 0 # BB id
6468
; CHECK-NEXT: .uleb128 .Lfunc_begin0-.Lfunc_begin0
69+
; CHECK-NEXT: .byte 0 # number of callsites
6570
; CHECK-NEXT: .uleb128 .LBB_END0_0-.Lfunc_begin0
6671
; CHECK-NEXT: .byte 8
6772
; CHECK-NEXT: .byte 1 # BB id
6873
; CHECK-NEXT: .uleb128 .LBB0_1-.LBB_END0_0
69-
; CHECK-NEXT: .uleb128 .LBB_END0_1-.LBB0_1
74+
; CHECK-NEXT: .byte 2 # number of callsites
75+
; CHECK-NEXT: .uleb128 .LBB0_1_CS0-.LBB0_1
76+
; CHECK-NEXT: .uleb128 .LBB0_1_CS1-.LBB0_1_CS0
77+
; CHECK-NEXT: .uleb128 .LBB_END0_1-.LBB0_1_CS1
7078
; CHECK-NEXT: .byte 3
71-
; CHECK-NEXT: .quad foo.cold # base address
79+
; CHECK-NEXT: .quad foo.cold # base address
7280
; CHECK-NEXT: .byte 1 # number of basic blocks
7381
; CHECK-NEXT: .byte 2 # BB id
7482
; CHECK-NEXT: .uleb128 foo.cold-foo.cold
75-
; CHECK-NEXT: .uleb128 .LBB_END0_2-foo.cold
83+
; CHECK-NEXT: .byte 2 # number of callsites
84+
; CHECK-NEXT: .uleb128 .LBB0_2_CS0-foo.cold
85+
; CHECK-NEXT: .uleb128 .LBB0_2_CS1-.LBB0_2_CS0
86+
; CHECK-NEXT: .uleb128 .LBB_END0_2-.LBB0_2_CS1
7687
; CHECK-NEXT: .byte 3
7788

7889
;; PGO Analysis Map
@@ -84,6 +95,6 @@ declare i32 @qux()
8495
; PGO-NEXT: .byte 2 # successor BB ID
8596
; PGO-NEXT: .byte 0 # successor branch probability
8697
; PGO-NEXT: .ascii "\200\200\200\374\377\377\377\037" # basic block frequency
87-
; PGO-NEXT: .byte 0 # basic block successor count
98+
; PGO-NEXT: .byte 0 # basic block successor count
8899
; PGO-NEXT: .ascii "\200\200\200\004" # basic block frequency
89100
; PGO-NEXT: .byte 0 # basic block successor count

0 commit comments

Comments
 (0)