Skip to content

Commit 32dafa3

Browse files
committed
Merge branch 'sycl' into unified-interface
2 parents 766fd8c + b449280 commit 32dafa3

File tree

3,989 files changed

+152891
-91352
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,989 files changed

+152891
-91352
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
}

bolt/lib/RuntimeLibs/HugifyRuntimeLibrary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void HugifyRuntimeLibrary::adjustCommandLineOptions(
4646
errs()
4747
<< "BOLT-ERROR: -hot-text should be applied to binaries with "
4848
"pre-compiled manual hugify support, while -hugify will add hugify "
49-
"support automatcally. These two options cannot both be present.\n";
49+
"support automatically. These two options cannot both be present.\n";
5050
exit(1);
5151
}
5252
// After the check, we set HotText to be true because automated hugify support

bolt/unittests/Profile/DataAggregator.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,14 @@ TEST(DataAggregatorTest, buildID) {
4141

4242
StringRef AllValidBuildIDs = "0000 File0\n"
4343
"1111 File1\n"
44-
"2222 File2\n";
44+
"2222 File2\n"
45+
"333 File3\n";
4546
DA.setParsingBuffer(AllValidBuildIDs);
4647
ASSERT_TRUE(DA.hasAllBuildIDs());
4748
FileName = DA.getFileNameForBuildID("1234");
4849
ASSERT_FALSE(FileName);
4950
FileName = DA.getFileNameForBuildID("2222");
5051
ASSERT_EQ(*FileName, "File2");
52+
FileName = DA.getFileNameForBuildID("333");
53+
ASSERT_EQ(*FileName, "File3");
5154
}

clang-tools-extra/clang-doc/BitcodeReader.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,6 @@ llvm::Error parseRecord(const Record &R, unsigned ID, llvm::StringRef Blob,
342342
return decodeRecord(R, I->RefType, Blob);
343343
case REFERENCE_PATH:
344344
return decodeRecord(R, I->Path, Blob);
345-
case REFERENCE_IS_IN_GLOBAL_NAMESPACE:
346-
return decodeRecord(R, I->IsInGlobalNamespace, Blob);
347345
case REFERENCE_FIELD:
348346
return decodeRecord(R, F, Blob);
349347
default:

clang-tools-extra/clang-doc/BitcodeWriter.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ static const llvm::IndexedMap<RecordIdDsc, RecordIdToIndexFunctor>
187187
{REFERENCE_NAME, {"Name", &StringAbbrev}},
188188
{REFERENCE_TYPE, {"RefType", &IntAbbrev}},
189189
{REFERENCE_PATH, {"Path", &StringAbbrev}},
190-
{REFERENCE_IS_IN_GLOBAL_NAMESPACE,
191-
{"IsInGlobalNamespace", &BoolAbbrev}},
192190
{REFERENCE_FIELD, {"Field", &IntAbbrev}}};
193191
assert(Inits.size() == RecordIdCount);
194192
for (const auto &Init : Inits) {
@@ -239,7 +237,7 @@ static const std::vector<std::pair<BlockId, std::vector<RecordId>>>
239237
// Reference Block
240238
{BI_REFERENCE_BLOCK_ID,
241239
{REFERENCE_USR, REFERENCE_NAME, REFERENCE_TYPE, REFERENCE_PATH,
242-
REFERENCE_IS_IN_GLOBAL_NAMESPACE, REFERENCE_FIELD}}};
240+
REFERENCE_FIELD}}};
243241

244242
// AbbreviationMap
245243

@@ -412,7 +410,6 @@ void ClangDocBitcodeWriter::emitBlock(const Reference &R, FieldId Field) {
412410
emitRecord(R.Name, REFERENCE_NAME);
413411
emitRecord((unsigned)R.RefType, REFERENCE_TYPE);
414412
emitRecord(R.Path, REFERENCE_PATH);
415-
emitRecord(R.IsInGlobalNamespace, REFERENCE_IS_IN_GLOBAL_NAMESPACE);
416413
emitRecord((unsigned)Field, REFERENCE_FIELD);
417414
}
418415

clang-tools-extra/clang-doc/BitcodeWriter.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ enum RecordId {
122122
REFERENCE_NAME,
123123
REFERENCE_TYPE,
124124
REFERENCE_PATH,
125-
REFERENCE_IS_IN_GLOBAL_NAMESPACE,
126125
REFERENCE_FIELD,
127126
RI_LAST,
128127
RI_FIRST = VERSION

clang-tools-extra/clang-doc/HTMLGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ static std::unique_ptr<TagNode> genLink(const Twine &Text, const Twine &Link) {
308308
static std::unique_ptr<HTMLNode>
309309
genReference(const Reference &Type, StringRef CurrentDirectory,
310310
llvm::Optional<StringRef> JumpToSection = None) {
311-
if (Type.Path.empty() && !Type.IsInGlobalNamespace) {
311+
if (Type.Path.empty()) {
312312
if (!JumpToSection)
313313
return std::make_unique<TextNode>(Type.Name);
314314
else

clang-tools-extra/clang-doc/Representation.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ void Reference::merge(Reference &&Other) {
170170
Name = Other.Name;
171171
if (Path.empty())
172172
Path = Other.Path;
173-
if (!IsInGlobalNamespace)
174-
IsInGlobalNamespace = Other.IsInGlobalNamespace;
175173
}
176174

177175
void Info::mergeBase(Info &&Other) {

0 commit comments

Comments
 (0)