Skip to content

Commit ca5ea1b

Browse files
committed
Merge branch 'main' into Fix_bug_issue_134916
2 parents d254fc8 + 3a81979 commit ca5ea1b

File tree

2,546 files changed

+836063
-267900
lines changed

Some content is hidden

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

2,546 files changed

+836063
-267900
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/**

.github/workflows/containers/github-action-ci-windows/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ RUN choco install -y handle
108108
109109
RUN pip3 install pywin32 buildbot-worker==2.8.4
110110
111-
ARG RUNNER_VERSION=2.323.0
111+
ARG RUNNER_VERSION=2.324.0
112112
ENV RUNNER_VERSION=$RUNNER_VERSION
113113
114114
RUN powershell -Command \

.github/workflows/containers/github-action-ci/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM docker.io/library/ubuntu:24.04 as base
22
ENV LLVM_SYSROOT=/opt/llvm
33

44
FROM base as stage1-toolchain
5-
ENV LLVM_VERSION=20.1.1
5+
ENV LLVM_VERSION=20.1.4
66

77
RUN apt-get update && \
88
apt-get install -y \
@@ -86,7 +86,7 @@ WORKDIR /home/gha
8686

8787
FROM ci-container as ci-container-agent
8888

89-
ENV GITHUB_RUNNER_VERSION=2.323.0
89+
ENV GITHUB_RUNNER_VERSION=2.324.0
9090

9191
RUN mkdir actions-runner && \
9292
cd actions-runner && \

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: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ class BinaryFunction {
142142
/// Types of profile the function can use. Could be a combination.
143143
enum {
144144
PF_NONE = 0, /// No profile.
145-
PF_LBR = 1, /// Profile is based on last branch records.
146-
PF_SAMPLE = 2, /// Non-LBR sample-based profile.
145+
PF_BRANCH = 1, /// Profile is based on branches or branch stacks.
146+
PF_BASIC = 2, /// Non-branch IP sample-based profile.
147147
PF_MEMEVENT = 4, /// Profile has mem events.
148148
};
149149

@@ -392,7 +392,7 @@ class BinaryFunction {
392392
float ProfileMatchRatio{0.0f};
393393

394394
/// Raw branch count for this function in the profile.
395-
uint64_t RawBranchCount{0};
395+
uint64_t RawSampleCount{0};
396396

397397
/// Dynamically executed function bytes, used for density computation.
398398
uint64_t SampleCountInBytes{0};
@@ -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())
@@ -1893,11 +1893,11 @@ class BinaryFunction {
18931893

18941894
/// Return the raw profile information about the number of branch
18951895
/// executions corresponding to this function.
1896-
uint64_t getRawBranchCount() const { return RawBranchCount; }
1896+
uint64_t getRawSampleCount() const { return RawSampleCount; }
18971897

18981898
/// Set the profile data about the number of branch executions corresponding
18991899
/// to this function.
1900-
void setRawBranchCount(uint64_t Count) { RawBranchCount = Count; }
1900+
void setRawSampleCount(uint64_t Count) { RawSampleCount = Count; }
19011901

19021902
/// Return the number of dynamically executed bytes, from raw perf data.
19031903
uint64_t getSampleCountInBytes() const { return SampleCountInBytes; }

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: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,6 @@ class DataAggregator : public DataReader {
9292
uint64_t Addr;
9393
};
9494

95-
/// Used for parsing specific pre-aggregated input files.
96-
struct AggregatedLBREntry {
97-
enum Type : char { BRANCH = 0, FT, FT_EXTERNAL_ORIGIN, TRACE };
98-
Location From;
99-
Location To;
100-
uint64_t Count;
101-
uint64_t Mispreds;
102-
Type EntryType;
103-
};
104-
10595
struct Trace {
10696
uint64_t From;
10797
uint64_t To;
@@ -131,7 +121,6 @@ class DataAggregator : public DataReader {
131121
/// and use them later for processing and assigning profile.
132122
std::unordered_map<Trace, TakenBranchInfo, TraceHash> BranchLBRs;
133123
std::unordered_map<Trace, FTInfo, TraceHash> FallthroughLBRs;
134-
std::vector<AggregatedLBREntry> AggregatedLBRs;
135124
std::unordered_map<uint64_t, uint64_t> BasicSamples;
136125
std::vector<PerfMemSample> MemSamples;
137126

@@ -223,11 +212,6 @@ class DataAggregator : public DataReader {
223212
uint64_t NumTraces{0};
224213
uint64_t NumInvalidTraces{0};
225214
uint64_t NumLongRangeTraces{0};
226-
/// Specifies how many samples were recorded in cold areas if we are dealing
227-
/// with profiling data collected in a bolted binary. For LBRs, incremented
228-
/// for the source of the branch to avoid counting cold activity twice (one
229-
/// for source and another for destination).
230-
uint64_t NumColdSamples{0};
231215
uint64_t NumTotalSamples{0};
232216

233217
/// Looks into system PATH for Linux Perf and set up the aggregator to use it
@@ -257,7 +241,8 @@ class DataAggregator : public DataReader {
257241

258242
/// Semantic actions - parser hooks to interpret parsed perf samples
259243
/// Register a sample (non-LBR mode), i.e. a new hit at \p Address
260-
bool doSample(BinaryFunction &Func, const uint64_t Address, uint64_t Count);
244+
bool doBasicSample(BinaryFunction &Func, const uint64_t Address,
245+
uint64_t Count);
261246

262247
/// Register an intraprocedural branch \p Branch.
263248
bool doIntraBranch(BinaryFunction &Func, uint64_t From, uint64_t To,
@@ -422,9 +407,6 @@ class DataAggregator : public DataReader {
422407
/// an external tool.
423408
std::error_code parsePreAggregatedLBRSamples();
424409

425-
/// Process parsed pre-aggregated data.
426-
void processPreAggregated();
427-
428410
/// If \p Address falls into the binary address space based on memory
429411
/// mapping info \p MMI, then adjust it for further processing by subtracting
430412
/// the base load address. External addresses, i.e. addresses that do not
@@ -486,7 +468,6 @@ class DataAggregator : public DataReader {
486468
void dump(const PerfMemSample &Sample) const;
487469

488470
/// Profile diagnostics print methods
489-
void printColdSamplesDiagnostic() const;
490471
void printLongRangeTracesDiagnostic() const;
491472
void printBranchSamplesDiagnostics() const;
492473
void printBasicSamplesDiagnostics(uint64_t OutOfRangeSamples) const;

bolt/include/bolt/Profile/DataReader.h

Lines changed: 19 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,23 +230,26 @@ 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)
253248
uint64_t getSamples(uint64_t Start, uint64_t End) const;
254249

250+
/// Returns the total number of samples recorded in this function.
251+
uint64_t getSamples() const;
252+
255253
/// Aggregation helper
256254
DenseMap<uint64_t, size_t> Index;
257255

@@ -311,7 +309,7 @@ class DataReader : public ProfileReaderBase {
311309
/// The last step is to infer edge counts based on BB execution count. Note
312310
/// this is the opposite of the LBR way, where we infer BB execution count
313311
/// based on edge counts.
314-
void readSampleData(BinaryFunction &BF);
312+
void readBasicSampleData(BinaryFunction &BF);
315313

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

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

390389
/// Return a vector of all FuncBranchData matching the list of names.
391390
/// Internally use fuzzy matching to match special names like LTO-generated
@@ -428,7 +427,7 @@ class DataReader : public ProfileReaderBase {
428427
}
429428

430429
using NamesToBranchesMapTy = std::map<StringRef, FuncBranchData>;
431-
using NamesToSamplesMapTy = std::map<StringRef, FuncSampleData>;
430+
using NamesToBasicSamplesMapTy = std::map<StringRef, FuncBasicSampleData>;
432431
using NamesToMemEventsMapTy = std::map<StringRef, FuncMemData>;
433432
using FuncsToBranchesMapTy =
434433
std::unordered_map<const BinaryFunction *, FuncBranchData *>;
@@ -477,7 +476,7 @@ class DataReader : public ProfileReaderBase {
477476
return parseLocation(EndChar, EndNl, true);
478477
}
479478
ErrorOr<BranchInfo> parseBranchInfo();
480-
ErrorOr<SampleInfo> parseSampleInfo();
479+
ErrorOr<BasicSampleInfo> parseSampleInfo();
481480
ErrorOr<MemInfo> parseMemInfo();
482481
ErrorOr<bool> maybeParseNoLBRFlag();
483482
ErrorOr<bool> maybeParseBATFlag();
@@ -491,7 +490,7 @@ class DataReader : public ProfileReaderBase {
491490
unsigned Line{0};
492491
unsigned Col{0};
493492
NamesToBranchesMapTy NamesToBranches;
494-
NamesToSamplesMapTy NamesToSamples;
493+
NamesToBasicSamplesMapTy NamesToBasicSamples;
495494
NamesToMemEventsMapTy NamesToMemEvents;
496495
FuncsToBranchesMapTy FuncsToBranches;
497496
FuncsToMemDataMapTy FuncsToMemData;

bolt/include/bolt/Profile/Heatmap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ class Heatmap {
5757
}
5858

5959
/// Register a single sample at \p Address.
60-
void registerAddress(uint64_t Address) {
60+
void registerAddress(uint64_t Address, uint64_t Count) {
6161
if (!ignoreAddress(Address))
62-
++Map[Address / BucketSize];
62+
Map[Address / BucketSize] += Count;
6363
}
6464

6565
/// Register \p Count samples at [\p StartAddress, \p EndAddress ].

bolt/include/bolt/Profile/ProfileYAMLMapping.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ LLVM_YAML_STRONG_TYPEDEF(uint16_t, PROFILE_PF)
230230

231231
template <> struct ScalarBitSetTraits<PROFILE_PF> {
232232
static void bitset(IO &io, PROFILE_PF &value) {
233-
io.bitSetCase(value, "lbr", BinaryFunction::PF_LBR);
234-
io.bitSetCase(value, "sample", BinaryFunction::PF_SAMPLE);
233+
io.bitSetCase(value, "lbr", BinaryFunction::PF_BRANCH);
234+
io.bitSetCase(value, "sample", BinaryFunction::PF_BASIC);
235235
io.bitSetCase(value, "memevent", BinaryFunction::PF_MEMEVENT);
236236
}
237237
};

bolt/include/bolt/Utils/CommandLineOpts.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@
1717

1818
namespace opts {
1919

20-
extern bool HeatmapMode;
20+
enum HeatmapModeKind {
21+
HM_None = 0,
22+
HM_Exclusive, // llvm-bolt-heatmap
23+
HM_Optional // perf2bolt --heatmap
24+
};
25+
26+
extern HeatmapModeKind HeatmapMode;
2127
extern bool BinaryAnalysisMode;
2228

2329
extern llvm::cl::OptionCategory BoltCategory;
@@ -45,6 +51,7 @@ extern llvm::cl::opt<unsigned> HeatmapBlock;
4551
extern llvm::cl::opt<unsigned long long> HeatmapMaxAddress;
4652
extern llvm::cl::opt<unsigned long long> HeatmapMinAddress;
4753
extern llvm::cl::opt<bool> HeatmapPrintMappings;
54+
extern llvm::cl::opt<std::string> HeatmapOutput;
4855
extern llvm::cl::opt<bool> HotData;
4956
extern llvm::cl::opt<bool> HotFunctionsAtEnd;
5057
extern llvm::cl::opt<bool> HotText;

0 commit comments

Comments
 (0)