Skip to content

Commit 192af67

Browse files
committed
LLVM and SPIRV-LLVM-Translator pulldown (WW41)
LLVM: llvm/llvm-project@9c0314f SPIRV-LLVM-Translator: KhronosGroup/SPIRV-LLVM-Translator@a3b372c
2 parents 9fc1d68 + 490431e commit 192af67

File tree

3,931 files changed

+151229
-91148
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,931 files changed

+151229
-91148
lines changed

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,9 @@ class BinaryContext {
615615
/// Number of functions with profile information
616616
uint64_t NumProfiledFuncs{0};
617617

618+
/// Number of functions with stale profile information
619+
uint64_t NumStaleProfileFuncs{0};
620+
618621
/// Number of objects in profile whose profile was ignored.
619622
uint64_t NumUnusedProfiledObjects{0};
620623

bolt/include/bolt/Core/DebugData.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ class DebugAddrWriter {
330330
protected:
331331
class AddressForDWOCU {
332332
public:
333-
AddressToIndexMap::iterator find(uint64_t Adddress) {
334-
return AddressToIndex.find(Adddress);
333+
AddressToIndexMap::iterator find(uint64_t Address) {
334+
return AddressToIndex.find(Address);
335335
}
336336
AddressToIndexMap::iterator end() { return AddressToIndex.end(); }
337337
AddressToIndexMap::iterator begin() { return AddressToIndex.begin(); }

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ class MCPlusBuilder {
14311431
return false;
14321432
}
14331433

1434-
/// Store \p Target absolute adddress to \p RegName
1434+
/// Store \p Target absolute address to \p RegName
14351435
virtual InstructionListType materializeAddress(const MCSymbol *Target,
14361436
MCContext *Ctx,
14371437
MCPhysReg RegName,

bolt/include/bolt/Profile/DataAggregator.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ class DataAggregator : public DataReader {
311311
/// Consume the entire line
312312
void consumeRestOfLine();
313313

314+
/// True if the next token in the parsing buffer is a new line, but don't
315+
/// consume it (peek only).
316+
bool checkNewLine();
317+
314318
/// Parse a single LBR entry as output by perf script -Fbrstack
315319
ErrorOr<LBREntry> parseLBREntry();
316320

bolt/lib/Passes/BinaryPasses.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,10 +417,14 @@ void ReorderBasicBlocks::runOnFunctions(BinaryContext &BC) {
417417
ParallelUtilities::runOnEachFunction(
418418
BC, ParallelUtilities::SchedulingPolicy::SP_BB_LINEAR, WorkFun, SkipFunc,
419419
"ReorderBasicBlocks");
420+
const size_t NumAllProfiledFunctions =
421+
BC.NumProfiledFuncs + BC.NumStaleProfileFuncs;
420422

421423
outs() << "BOLT-INFO: basic block reordering modified layout of "
422-
<< format("%zu (%.2lf%%) functions\n",
424+
<< format("%zu functions (%.2lf%% of profiled, %.2lf%% of total)\n",
423425
ModifiedFuncCount.load(std::memory_order_relaxed),
426+
100.0 * ModifiedFuncCount.load(std::memory_order_relaxed) /
427+
NumAllProfiledFunctions,
424428
100.0 * ModifiedFuncCount.load(std::memory_order_relaxed) /
425429
BC.getBinaryFunctions().size());
426430

@@ -890,7 +894,7 @@ uint64_t SimplifyConditionalTailCalls::fixTailCalls(BinaryFunction &BF) {
890894

891895
// Annotate it, so "isCall" returns true for this jcc
892896
MIB->setConditionalTailCall(*CondBranch);
893-
// Add info abount the conditional tail call frequency, otherwise this
897+
// Add info about the conditional tail call frequency, otherwise this
894898
// info will be lost when we delete the associated BranchInfo entry
895899
auto &CTCAnnotation =
896900
MIB->getOrCreateAnnotationAs<uint64_t>(*CondBranch, "CTCTakenCount");
@@ -1383,6 +1387,7 @@ void PrintProgramStats::runOnFunctions(BinaryContext &BC) {
13831387
}
13841388
}
13851389
BC.NumProfiledFuncs = ProfiledFunctions.size();
1390+
BC.NumStaleProfileFuncs = NumStaleProfileFunctions;
13861391

13871392
const size_t NumAllProfiledFunctions =
13881393
ProfiledFunctions.size() + NumStaleProfileFunctions;

bolt/lib/Passes/IndirectCallPromotion.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -416,15 +416,15 @@ IndirectCallPromotion::maybeGetHotJumpTableTargets(BinaryBasicBlock &BB,
416416

417417
++TotalIndexBasedCandidates;
418418

419-
auto ErrorOrMemAccesssProfile =
419+
auto ErrorOrMemAccessProfile =
420420
BC.MIB->tryGetAnnotationAs<MemoryAccessProfile>(*MemLocInstr,
421421
"MemoryAccessProfile");
422-
if (!ErrorOrMemAccesssProfile) {
422+
if (!ErrorOrMemAccessProfile) {
423423
DEBUG_VERBOSE(1, dbgs()
424424
<< "BOLT-INFO: ICP no memory profiling data found\n");
425425
return JumpTableInfoType();
426426
}
427-
MemoryAccessProfile &MemAccessProfile = ErrorOrMemAccesssProfile.get();
427+
MemoryAccessProfile &MemAccessProfile = ErrorOrMemAccessProfile.get();
428428

429429
uint64_t ArrayStart;
430430
if (DispExpr) {
@@ -670,15 +670,15 @@ IndirectCallPromotion::MethodInfoType IndirectCallPromotion::maybeGetVtableSyms(
670670
});
671671

672672
// Try to get value profiling data for the method load instruction.
673-
auto ErrorOrMemAccesssProfile =
673+
auto ErrorOrMemAccessProfile =
674674
BC.MIB->tryGetAnnotationAs<MemoryAccessProfile>(*MethodFetchInsns.back(),
675675
"MemoryAccessProfile");
676-
if (!ErrorOrMemAccesssProfile) {
676+
if (!ErrorOrMemAccessProfile) {
677677
DEBUG_VERBOSE(1, dbgs()
678678
<< "BOLT-INFO: ICP no memory profiling data found\n");
679679
return MethodInfoType();
680680
}
681-
MemoryAccessProfile &MemAccessProfile = ErrorOrMemAccesssProfile.get();
681+
MemoryAccessProfile &MemAccessProfile = ErrorOrMemAccessProfile.get();
682682

683683
// Find the vtable that each method belongs to.
684684
std::map<const MCSymbol *, uint64_t> MethodToVtable;

bolt/lib/Passes/ReorderData.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,14 @@ void ReorderData::assignMemData(BinaryContext &BC) {
182182

183183
for (const BinaryBasicBlock &BB : BF) {
184184
for (const MCInst &Inst : BB) {
185-
auto ErrorOrMemAccesssProfile =
185+
auto ErrorOrMemAccessProfile =
186186
BC.MIB->tryGetAnnotationAs<MemoryAccessProfile>(
187187
Inst, "MemoryAccessProfile");
188-
if (!ErrorOrMemAccesssProfile)
188+
if (!ErrorOrMemAccessProfile)
189189
continue;
190190

191191
const MemoryAccessProfile &MemAccessProfile =
192-
ErrorOrMemAccesssProfile.get();
192+
ErrorOrMemAccessProfile.get();
193193
for (const AddressAccess &AccessInfo :
194194
MemAccessProfile.AddressAccessInfo) {
195195
if (BinaryData *BD = AccessInfo.MemoryObject) {
@@ -238,14 +238,14 @@ ReorderData::sortedByFunc(BinaryContext &BC, const BinarySection &Section,
238238
continue;
239239

240240
for (const MCInst &Inst : BB) {
241-
auto ErrorOrMemAccesssProfile =
241+
auto ErrorOrMemAccessProfile =
242242
BC.MIB->tryGetAnnotationAs<MemoryAccessProfile>(
243243
Inst, "MemoryAccessProfile");
244-
if (!ErrorOrMemAccesssProfile)
244+
if (!ErrorOrMemAccessProfile)
245245
continue;
246246

247247
const MemoryAccessProfile &MemAccessProfile =
248-
ErrorOrMemAccesssProfile.get();
248+
ErrorOrMemAccessProfile.get();
249249
for (const AddressAccess &AccessInfo :
250250
MemAccessProfile.AddressAccessInfo) {
251251
if (AccessInfo.MemoryObject)

bolt/lib/Passes/RetpolineInsertion.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,17 @@ RetpolineLfence("retpoline-lfence",
4444
cl::Hidden,
4545
cl::cat(BoltCategory));
4646

47-
cl::opt<RetpolineInsertion::AvailabilityOptions>
48-
R11Availability("r11-availability",
49-
cl::desc("determine the availablity of r11 before indirect branches"),
50-
cl::init(RetpolineInsertion::AvailabilityOptions::NEVER),
51-
cl::values(
52-
clEnumValN(RetpolineInsertion::AvailabilityOptions::NEVER,
53-
"never", "r11 not available"),
54-
clEnumValN(RetpolineInsertion::AvailabilityOptions::ALWAYS,
55-
"always", "r11 avaialable before calls and jumps"),
56-
clEnumValN(RetpolineInsertion::AvailabilityOptions::ABI,
57-
"abi", "r11 avaialable before calls but not before jumps")),
58-
cl::ZeroOrMore,
59-
cl::cat(BoltCategory));
47+
cl::opt<RetpolineInsertion::AvailabilityOptions> R11Availability(
48+
"r11-availability",
49+
cl::desc("determine the availability of r11 before indirect branches"),
50+
cl::init(RetpolineInsertion::AvailabilityOptions::NEVER),
51+
cl::values(clEnumValN(RetpolineInsertion::AvailabilityOptions::NEVER,
52+
"never", "r11 not available"),
53+
clEnumValN(RetpolineInsertion::AvailabilityOptions::ALWAYS,
54+
"always", "r11 avaialable before calls and jumps"),
55+
clEnumValN(RetpolineInsertion::AvailabilityOptions::ABI, "abi",
56+
"r11 avaialable before calls but not before jumps")),
57+
cl::ZeroOrMore, cl::cat(BoltCategory));
6058

6159
} // namespace opts
6260

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,10 @@ void DataAggregator::consumeRestOfLine() {
10561056
Line += 1;
10571057
}
10581058

1059+
bool DataAggregator::checkNewLine() {
1060+
return ParsingBuf[0] == '\n';
1061+
}
1062+
10591063
ErrorOr<DataAggregator::PerfBranchSample> DataAggregator::parseBranchSample() {
10601064
PerfBranchSample Res;
10611065

@@ -2147,7 +2151,8 @@ DataAggregator::parseNameBuildIDPair() {
21472151

21482152
// If one of the strings is missing, don't issue a parsing error, but still
21492153
// do not return a value.
2150-
if (ParsingBuf[0] == '\n')
2154+
consumeAllRemainingFS();
2155+
if (checkNewLine())
21512156
return NoneType();
21522157

21532158
ErrorOr<StringRef> NameStr = parseString(FieldSeparator, true);

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,10 +1429,17 @@ void RewriteInstance::adjustFunctionBoundaries() {
14291429
Function.hasRestoredNameRegex(".*\\.cold(\\.[0-9]+)?");
14301430
if (FragName) {
14311431
static bool PrintedWarning = false;
1432-
if (BC->HasRelocations && !PrintedWarning) {
1433-
errs() << "BOLT-WARNING: split function detected on input : "
1434-
<< *FragName << ". The support is limited in relocation mode.\n";
1432+
if (!PrintedWarning) {
14351433
PrintedWarning = true;
1434+
errs() << "BOLT-WARNING: split function detected on input : "
1435+
<< *FragName;
1436+
if (BC->HasRelocations)
1437+
errs() << ". The support is limited in relocation mode";
1438+
if (opts::Lite) {
1439+
opts::Lite = false;
1440+
errs() << "\nBOLT-WARNING: disabling lite mode (-lite) when split "
1441+
<< "functions are present\n";
1442+
}
14361443
}
14371444
Function.IsFragment = true;
14381445
}

0 commit comments

Comments
 (0)