Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e130ee1

Browse filesBrowse files
authored
Merge branch 'main' into users/kerbowa/preload-kernarg-metadata
2 parents 452d27a + a788a1a commit e130ee1
Copy full SHA for e130ee1

File tree

Expand file treeCollapse file tree

761 files changed

+67998
-20150
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

761 files changed

+67998
-20150
lines changed

‎.github/new-prs-labeler.yml

Copy file name to clipboardExpand all lines: .github/new-prs-labeler.yml
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,12 @@ lld:wasm:
791791
- lld/**/wasm/**
792792
- lld/Common/**
793793

794+
backend:ARC:
795+
- llvm/lib/Target/ARC/**
796+
- clang/lib/Basic/Targets/ARC.h
797+
- clang/lib/Basic/Targets/ARC.cpp
798+
- clang/lib/CodeGen/Targets/ARC.cpp
799+
794800
backend:ARM:
795801
- llvm/include/llvm/IR/IntrinsicsARM.td
796802
- llvm/test/MC/ARM/**
@@ -817,6 +823,19 @@ backend:AArch64:
817823
- clang/include/clang/Sema/SemaARM.h
818824
- clang/lib/Sema/SemaARM.cpp
819825

826+
backend:CSKY:
827+
- llvm/lib/Target/CSKY/**
828+
- llvm/include/llvm/TargetParser/CSKYTargetParser.def
829+
- llvm/include/llvm/TargetParser/CSKYTargetParser.h
830+
- llvm/include/llvm/BinaryFormat/ELFRelocs/CSKY.def
831+
- llvm/lib/TargetParser/CSKYTargetParser.cpp
832+
- llvm/lib/Support/CSKYAttributes.cpp
833+
- llvm/lib/Support/CSKYAttributeParser.cpp
834+
- clang/lib/Basic/Targets/CSKY.h
835+
- clang/lib/Basic/Targets/CSKY.cpp
836+
- clang/lib/CodeGen/Targets/CSKY.cpp
837+
- clang/lib/Driver/ToolChains/CSKY*
838+
820839
backend:Hexagon:
821840
- clang/include/clang/Basic/BuiltinsHexagon*.def
822841
- clang/include/clang/Sema/SemaHexagon.h
@@ -840,6 +859,13 @@ backend:Hexagon:
840859
- llvm/test/MC/Hexagon/**
841860
- llvm/test/tools/llvm-objdump/ELF/Hexagon/**
842861

862+
backend:Lanai:
863+
- llvm/lib/Target/Lanai/**
864+
- clang/lib/Basic/Targets/Lanai.h
865+
- clang/lib/Basic/Targets/Lanai.cpp
866+
- clang/lib/CodeGen/Targets/Lanai.cpp
867+
- clang/lib/Driver/ToolChains/Lanai*
868+
843869
backend:loongarch:
844870
- llvm/include/llvm/IR/IntrinsicsLoongArch.td
845871
- llvm/test/MC/LoongArch/**

‎bolt/include/bolt/Core/BinaryContext.h

Copy file name to clipboardExpand all lines: bolt/include/bolt/Core/BinaryContext.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@ class BinaryContext {
14991499
MCEInstance.LocalCtx.reset(
15001500
new MCContext(*TheTriple, AsmInfo.get(), MRI.get(), STI.get()));
15011501
MCEInstance.LocalMOFI.reset(
1502-
TheTarget->createMCObjectFileInfo(*MCEInstance.LocalCtx.get(),
1502+
TheTarget->createMCObjectFileInfo(*MCEInstance.LocalCtx,
15031503
/*PIC=*/!HasFixedLoadAddress));
15041504
MCEInstance.LocalCtx->setObjectFileInfo(MCEInstance.LocalMOFI.get());
15051505
MCEInstance.MCE.reset(

‎bolt/include/bolt/Core/BinaryFunction.h

Copy file name to clipboardExpand all lines: bolt/include/bolt/Core/BinaryFunction.h
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,15 +867,15 @@ class BinaryFunction {
867867
/// Returns if BinaryDominatorTree has been constructed for this function.
868868
bool hasDomTree() const { return BDT != nullptr; }
869869

870-
BinaryDominatorTree &getDomTree() { return *BDT.get(); }
870+
BinaryDominatorTree &getDomTree() { return *BDT; }
871871

872872
/// Constructs DomTree for this function.
873873
void constructDomTree();
874874

875875
/// Returns if loop detection has been run for this function.
876876
bool hasLoopInfo() const { return BLI != nullptr; }
877877

878-
const BinaryLoopInfo &getLoopInfo() { return *BLI.get(); }
878+
const BinaryLoopInfo &getLoopInfo() { return *BLI; }
879879

880880
bool isLoopFree() {
881881
if (!hasLoopInfo())

‎bolt/include/bolt/Core/DIEBuilder.h

Copy file name to clipboardExpand all lines: bolt/include/bolt/Core/DIEBuilder.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class DIEBuilder {
137137
std::unordered_map<std::string, uint32_t> NameToIndexMap;
138138

139139
/// Returns current state of the DIEBuilder
140-
State &getState() { return *BuilderState.get(); }
140+
State &getState() { return *BuilderState; }
141141

142142
/// Resolve the reference in DIE, if target is not loaded into IR,
143143
/// pre-allocate it. \p RefCU will be updated to the Unit specific by \p

‎bolt/include/bolt/Passes/FrameAnalysis.h

Copy file name to clipboardExpand all lines: bolt/include/bolt/Passes/FrameAnalysis.h
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define BOLT_PASSES_FRAMEANALYSIS_H
1111

1212
#include "bolt/Passes/StackPointerTracking.h"
13+
#include <tuple>
1314

1415
namespace llvm {
1516
namespace bolt {
@@ -53,9 +54,7 @@ struct ArgInStackAccess {
5354
uint8_t Size;
5455

5556
bool operator<(const ArgInStackAccess &RHS) const {
56-
if (StackOffset != RHS.StackOffset)
57-
return StackOffset < RHS.StackOffset;
58-
return Size < RHS.Size;
57+
return std::tie(StackOffset, Size) < std::tie(RHS.StackOffset, RHS.Size);
5958
}
6059
};
6160

‎bolt/include/bolt/Passes/PAuthGadgetScanner.h

Copy file name to clipboardExpand all lines: bolt/include/bolt/Passes/PAuthGadgetScanner.h
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ struct MCInstInBBReference {
4343
return BB == RHS.BB && BBIndex == RHS.BBIndex;
4444
}
4545
bool operator<(const MCInstInBBReference &RHS) const {
46-
if (BB != RHS.BB)
47-
return BB < RHS.BB;
48-
return BBIndex < RHS.BBIndex;
46+
return std::tie(BB, BBIndex) < std::tie(RHS.BB, RHS.BBIndex);
4947
}
5048
operator MCInst &() const {
5149
assert(BB != nullptr);

‎bolt/include/bolt/Profile/DataReader.h

Copy file name to clipboardExpand all lines: bolt/include/bolt/Profile/DataReader.h
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,7 @@ struct BranchInfo {
9090
}
9191

9292
bool operator<(const BranchInfo &RHS) const {
93-
if (From < RHS.From)
94-
return true;
95-
96-
if (From == RHS.From)
97-
return (To < RHS.To);
98-
99-
return false;
93+
return std::tie(From, To) < std::tie(RHS.From, RHS.To);
10094
}
10195

10296
/// Merges branch and misprediction counts of \p BI with those of this object.
@@ -252,6 +246,9 @@ struct FuncSampleData {
252246
/// Get the number of samples recorded in [Start, End)
253247
uint64_t getSamples(uint64_t Start, uint64_t End) const;
254248

249+
/// Returns the total number of samples recorded in this function.
250+
uint64_t getSamples() const;
251+
255252
/// Aggregation helper
256253
DenseMap<uint64_t, size_t> Index;
257254

‎bolt/lib/Core/DIEBuilder.cpp

Copy file name to clipboardExpand all lines: bolt/lib/Core/DIEBuilder.cpp
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,10 @@ void DIEBuilder::buildTypeUnits(DebugStrOffsetsWriter *StrOffsetWriter,
292292

293293
getState().Type = ProcessingType::DWARF4TUs;
294294
for (std::unique_ptr<DWARFUnit> &DU : CU4TURanges)
295-
registerUnit(*DU.get(), false);
295+
registerUnit(*DU, false);
296296

297297
for (std::unique_ptr<DWARFUnit> &DU : CU4TURanges)
298-
constructFromUnit(*DU.get());
298+
constructFromUnit(*DU);
299299

300300
DWARFContext::unit_iterator_range CURanges =
301301
isDWO() ? DwarfContext->dwo_info_section_units()
@@ -308,7 +308,7 @@ void DIEBuilder::buildTypeUnits(DebugStrOffsetsWriter *StrOffsetWriter,
308308
for (std::unique_ptr<DWARFUnit> &DU : CURanges) {
309309
if (!DU->isTypeUnit())
310310
continue;
311-
registerUnit(*DU.get(), false);
311+
registerUnit(*DU, false);
312312
}
313313

314314
for (DWARFUnit *DU : getState().DWARF5TUVector) {
@@ -335,7 +335,7 @@ void DIEBuilder::buildCompileUnits(const bool Init) {
335335
for (std::unique_ptr<DWARFUnit> &DU : CURanges) {
336336
if (DU->isTypeUnit())
337337
continue;
338-
registerUnit(*DU.get(), false);
338+
registerUnit(*DU, false);
339339
}
340340

341341
// Using DULIst since it can be modified by cross CU refrence resolution.

‎bolt/lib/Core/DebugData.cpp

Copy file name to clipboardExpand all lines: bolt/lib/Core/DebugData.cpp
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ DebugRangesSectionWriter::DebugRangesSectionWriter() {
142142

143143
void DebugRangesSectionWriter::initSection() {
144144
// Adds an empty range to the buffer.
145-
writeAddressRanges(*RangesStream.get(), DebugAddressRangesVector{});
145+
writeAddressRanges(*RangesStream, DebugAddressRangesVector{});
146146
}
147147

148148
uint64_t DebugRangesSectionWriter::addRanges(
@@ -169,7 +169,7 @@ uint64_t DebugRangesSectionWriter::addRanges(DebugAddressRangesVector &Ranges) {
169169
// unique and correct offsets in patches.
170170
std::lock_guard<std::mutex> Lock(WriterMutex);
171171
const uint32_t EntryOffset = RangesBuffer->size();
172-
writeAddressRanges(*RangesStream.get(), Ranges);
172+
writeAddressRanges(*RangesStream, Ranges);
173173

174174
return EntryOffset;
175175
}
@@ -321,8 +321,8 @@ void DebugRangeListsSectionWriter::finalizeSection() {
321321
llvm::endianness::little);
322322

323323
std::unique_ptr<DebugBufferVector> Header = getDWARF5Header(
324-
{static_cast<uint32_t>(SizeOfArraySection + CUBodyBuffer.get()->size()),
325-
5, 8, 0, static_cast<uint32_t>(RangeEntries.size())});
324+
{static_cast<uint32_t>(SizeOfArraySection + CUBodyBuffer->size()), 5, 8,
325+
0, static_cast<uint32_t>(RangeEntries.size())});
326326
*RangesStream << *Header;
327327
*RangesStream << *CUArrayBuffer;
328328
*RangesStream << *CUBodyBuffer;
@@ -747,8 +747,8 @@ void DebugLoclistWriter::finalizeDWARF5(DIEBuilder &DIEBldr, DIE &Die) {
747747
llvm::endianness::little);
748748

749749
std::unique_ptr<DebugBufferVector> Header = getDWARF5Header(
750-
{static_cast<uint32_t>(SizeOfArraySection + LocBodyBuffer.get()->size()),
751-
5, 8, 0, NumberOfEntries});
750+
{static_cast<uint32_t>(SizeOfArraySection + LocBodyBuffer->size()), 5, 8,
751+
0, NumberOfEntries});
752752
*LocStream << *Header;
753753
*LocStream << *LocArrayBuffer;
754754
*LocStream << *LocBodyBuffer;

‎bolt/lib/Core/DebugNames.cpp

Copy file name to clipboardExpand all lines: bolt/lib/Core/DebugNames.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,8 +648,8 @@ void DWARF5AcceleratorTable::writeEntries() {
648648
if (const auto Iter = EntryRelativeOffsets.find(*ParentOffset);
649649
Iter != EntryRelativeOffsets.end()) {
650650
const uint64_t PatchOffset = Entry->getPatchOffset();
651-
uint32_t *Ptr = reinterpret_cast<uint32_t *>(
652-
&EntriesBuffer.get()->data()[PatchOffset]);
651+
uint32_t *Ptr =
652+
reinterpret_cast<uint32_t *>(&EntriesBuffer->data()[PatchOffset]);
653653
*Ptr = Iter->second;
654654
} else {
655655
BC.errs() << "BOLT-WARNING: [internal-dwarf-warning]: Could not find "

‎bolt/lib/Core/ParallelUtilities.cpp

Copy file name to clipboardExpand all lines: bolt/lib/Core/ParallelUtilities.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ inline unsigned estimateTotalCost(const BinaryContext &BC,
103103
} // namespace
104104

105105
ThreadPoolInterface &getThreadPool(const unsigned ThreadsCount) {
106-
if (ThreadPoolPtr.get())
106+
if (ThreadPoolPtr)
107107
return *ThreadPoolPtr;
108108

109109
if (ThreadsCount > 1)

‎bolt/lib/Passes/AsmDump.cpp

Copy file name to clipboardExpand all lines: bolt/lib/Passes/AsmDump.cpp
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void dumpFunction(const BinaryFunction &BF) {
175175
// Dump pseudo instructions (CFI)
176176
if (BC.MIB->isPseudo(Instr)) {
177177
if (BC.MIB->isCFI(Instr))
178-
dumpCFI(BF, Instr, *MAP.get());
178+
dumpCFI(BF, Instr, *MAP);
179179
continue;
180180
}
181181

@@ -227,7 +227,7 @@ void dumpFunction(const BinaryFunction &BF) {
227227
OS << "# Jump tables\n";
228228
// Print all jump tables.
229229
for (auto &JTI : BF.jumpTables())
230-
dumpJumpTableSymbols(OS, JTI.second, *MAP.get(), LastSection);
230+
dumpJumpTableSymbols(OS, JTI.second, *MAP, LastSection);
231231

232232
OS << "# BinaryData\n";
233233
// Print data references.

‎bolt/lib/Passes/RetpolineInsertion.cpp

Copy file name to clipboardExpand all lines: bolt/lib/Passes/RetpolineInsertion.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ BinaryFunction *createNewRetpoline(BinaryContext &BC,
7878
const IndirectBranchInfo &BrInfo,
7979
bool R11Available) {
8080
auto &MIB = *BC.MIB;
81-
MCContext &Ctx = *BC.Ctx.get();
81+
MCContext &Ctx = *BC.Ctx;
8282
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: Creating a new retpoline function["
8383
<< RetpolineTag << "]\n");
8484

‎bolt/lib/Profile/DataAggregator.cpp

Copy file name to clipboardExpand all lines: bolt/lib/Profile/DataAggregator.cpp
+15-10Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,6 @@ bool DataAggregator::checkPerfDataMagic(StringRef FileName) {
350350
}
351351

352352
void DataAggregator::parsePreAggregated() {
353-
std::string Error;
354-
355353
ErrorOr<std::unique_ptr<MemoryBuffer>> MB =
356354
MemoryBuffer::getFileOrSTDIN(Filename);
357355
if (std::error_code EC = MB.getError()) {
@@ -567,15 +565,14 @@ void DataAggregator::processProfile(BinaryContext &BC) {
567565
processMemEvents();
568566

569567
// Mark all functions with registered events as having a valid profile.
570-
const auto Flags = opts::BasicAggregation ? BinaryFunction::PF_SAMPLE
571-
: BinaryFunction::PF_LBR;
572568
for (auto &BFI : BC.getBinaryFunctions()) {
573569
BinaryFunction &BF = BFI.second;
574-
FuncBranchData *FBD = getBranchData(BF);
575-
if (FBD || getFuncSampleData(BF.getNames())) {
576-
BF.markProfiled(Flags);
577-
if (FBD)
578-
BF.RawBranchCount = FBD->getNumExecutedBranches();
570+
if (FuncBranchData *FBD = getBranchData(BF)) {
571+
BF.markProfiled(BinaryFunction::PF_LBR);
572+
BF.RawBranchCount = FBD->getNumExecutedBranches();
573+
} else if (FuncSampleData *FSD = getFuncSampleData(BF.getNames())) {
574+
BF.markProfiled(BinaryFunction::PF_SAMPLE);
575+
BF.RawBranchCount = FSD->getSamples();
579576
}
580577
}
581578

@@ -632,10 +629,18 @@ StringRef DataAggregator::getLocationName(const BinaryFunction &Func,
632629

633630
bool DataAggregator::doSample(BinaryFunction &OrigFunc, uint64_t Address,
634631
uint64_t Count) {
632+
// To record executed bytes, use basic block size as is regardless of BAT.
633+
uint64_t BlockSize = 0;
634+
if (BinaryBasicBlock *BB = OrigFunc.getBasicBlockContainingOffset(
635+
Address - OrigFunc.getAddress()))
636+
BlockSize = BB->getOriginalSize();
637+
635638
BinaryFunction *ParentFunc = getBATParentFunction(OrigFunc);
636639
BinaryFunction &Func = ParentFunc ? *ParentFunc : OrigFunc;
637-
if (ParentFunc || (BAT && !BAT->isBATFunction(OrigFunc.getAddress())))
640+
if (ParentFunc || (BAT && !BAT->isBATFunction(Func.getAddress())))
638641
NumColdSamples += Count;
642+
// Attach executed bytes to parent function in case of cold fragment.
643+
Func.SampleCountInBytes += Count * BlockSize;
639644

640645
auto I = NamesToSamples.find(Func.getOneName());
641646
if (I == NamesToSamples.end()) {

‎bolt/lib/Profile/DataReader.cpp

Copy file name to clipboardExpand all lines: bolt/lib/Profile/DataReader.cpp
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ uint64_t FuncSampleData::getSamples(uint64_t Start, uint64_t End) const {
128128
return Result;
129129
}
130130

131+
uint64_t FuncSampleData::getSamples() const {
132+
uint64_t Result = 0;
133+
for (const SampleInfo &I : Data)
134+
Result += I.Hits;
135+
return Result;
136+
}
137+
131138
void FuncSampleData::bumpCount(uint64_t Offset, uint64_t Count) {
132139
auto Iter = Index.find(Offset);
133140
if (Iter == Index.end()) {
@@ -1028,9 +1035,8 @@ ErrorOr<SampleInfo> DataReader::parseSampleInfo() {
10281035
}
10291036

10301037
ErrorOr<bool> DataReader::maybeParseNoLBRFlag() {
1031-
if (ParsingBuf.size() < 6 || ParsingBuf.substr(0, 6) != "no_lbr")
1038+
if (!ParsingBuf.consume_front("no_lbr"))
10321039
return false;
1033-
ParsingBuf = ParsingBuf.drop_front(6);
10341040
Col += 6;
10351041

10361042
if (ParsingBuf.size() > 0 && ParsingBuf[0] == ' ')
@@ -1051,9 +1057,8 @@ ErrorOr<bool> DataReader::maybeParseNoLBRFlag() {
10511057
}
10521058

10531059
ErrorOr<bool> DataReader::maybeParseBATFlag() {
1054-
if (ParsingBuf.size() < 16 || ParsingBuf.substr(0, 16) != "boltedcollection")
1060+
if (!ParsingBuf.consume_front("boltedcollection"))
10551061
return false;
1056-
ParsingBuf = ParsingBuf.drop_front(16);
10571062
Col += 16;
10581063

10591064
if (!checkAndConsumeNewLine()) {

‎bolt/lib/Rewrite/BuildIDRewriter.cpp

Copy file name to clipboardExpand all lines: bolt/lib/Rewrite/BuildIDRewriter.cpp
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ Error BuildIDRewriter::sectionInitializer() {
7878
"out of bounds while reading note section: %s",
7979
toString(Cursor.takeError()).c_str());
8080

81-
if (Type == ELF::NT_GNU_BUILD_ID && Name.substr(0, 3) == "GNU" &&
82-
DescSz) {
81+
if (Type == ELF::NT_GNU_BUILD_ID && Name.starts_with("GNU") && DescSz) {
8382
BuildIDSection = NoteSection;
8483
BuildID = Desc;
8584
BC.setFileBuildID(getPrintableBuildID(Desc));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.