Skip to content

Commit d7219d2

Browse files
committed
rebase
Created using spr 1.3.4
2 parents d3e184e + b71ea8f commit d7219d2

File tree

1,979 files changed

+116256
-30527
lines changed

Some content is hidden

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

1,979 files changed

+116256
-30527
lines changed

.github/new-prs-labeler.yml

Lines 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/**

CONTRIBUTING.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ describes how to get involved, raise issues and submit patches.
99

1010
## Getting in touch
1111

12-
Join the [LLVM Discourse forums](https://discourse.llvm.org/), [Discord
13-
chat](https://discord.gg/xS7Z362), or #llvm IRC channel on
14-
[OFTC](https://oftc.net/).
12+
Join the [LLVM Discourse forums](https://discourse.llvm.org/) or [Discord
13+
chat](https://discord.gg/xS7Z362).
1514

1615
The LLVM project has adopted a [code of conduct](https://llvm.org/docs/CodeOfConduct.html) for
1716
participants to all modes of communication within the project.

bolt/Maintainers.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ what goes in or not.
55

66
The list is sorted by surname and formatted to allow easy grepping and
77
beautification by scripts. The fields are: name (N), email (E), web-address
8-
(W), PGP key ID and fingerprint (P), description (D), snail-mail address
9-
(S) and (I) IRC handle. Each entry should contain at least the (N), (E) and
10-
(D) fields.
8+
(W), PGP key ID and fingerprint (P), and description (D). Each entry should
9+
contain at least the (N), (E) and (D) fields.
1110

1211
N: Maksim Panchenko, Rafael Auler
1312

bolt/include/bolt/Core/BinaryContext.h

Lines 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

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class BinaryFunction {
143143
enum {
144144
PF_NONE = 0, /// No profile.
145145
PF_LBR = 1, /// Profile is based on last branch records.
146-
PF_SAMPLE = 2, /// Non-LBR sample-based profile.
146+
PF_IP = 2, /// Non-LBR sample-based profile.
147147
PF_MEMEVENT = 4, /// Profile has mem events.
148148
};
149149

@@ -360,6 +360,11 @@ class BinaryFunction {
360360
/// True if the function is used for patching code at a fixed address.
361361
bool IsPatch{false};
362362

363+
/// True if the original entry point of the function may get called, but the
364+
/// original body cannot be executed and needs to be patched with code that
365+
/// redirects execution to the new function body.
366+
bool NeedsPatch{false};
367+
363368
/// True if the function should not have an associated symbol table entry.
364369
bool IsAnonymous{false};
365370

@@ -386,7 +391,7 @@ class BinaryFunction {
386391
/// Profile match ratio.
387392
float ProfileMatchRatio{0.0f};
388393

389-
/// Raw sample/branch count for this function in the profile.
394+
/// Raw branch count for this function in the profile.
390395
uint64_t RawSampleCount{0};
391396

392397
/// Dynamically executed function bytes, used for density computation.
@@ -862,15 +867,15 @@ class BinaryFunction {
862867
/// Returns if BinaryDominatorTree has been constructed for this function.
863868
bool hasDomTree() const { return BDT != nullptr; }
864869

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

867872
/// Constructs DomTree for this function.
868873
void constructDomTree();
869874

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

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

875880
bool isLoopFree() {
876881
if (!hasLoopInfo())
@@ -1372,6 +1377,9 @@ class BinaryFunction {
13721377
/// Return true if this function is used for patching existing code.
13731378
bool isPatch() const { return IsPatch; }
13741379

1380+
/// Return true if the function requires a patch.
1381+
bool needsPatch() const { return NeedsPatch; }
1382+
13751383
/// Return true if the function should not have associated symbol table entry.
13761384
bool isAnonymous() const { return IsAnonymous; }
13771385

@@ -1757,6 +1765,9 @@ class BinaryFunction {
17571765
IsPatch = V;
17581766
}
17591767

1768+
/// Mark the function for patching.
1769+
void setNeedsPatch(bool V) { NeedsPatch = V; }
1770+
17601771
/// Indicate if the function should have a name in the symbol table.
17611772
void setAnonymous(bool V) {
17621773
assert(isInjected() && "Only injected functions could be anonymous");
@@ -1880,11 +1891,12 @@ class BinaryFunction {
18801891
/// Return COUNT_NO_PROFILE if there's no profile info.
18811892
uint64_t getExecutionCount() const { return ExecutionCount; }
18821893

1883-
/// Return the raw profile information about the number of samples (basic
1884-
/// profile) or branch executions (branch profile) recorded in this function.
1894+
/// Return the raw profile information about the number of branch
1895+
/// executions corresponding to this function.
18851896
uint64_t getRawSampleCount() const { return RawSampleCount; }
18861897

1887-
/// Set raw count of samples or branches recorded in this function.
1898+
/// Set the profile data about the number of branch executions corresponding
1899+
/// to this function.
18881900
void setRawSampleCount(uint64_t Count) { RawSampleCount = Count; }
18891901

18901902
/// Return the number of dynamically executed bytes, from raw perf data.

bolt/include/bolt/Core/DIEBuilder.h

Lines 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

Lines 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

Lines 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/DataAggregator.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ class DataAggregator : public DataReader {
246246

247247
/// Semantic actions - parser hooks to interpret parsed perf samples
248248
/// Register a sample (non-LBR mode), i.e. a new hit at \p Address
249-
bool doSample(BinaryFunction &Func, const uint64_t Address, uint64_t Count);
249+
bool doBasicSample(BinaryFunction &Func, const uint64_t Address,
250+
uint64_t Count);
250251

251252
/// Register an intraprocedural branch \p Branch.
252253
bool doIntraBranch(BinaryFunction &Func, uint64_t From, uint64_t To,
@@ -405,7 +406,11 @@ class DataAggregator : public DataReader {
405406
/// F 41be90 41be90 4
406407
/// B 4b1942 39b57f0 3 0
407408
/// B 4b196f 4b19e0 2 0
408-
std::error_code parsePreAggregated();
409+
void parsePreAggregated();
410+
411+
/// Parse the full output of pre-aggregated LBR samples generated by
412+
/// an external tool.
413+
std::error_code parsePreAggregatedLBRSamples();
409414

410415
/// If \p Address falls into the binary address space based on memory
411416
/// mapping info \p MMI, then adjust it for further processing by subtracting

bolt/include/bolt/Profile/DataReader.h

Lines changed: 16 additions & 20 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.
@@ -218,15 +212,16 @@ struct FuncMemData {
218212
/// Similar to BranchInfo, but instead of recording from-to address (an edge),
219213
/// it records the address of a perf event and the number of times samples hit
220214
/// this address.
221-
struct SampleInfo {
215+
struct BasicSampleInfo {
222216
Location Loc;
223217
int64_t Hits;
224218

225-
SampleInfo(Location Loc, int64_t Hits) : Loc(std::move(Loc)), Hits(Hits) {}
219+
BasicSampleInfo(Location Loc, int64_t Hits)
220+
: Loc(std::move(Loc)), Hits(Hits) {}
226221

227-
bool operator==(const SampleInfo &RHS) const { return Loc == RHS.Loc; }
222+
bool operator==(const BasicSampleInfo &RHS) const { return Loc == RHS.Loc; }
228223

229-
bool operator<(const SampleInfo &RHS) const {
224+
bool operator<(const BasicSampleInfo &RHS) const {
230225
if (Loc < RHS.Loc)
231226
return true;
232227

@@ -235,18 +230,18 @@ struct SampleInfo {
235230

236231
void print(raw_ostream &OS) const;
237232

238-
void mergeWith(const SampleInfo &SI);
233+
void mergeWith(const BasicSampleInfo &SI);
239234
};
240235

241236
/// Helper class to store samples recorded in the address space of a given
242237
/// function, analogous to FuncBranchData but for samples instead of branches.
243-
struct FuncSampleData {
244-
typedef std::vector<SampleInfo> ContainerTy;
238+
struct FuncBasicSampleData {
239+
typedef std::vector<BasicSampleInfo> ContainerTy;
245240

246241
StringRef Name;
247242
ContainerTy Data;
248243

249-
FuncSampleData(StringRef Name, ContainerTy Data)
244+
FuncBasicSampleData(StringRef Name, ContainerTy Data)
250245
: Name(Name), Data(std::move(Data)) {}
251246

252247
/// Get the number of samples recorded in [Start, End)
@@ -314,7 +309,7 @@ class DataReader : public ProfileReaderBase {
314309
/// The last step is to infer edge counts based on BB execution count. Note
315310
/// this is the opposite of the LBR way, where we infer BB execution count
316311
/// based on edge counts.
317-
void readSampleData(BinaryFunction &BF);
312+
void readBasicSampleData(BinaryFunction &BF);
318313

319314
/// Convert function-level branch data into instruction annotations.
320315
void convertBranchData(BinaryFunction &BF) const;
@@ -388,7 +383,8 @@ class DataReader : public ProfileReaderBase {
388383
/// Return mem data matching one of the names in \p FuncNames.
389384
FuncMemData *getMemDataForNames(const std::vector<StringRef> &FuncNames);
390385

391-
FuncSampleData *getFuncSampleData(const std::vector<StringRef> &FuncNames);
386+
FuncBasicSampleData *
387+
getFuncBasicSampleData(const std::vector<StringRef> &FuncNames);
392388

393389
/// Return a vector of all FuncBranchData matching the list of names.
394390
/// Internally use fuzzy matching to match special names like LTO-generated
@@ -431,7 +427,7 @@ class DataReader : public ProfileReaderBase {
431427
}
432428

433429
using NamesToBranchesMapTy = std::map<StringRef, FuncBranchData>;
434-
using NamesToSamplesMapTy = std::map<StringRef, FuncSampleData>;
430+
using NamesToBasicSamplesMapTy = std::map<StringRef, FuncBasicSampleData>;
435431
using NamesToMemEventsMapTy = std::map<StringRef, FuncMemData>;
436432
using FuncsToBranchesMapTy =
437433
std::unordered_map<const BinaryFunction *, FuncBranchData *>;
@@ -480,7 +476,7 @@ class DataReader : public ProfileReaderBase {
480476
return parseLocation(EndChar, EndNl, true);
481477
}
482478
ErrorOr<BranchInfo> parseBranchInfo();
483-
ErrorOr<SampleInfo> parseSampleInfo();
479+
ErrorOr<BasicSampleInfo> parseSampleInfo();
484480
ErrorOr<MemInfo> parseMemInfo();
485481
ErrorOr<bool> maybeParseNoLBRFlag();
486482
ErrorOr<bool> maybeParseBATFlag();
@@ -494,7 +490,7 @@ class DataReader : public ProfileReaderBase {
494490
unsigned Line{0};
495491
unsigned Col{0};
496492
NamesToBranchesMapTy NamesToBranches;
497-
NamesToSamplesMapTy NamesToSamples;
493+
NamesToBasicSamplesMapTy NamesToBasicSamples;
498494
NamesToMemEventsMapTy NamesToMemEvents;
499495
FuncsToBranchesMapTy FuncsToBranches;
500496
FuncsToMemDataMapTy FuncsToMemData;

0 commit comments

Comments
 (0)