Skip to content

Commit 58af11e

Browse files
authored
Merge branch 'main' into vector-combine/scalarizeBinOpOfSplats-insertelement-cost
2 parents 269892a + d39ca81 commit 58af11e

File tree

2,605 files changed

+144704
-39146
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,605 files changed

+144704
-39146
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: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

@@ -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");

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: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,6 @@ class DataAggregator : public DataReader {
197197

198198
BoltAddressTranslation *BAT{nullptr};
199199

200-
/// Whether pre-aggregated profile needs to convert branch profile into call
201-
/// to continuation fallthrough profile.
202-
bool NeedsConvertRetProfileToCallCont{false};
203-
204200
/// Update function execution profile with a recorded trace.
205201
/// A trace is region of code executed between two LBR entries supplied in
206202
/// execution order.

bolt/include/bolt/Profile/DataReader.h

Lines 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/include/bolt/Utils/CommandLineOpts.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ extern llvm::cl::opt<unsigned> AlignText;
3434
extern llvm::cl::opt<unsigned> AlignFunctions;
3535
extern llvm::cl::opt<bool> AggregateOnly;
3636
extern llvm::cl::opt<unsigned> BucketsPerLine;
37+
extern llvm::cl::opt<bool> CompactCodeModel;
3738
extern llvm::cl::opt<bool> DiffOnly;
3839
extern llvm::cl::opt<bool> EnableBAT;
3940
extern llvm::cl::opt<bool> EqualizeBBCounts;

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,8 +1797,6 @@ bool BinaryFunction::scanExternalRefs() {
17971797
// Create relocation for every fixup.
17981798
for (const MCFixup &Fixup : Fixups) {
17991799
std::optional<Relocation> Rel = BC.MIB->createRelocation(Fixup, *BC.MAB);
1800-
// Can be skipped in case of overlow during relocation value encoding.
1801-
Rel->setOptional();
18021800
if (!Rel) {
18031801
Success = false;
18041802
continue;
@@ -1814,6 +1812,17 @@ bool BinaryFunction::scanExternalRefs() {
18141812
Success = false;
18151813
continue;
18161814
}
1815+
1816+
if (BC.isAArch64()) {
1817+
// Allow the relocation to be skipped in case of the overflow during the
1818+
// relocation value encoding.
1819+
Rel->setOptional();
1820+
1821+
if (!opts::CompactCodeModel)
1822+
if (BinaryFunction *TargetBF = BC.getFunctionForSymbol(Rel->Symbol))
1823+
TargetBF->setNeedsPatch(true);
1824+
}
1825+
18171826
Rel->Offset += getAddress() - getOriginSection()->getAddress() + Offset;
18181827
FunctionRelocations.push_back(*Rel);
18191828
}

bolt/lib/Core/BinarySection.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,6 @@ void BinarySection::flushPendingRelocations(raw_pwrite_stream &OS,
186186
!Relocation::canEncodeValue(Reloc.Type, Value,
187187
SectionAddress + Reloc.Offset)) {
188188

189-
// A successful run of 'scanExternalRefs' means that all pending
190-
// relocations are flushed. Otherwise, PatchEntries should run.
191-
if (!opts::ForcePatch) {
192-
BC.errs()
193-
<< "BOLT-ERROR: cannot encode relocation for symbol "
194-
<< Reloc.Symbol->getName()
195-
<< " as it is out-of-range. To proceed must use -force-patch\n";
196-
exit(1);
197-
}
198-
199189
++SkippedPendingRelocations;
200190
continue;
201191
}

bolt/lib/Core/DIEBuilder.cpp

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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/LongJmp.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "bolt/Passes/LongJmp.h"
1414
#include "bolt/Core/ParallelUtilities.h"
15+
#include "bolt/Utils/CommandLineOpts.h"
1516
#include "llvm/Support/MathExtras.h"
1617

1718
#define DEBUG_TYPE "longjmp"
@@ -26,11 +27,6 @@ extern cl::opt<unsigned> AlignFunctions;
2627
extern cl::opt<bool> UseOldText;
2728
extern cl::opt<bool> HotFunctionsAtEnd;
2829

29-
static cl::opt<bool>
30-
CompactCodeModel("compact-code-model",
31-
cl::desc("generate code for binaries <128MB on AArch64"),
32-
cl::init(false), cl::cat(BoltCategory));
33-
3430
static cl::opt<bool> GroupStubs("group-stubs",
3531
cl::desc("share stubs across functions"),
3632
cl::init(true), cl::cat(BoltOptCategory));

0 commit comments

Comments
 (0)