Skip to content

Commit 75cca03

Browse files
authored
merge main into amd-staging (llvm#1032)
2 parents e753652 + 50395c5 commit 75cca03

File tree

293 files changed

+9369
-2424
lines changed

Some content is hidden

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

293 files changed

+9369
-2424
lines changed

bolt/lib/Core/BinaryContext.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ using namespace llvm;
4646

4747
namespace opts {
4848

49-
cl::opt<bool> NoHugePages("no-huge-pages",
50-
cl::desc("use regular size pages for code alignment"),
51-
cl::Hidden, cl::cat(BoltCategory));
49+
static cl::opt<bool>
50+
NoHugePages("no-huge-pages",
51+
cl::desc("use regular size pages for code alignment"),
52+
cl::Hidden, cl::cat(BoltCategory));
5253

5354
static cl::opt<bool>
5455
PrintDebugInfo("print-debug-info",

bolt/lib/Core/BinaryData.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace opts {
2424
extern cl::OptionCategory BoltCategory;
2525
extern cl::opt<unsigned> Verbosity;
2626

27-
cl::opt<bool>
27+
static cl::opt<bool>
2828
PrintSymbolAliases("print-aliases",
2929
cl::desc("print aliases when printing objects"),
3030
cl::Hidden, cl::cat(BoltCategory));

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ extern cl::opt<unsigned> Verbosity;
6767

6868
extern bool processAllFunctions();
6969

70-
cl::opt<bool> CheckEncoding(
70+
static cl::opt<bool> CheckEncoding(
7171
"check-encoding",
7272
cl::desc("perform verification of LLVM instruction encoding/decoding. "
7373
"Every instruction in the input is decoded and re-encoded. "
@@ -144,14 +144,11 @@ cl::opt<bool>
144144
cl::desc("print time spent constructing binary functions"),
145145
cl::Hidden, cl::cat(BoltCategory));
146146

147-
cl::opt<bool>
148-
TrapOnAVX512("trap-avx512",
149-
cl::desc("in relocation mode trap upon entry to any function that uses "
150-
"AVX-512 instructions"),
151-
cl::init(false),
152-
cl::ZeroOrMore,
153-
cl::Hidden,
154-
cl::cat(BoltCategory));
147+
static cl::opt<bool> TrapOnAVX512(
148+
"trap-avx512",
149+
cl::desc("in relocation mode trap upon entry to any function that uses "
150+
"AVX-512 instructions"),
151+
cl::init(false), cl::ZeroOrMore, cl::Hidden, cl::cat(BoltCategory));
155152

156153
bool shouldPrint(const BinaryFunction &Function) {
157154
if (Function.isIgnored())

bolt/lib/Core/Relocation.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -271,22 +271,11 @@ static bool skipRelocationProcessAArch64(uint64_t &Type, uint64_t Contents) {
271271
return (Contents & 0xfc000000) == 0x14000000;
272272
};
273273

274-
auto IsAdr = [](uint64_t Contents) -> bool {
275-
// The bits 31-24 are 0b0xx10000
276-
return (Contents & 0x9f000000) == 0x10000000;
277-
};
278-
279274
auto IsAddImm = [](uint64_t Contents) -> bool {
280275
// The bits 30-23 are 0b00100010
281276
return (Contents & 0x7F800000) == 0x11000000;
282277
};
283278

284-
auto IsNop = [](uint64_t Contents) -> bool { return Contents == 0xd503201f; };
285-
286-
// The linker might eliminate the instruction and replace it with NOP, ignore
287-
if (IsNop(Contents))
288-
return true;
289-
290279
// The linker might relax ADRP+LDR instruction sequence for loading symbol
291280
// address from GOT table to ADRP+ADD sequence that would point to the
292281
// binary-local symbol. Change relocation type in order to process it right.
@@ -332,18 +321,6 @@ static bool skipRelocationProcessAArch64(uint64_t &Type, uint64_t Contents) {
332321
}
333322
}
334323

335-
// The linker might relax ADRP+ADD or ADRP+LDR sequences to the ADR+NOP
336-
switch (Type) {
337-
default:
338-
break;
339-
case ELF::R_AARCH64_ADR_PREL_PG_HI21:
340-
case ELF::R_AARCH64_ADD_ABS_LO12_NC:
341-
case ELF::R_AARCH64_ADR_GOT_PAGE:
342-
case ELF::R_AARCH64_LD64_GOT_LO12_NC:
343-
if (IsAdr(Contents))
344-
return true;
345-
}
346-
347324
return false;
348325
}
349326

bolt/lib/Passes/Aligner.cpp

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,12 @@ extern cl::opt<bool> AlignBlocks;
2525
extern cl::opt<bool> PreserveBlocksAlignment;
2626
extern cl::opt<unsigned> AlignFunctions;
2727

28-
cl::opt<unsigned>
29-
AlignBlocksMinSize("align-blocks-min-size",
30-
cl::desc("minimal size of the basic block that should be aligned"),
31-
cl::init(0),
32-
cl::ZeroOrMore,
33-
cl::Hidden,
34-
cl::cat(BoltOptCategory));
35-
36-
cl::opt<unsigned> AlignBlocksThreshold(
28+
static cl::opt<unsigned> AlignBlocksMinSize(
29+
"align-blocks-min-size",
30+
cl::desc("minimal size of the basic block that should be aligned"),
31+
cl::init(0), cl::ZeroOrMore, cl::Hidden, cl::cat(BoltOptCategory));
32+
33+
static cl::opt<unsigned> AlignBlocksThreshold(
3734
"align-blocks-threshold",
3835
cl::desc(
3936
"align only blocks with frequency larger than containing function "
@@ -42,19 +39,17 @@ cl::opt<unsigned> AlignBlocksThreshold(
4239
"containing function."),
4340
cl::init(800), cl::Hidden, cl::cat(BoltOptCategory));
4441

45-
cl::opt<unsigned> AlignFunctionsMaxBytes(
42+
static cl::opt<unsigned> AlignFunctionsMaxBytes(
4643
"align-functions-max-bytes",
4744
cl::desc("maximum number of bytes to use to align functions"), cl::init(32),
4845
cl::cat(BoltOptCategory));
4946

50-
cl::opt<unsigned>
51-
BlockAlignment("block-alignment",
52-
cl::desc("boundary to use for alignment of basic blocks"),
53-
cl::init(16),
54-
cl::ZeroOrMore,
55-
cl::cat(BoltOptCategory));
47+
static cl::opt<unsigned>
48+
BlockAlignment("block-alignment",
49+
cl::desc("boundary to use for alignment of basic blocks"),
50+
cl::init(16), cl::ZeroOrMore, cl::cat(BoltOptCategory));
5651

57-
cl::opt<bool>
52+
static cl::opt<bool>
5853
UseCompactAligner("use-compact-aligner",
5954
cl::desc("Use compact approach for aligning functions"),
6055
cl::init(true), cl::cat(BoltOptCategory));

bolt/lib/Passes/FrameOptimizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ FrameOptimization("frame-opt",
4343
cl::ZeroOrMore,
4444
cl::cat(BoltOptCategory));
4545

46-
cl::opt<bool> RemoveStores(
46+
static cl::opt<bool> RemoveStores(
4747
"frame-opt-rm-stores", cl::init(FOP_NONE),
4848
cl::desc("apply additional analysis to remove stores (experimental)"),
4949
cl::cat(BoltOptCategory));

bolt/lib/Passes/PLTCall.cpp

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,16 @@ namespace opts {
2222

2323
extern cl::OptionCategory BoltOptCategory;
2424

25-
cl::opt<bolt::PLTCall::OptType>
26-
PLT("plt",
27-
cl::desc("optimize PLT calls (requires linking with -znow)"),
28-
cl::init(bolt::PLTCall::OT_NONE),
29-
cl::values(clEnumValN(bolt::PLTCall::OT_NONE,
30-
"none",
31-
"do not optimize PLT calls"),
32-
clEnumValN(bolt::PLTCall::OT_HOT,
33-
"hot",
34-
"optimize executed (hot) PLT calls"),
35-
clEnumValN(bolt::PLTCall::OT_ALL,
36-
"all",
37-
"optimize all PLT calls")),
38-
cl::ZeroOrMore,
39-
cl::cat(BoltOptCategory));
40-
25+
static cl::opt<bolt::PLTCall::OptType>
26+
PLT("plt", cl::desc("optimize PLT calls (requires linking with -znow)"),
27+
cl::init(bolt::PLTCall::OT_NONE),
28+
cl::values(clEnumValN(bolt::PLTCall::OT_NONE, "none",
29+
"do not optimize PLT calls"),
30+
clEnumValN(bolt::PLTCall::OT_HOT, "hot",
31+
"optimize executed (hot) PLT calls"),
32+
clEnumValN(bolt::PLTCall::OT_ALL, "all",
33+
"optimize all PLT calls")),
34+
cl::ZeroOrMore, cl::cat(BoltOptCategory));
4135
}
4236

4337
namespace llvm {

bolt/lib/Passes/ProfileQualityStats.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ using namespace bolt;
2424

2525
namespace opts {
2626
extern cl::opt<unsigned> Verbosity;
27-
cl::opt<unsigned> TopFunctionsForProfileQualityCheck(
27+
static cl::opt<unsigned> TopFunctionsForProfileQualityCheck(
2828
"top-functions-for-profile-quality-check",
2929
cl::desc("number of hottest functions to print aggregated "
3030
"profile quality stats of."),
3131
cl::init(1000), cl::ZeroOrMore, cl::Hidden, cl::cat(BoltOptCategory));
32-
cl::opt<unsigned> PercentileForProfileQualityCheck(
32+
static cl::opt<unsigned> PercentileForProfileQualityCheck(
3333
"percentile-for-profile-quality-check",
3434
cl::desc("Percentile of profile quality distributions over hottest "
3535
"functions to report."),

bolt/lib/Passes/RetpolineInsertion.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,17 @@ namespace opts {
3333

3434
extern cl::OptionCategory BoltCategory;
3535

36-
llvm::cl::opt<bool> InsertRetpolines("insert-retpolines",
37-
cl::desc("run retpoline insertion pass"),
38-
cl::cat(BoltCategory));
39-
40-
llvm::cl::opt<bool>
41-
RetpolineLfence("retpoline-lfence",
42-
cl::desc("determine if lfence instruction should exist in the retpoline"),
43-
cl::init(true),
44-
cl::ZeroOrMore,
45-
cl::Hidden,
46-
cl::cat(BoltCategory));
47-
48-
cl::opt<RetpolineInsertion::AvailabilityOptions> R11Availability(
36+
static llvm::cl::opt<bool>
37+
InsertRetpolines("insert-retpolines",
38+
cl::desc("run retpoline insertion pass"),
39+
cl::cat(BoltCategory));
40+
41+
static llvm::cl::opt<bool> RetpolineLfence(
42+
"retpoline-lfence",
43+
cl::desc("determine if lfence instruction should exist in the retpoline"),
44+
cl::init(true), cl::ZeroOrMore, cl::Hidden, cl::cat(BoltCategory));
45+
46+
static cl::opt<RetpolineInsertion::AvailabilityOptions> R11Availability(
4947
"r11-availability",
5048
cl::desc("determine the availability of r11 before indirect branches"),
5149
cl::init(RetpolineInsertion::AvailabilityOptions::NEVER),

bolt/lib/Passes/StokeInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ using namespace llvm;
2121
using namespace bolt;
2222

2323
namespace opts {
24-
cl::OptionCategory StokeOptCategory("STOKE pass options");
24+
static cl::OptionCategory StokeOptCategory("STOKE pass options");
2525

2626
static cl::opt<std::string>
2727
StokeOutputDataFilename("stoke-out",

0 commit comments

Comments
 (0)