Skip to content

Commit ffa1762

Browse files
committed
Fix references.
1 parent 1162d69 commit ffa1762

File tree

4 files changed

+21
-28
lines changed

4 files changed

+21
-28
lines changed

llvm/include/llvm/CodeGen/BasicBlockSectionsProfileReader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ struct CallsiteID {
5353
// This represents a prefetch hint to be injected at site `SiteID`, targetting
5454
// `TargetID` in function `TargetFunction`.
5555
struct PrefetchHint {
56-
SubblockID SiteID;
56+
CallsiteID SiteID;
5757
StringRef TargetFunction;
58-
SubblockID TargetID;
58+
CallsiteID TargetID;
5959
};
6060

6161
// This represents the raw input profile for one function.

llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ BasicBlockSectionsProfileReader::getPrefetchHintsForFunction(
167167
// instruct the compiler to emit a prefetch symbol for the given target.
168168
// A prefetch target is specified by a pair "<bbid>,<subblock_index>" where
169169
// bbid specifies the target basic block and subblock_index is a zero-based
170-
// index. Subblock 0 refers to the region at the beginning of the block up to
171-
// the first callsite. Subblock `i > 0` refers to the region immediately after
170+
// index. Callsite 0 refers to the region at the beginning of the block up to
171+
// the first callsite. Callsite `i > 0` refers to the region immediately after
172172
// the `i`-th callsite up to the `i+1`-th callsite (or the end of the block).
173173
// The prefetch target is always emitted at the beginning of the subblock.
174174
// This is the beginning of the basic block for `i = 0` and immediately after
@@ -180,15 +180,15 @@ BasicBlockSectionsProfileReader::getPrefetchHintsForFunction(
180180
// subblock.
181181
//
182182
// +----------------------------------+
183-
// | __llvm_prefetch_target_foo_10_0: | <- Subblock 0 (before call_A)
183+
// | __llvm_prefetch_target_foo_10_0: | <- Callsite 0 (before call_A)
184184
// | Instruction 1 |
185185
// | Instruction 2 |
186186
// | call_A (Callsite 0) |
187-
// | __llvm_prefetch_target_foo_10_1: | <--- Subblock 1 (after call_A,
187+
// | __llvm_prefetch_target_foo_10_1: | <--- Callsite 1 (after call_A,
188188
// | | before call_B)
189189
// | Instruction 3 |
190190
// | call_B (Callsite 1) |
191-
// | __llvm_prefetch_target_foo_10_2: | <--- Subblock 2 (after call_B,
191+
// | __llvm_prefetch_target_foo_10_2: | <--- Callsite 2 (after call_B,
192192
// | | before call_C)
193193
// | Instruction 4 |
194194
// +----------------------------------+
@@ -368,8 +368,8 @@ Error BasicBlockSectionsProfileReader::ReadV1Profile() {
368368
auto SiteBBID = parseUniqueBBID(PrefetchSiteStr[0]);
369369
if (!SiteBBID)
370370
return SiteBBID.takeError();
371-
unsigned long long SiteSubblockIndex;
372-
if (getAsUnsignedInteger(PrefetchSiteStr[1], 10, SiteSubblockIndex))
371+
unsigned long long SiteCallsiteIndex;
372+
if (getAsUnsignedInteger(PrefetchSiteStr[1], 10, SiteCallsiteIndex))
373373
return createProfileParseError(Twine("unsigned integer expected: '") +
374374
PrefetchSiteStr[1]);
375375

@@ -381,14 +381,14 @@ Error BasicBlockSectionsProfileReader::ReadV1Profile() {
381381
auto TargetBBID = parseUniqueBBID(PrefetchTargetStr[1]);
382382
if (!TargetBBID)
383383
return TargetBBID.takeError();
384-
unsigned long long TargetSubblockIndex;
385-
if (getAsUnsignedInteger(PrefetchTargetStr[2], 10, TargetSubblockIndex))
384+
unsigned long long TargetCallsiteIndex;
385+
if (getAsUnsignedInteger(PrefetchTargetStr[2], 10, TargetCallsiteIndex))
386386
return createProfileParseError(Twine("unsigned integer expected: '") +
387387
PrefetchTargetStr[2]);
388388
FI->second.PrefetchHints.push_back(PrefetchHint{
389-
SubblockID{*SiteBBID, static_cast<unsigned>(SiteSubblockIndex)},
389+
CallsiteID{*SiteBBID, static_cast<unsigned>(SiteCallsiteIndex)},
390390
PrefetchTargetStr[0],
391-
SubblockID{*TargetBBID, static_cast<unsigned>(TargetSubblockIndex)}});
391+
CallsiteID{*TargetBBID, static_cast<unsigned>(TargetCallsiteIndex)}});
392392
continue;
393393
}
394394
case 't': { // Prefetch target specifier.
@@ -399,7 +399,6 @@ Error BasicBlockSectionsProfileReader::ReadV1Profile() {
399399
SmallVector<StringRef, 2> PrefetchTargetStr;
400400
if (Values.size() != 1)
401401
return createProfileParseError(Twine("Prefetch target expected: ") + S);
402-
SmallVector<StringRef, 2> PrefetchTargetStr;
403402
Values[0].split(PrefetchTargetStr, ',');
404403
if (PrefetchTargetStr.size() != 2)
405404
return createProfileParseError(Twine("Prefetch target expected: ") +

llvm/lib/CodeGen/InsertCodePrefetch.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ using namespace llvm;
3737
namespace llvm {
3838
SmallString<128> getPrefetchTargetSymbolName(StringRef FunctionName,
3939
const UniqueBBID &BBID,
40-
unsigned SubblockIndex) {
40+
unsigned CallsiteIndex) {
4141
SmallString<128> R("__llvm_prefetch_target_");
4242
R += FunctionName;
4343
R += "_";
4444
R += utostr(BBID.BaseID);
4545
R += "_";
46-
R += utostr(SubblockIndex);
46+
R += utostr(CallsiteIndex);
4747
return R;
4848
}
4949
} // namespace llvm
@@ -112,7 +112,7 @@ bool InsertCodePrefetch::runOnMachineFunction(MachineFunction &MF) {
112112
PrefetchHintsBySiteBBID[H.SiteID.BBID].push_back(H);
113113
for (auto &[SiteBBID, Hints] : PrefetchHintsBySiteBBID) {
114114
llvm::sort(Hints, [](const PrefetchHint &H1, const PrefetchHint &H2) {
115-
return H1.SiteID.SubblockIndex < H2.SiteID.SubblockIndex;
115+
return H1.SiteID.CallsiteIndex < H2.SiteID.CallsiteIndex;
116116
});
117117
}
118118
auto PtrTy =
@@ -128,11 +128,11 @@ bool InsertCodePrefetch::runOnMachineFunction(MachineFunction &MF) {
128128
for (auto HintIt = PrefetchHints.begin(); HintIt != PrefetchHints.end();) {
129129
auto NextInstrIt = InstrIt == BB.end() ? BB.end() : std::next(InstrIt);
130130
while (HintIt != PrefetchHints.end() &&
131-
NumCallsInBB >= HintIt->SiteID.SubblockIndex) {
131+
NumCallsInBB >= HintIt->SiteID.CallsiteIndex) {
132132
auto *GV = MF.getFunction().getParent()->getOrInsertGlobal(
133133
getPrefetchTargetSymbolName(HintIt->TargetFunction,
134134
HintIt->TargetID.BBID,
135-
HintIt->TargetID.SubblockIndex),
135+
HintIt->TargetID.CallsiteIndex),
136136
PtrTy);
137137
TII->insertCodePrefetchInstr(BB, InstrIt, GV);
138138
++HintIt;

llvm/test/CodeGen/X86/basic-block-sections-code-prefetch.ll

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,13 @@
77
; RUN: echo 't 1,0' >> %t
88
; RUN: echo 't 1,1' >> %t
99
; RUN: echo 't 2,1' >> %t
10-
<<<<<<< HEAD
1110
; RUN: echo 't 3,0' >> %t
12-
=======
13-
; RUN: echo 't 4,0' >> %t
14-
; RUN: echo 'i 3@0 _Z3barv@0@0' >> %t
15-
; RUN: echo 'i 2@1 _Z3foob@1@0' >> %t
16-
>>>>>>> d2ddce6b2050 (Expand the test case to prefetch hints.)
11+
; RUN: echo 'i 3,0 _Z3barv,0,0' >> %t
12+
; RUN: echo 'i 2,1 _Z3foob,1,0' >> %t
1713
; RUN: echo 'f _Z3barv' >> %t
1814
; RUN: echo 't 0,0' >> %t
1915
; RUN: echo 't 21,1' >> %t
20-
; RUN: echo 'i 0@1 _Z3foob@0@0' >> %t
16+
; RUN: echo 'i 0,1 _Z3foob,0,0' >> %t
2117
;;
2218
; RUN: llc < %s -O0 -mtriple=x86_64-pc-linux -asm-verbose=false -function-sections -basic-block-sections=%t | FileCheck %s
2319

@@ -62,8 +58,6 @@ define i32 @_Z3foob(i1 zeroext %0) nounwind {
6258
; CHECK-NEXT: __llvm_prefetch_target__Z3foob_3_0:
6359
; CHECK-NEXT: prefetchit1 __llvm_prefetch_target__Z3barv_0_0(%rip)
6460
; CHECK: retq
65-
66-
>>>>>>> d2ddce6b2050 (Expand the test case to prefetch hints.)
6761
}
6862

6963
define weak i32 @_Z3barv() nounwind {

0 commit comments

Comments
 (0)