Skip to content

Commit 70d7fa7

Browse files
committed
rebase
Created using spr 1.3.4
2 parents 3d79623 + 4de43ee commit 70d7fa7

File tree

1,032 files changed

+37530
-23499
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,032 files changed

+37530
-23499
lines changed

bolt/lib/Passes/RetpolineInsertion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ std::string createRetpolineFunctionTag(BinaryContext &BC,
195195

196196
TagOS << "+";
197197
if (MemRef.DispExpr)
198-
MemRef.DispExpr->print(TagOS, BC.AsmInfo.get());
198+
BC.AsmInfo->printExpr(TagOS, *MemRef.DispExpr);
199199
else
200200
TagOS << MemRef.DispImm;
201201

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -792,14 +792,15 @@ bool DataAggregator::doTrace(const Trace &Trace, uint64_t Count,
792792
const uint64_t From = Trace.From, To = Trace.To;
793793
BinaryFunction *FromFunc = getBinaryFunctionContainingAddress(From);
794794
BinaryFunction *ToFunc = getBinaryFunctionContainingAddress(To);
795+
NumTraces += Count;
795796
if (!FromFunc || !ToFunc) {
796797
LLVM_DEBUG(dbgs() << "Out of range trace " << Trace << '\n');
797798
NumLongRangeTraces += Count;
798799
return false;
799800
}
800801
if (FromFunc != ToFunc) {
801-
NumInvalidTraces += Count;
802802
LLVM_DEBUG(dbgs() << "Invalid trace " << Trace << '\n');
803+
NumInvalidTraces += Count;
803804
return false;
804805
}
805806

@@ -1329,10 +1330,6 @@ std::error_code DataAggregator::parseAggregatedLBREntry() {
13291330
TakenBranchInfo TI{(uint64_t)Count, (uint64_t)Mispreds};
13301331
Traces.emplace_back(T, TI);
13311332

1332-
/// Increment trace (fall-through) counter.
1333-
if (Addr[2]->Offset != Trace::BR_ONLY)
1334-
NumTraces += Count;
1335-
13361333
NumTotalSamples += Count;
13371334

13381335
return std::error_code();
@@ -1429,11 +1426,7 @@ void DataAggregator::parseLBRSample(const PerfBranchSample &Sample,
14291426
// chronological order)
14301427
if (NeedsSkylakeFix && NumEntry <= 2)
14311428
continue;
1432-
uint64_t TraceTo = Trace::BR_ONLY;
1433-
if (NextLBR) {
1434-
TraceTo = NextLBR->From;
1435-
++NumTraces;
1436-
}
1429+
uint64_t TraceTo = NextLBR ? NextLBR->From : Trace::BR_ONLY;
14371430
NextLBR = &LBR;
14381431

14391432
TakenBranchInfo &Info = TraceMap[Trace{LBR.From, LBR.To, TraceTo}];

bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "MCTargetDesc/RISCVMCExpr.h"
13+
#include "MCTargetDesc/RISCVMCAsmInfo.h"
1414
#include "MCTargetDesc/RISCVMCTargetDesc.h"
1515
#include "bolt/Core/MCPlusBuilder.h"
1616
#include "llvm/BinaryFormat/ELF.h"
@@ -33,8 +33,8 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
3333

3434
bool equals(const MCSpecifierExpr &A, const MCSpecifierExpr &B,
3535
CompFuncTy Comp) const override {
36-
const auto &RISCVExprA = cast<RISCVMCExpr>(A);
37-
const auto &RISCVExprB = cast<RISCVMCExpr>(B);
36+
const auto &RISCVExprA = cast<MCSpecifierExpr>(A);
37+
const auto &RISCVExprB = cast<MCSpecifierExpr>(B);
3838
if (RISCVExprA.getSpecifier() != RISCVExprB.getSpecifier())
3939
return false;
4040

@@ -245,7 +245,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
245245
MCContext *Ctx) {
246246
Inst.setOpcode(Opcode);
247247
Inst.clear();
248-
Inst.addOperand(MCOperand::createExpr(RISCVMCExpr::create(
248+
Inst.addOperand(MCOperand::createExpr(MCSpecifierExpr::create(
249249
MCSymbolRefExpr::create(Target, MCSymbolRefExpr::VK_None, *Ctx),
250250
ELF::R_RISCV_CALL_PLT, *Ctx)));
251251
}
@@ -342,7 +342,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
342342
}
343343

344344
const MCSymbol *getTargetSymbol(const MCExpr *Expr) const override {
345-
auto *RISCVExpr = dyn_cast<RISCVMCExpr>(Expr);
345+
auto *RISCVExpr = dyn_cast<MCSpecifierExpr>(Expr);
346346
if (RISCVExpr && RISCVExpr->getSubExpr())
347347
return getTargetSymbol(RISCVExpr->getSubExpr());
348348

@@ -435,19 +435,19 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
435435
case ELF::R_RISCV_TLS_GD_HI20:
436436
// The GOT is reused so no need to create GOT relocations
437437
case ELF::R_RISCV_PCREL_HI20:
438-
return RISCVMCExpr::create(Expr, ELF::R_RISCV_PCREL_HI20, Ctx);
438+
return MCSpecifierExpr::create(Expr, ELF::R_RISCV_PCREL_HI20, Ctx);
439439
case ELF::R_RISCV_PCREL_LO12_I:
440440
case ELF::R_RISCV_PCREL_LO12_S:
441-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_PCREL_LO, Ctx);
441+
return MCSpecifierExpr::create(Expr, RISCV::S_PCREL_LO, Ctx);
442442
case ELF::R_RISCV_HI20:
443-
return RISCVMCExpr::create(Expr, ELF::R_RISCV_HI20, Ctx);
443+
return MCSpecifierExpr::create(Expr, ELF::R_RISCV_HI20, Ctx);
444444
case ELF::R_RISCV_LO12_I:
445445
case ELF::R_RISCV_LO12_S:
446-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_LO, Ctx);
446+
return MCSpecifierExpr::create(Expr, RISCV::S_LO, Ctx);
447447
case ELF::R_RISCV_CALL:
448-
return RISCVMCExpr::create(Expr, ELF::R_RISCV_CALL_PLT, Ctx);
448+
return MCSpecifierExpr::create(Expr, ELF::R_RISCV_CALL_PLT, Ctx);
449449
case ELF::R_RISCV_CALL_PLT:
450-
return RISCVMCExpr::create(Expr, ELF::R_RISCV_CALL_PLT, Ctx);
450+
return MCSpecifierExpr::create(Expr, ELF::R_RISCV_CALL_PLT, Ctx);
451451
}
452452
}
453453

@@ -466,10 +466,10 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
466466
return false;
467467

468468
const auto *ImmExpr = ImmOp.getExpr();
469-
if (!isa<RISCVMCExpr>(ImmExpr))
469+
if (!isa<MCSpecifierExpr>(ImmExpr))
470470
return false;
471471

472-
switch (cast<RISCVMCExpr>(ImmExpr)->getSpecifier()) {
472+
switch (cast<MCSpecifierExpr>(ImmExpr)->getSpecifier()) {
473473
default:
474474
return false;
475475
case ELF::R_RISCV_CALL_PLT:

bolt/lib/Utils/CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,25 @@ set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc")
66

77
set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake")
88

9+
if(llvm_vc AND LLVM_APPEND_VC_REV)
10+
set(llvm_source_dir ${LLVM_MAIN_SRC_DIR})
11+
endif()
12+
if(LLVM_VC_REPOSITORY AND LLVM_VC_REVISION)
13+
set(llvm_source_dir ${LLVM_SOURCE_DIR})
14+
set(llvm_vc_repository ${LLVM_VC_REPOSITORY})
15+
set(llvm_vc_revision ${LLVM_VC_REVISION})
16+
endif()
17+
if(bolt_vc AND LLVM_APPEND_VC_REV)
18+
set(bolt_source_dir ${BOLT_SOURCE_DIR})
19+
endif()
20+
921
# Create custom target to generate the VC revision include.
1022
add_custom_command(OUTPUT "${version_inc}"
1123
DEPENDS "${llvm_vc}" "${bolt_vc}" "${generate_vcs_version_script}"
1224
COMMAND ${CMAKE_COMMAND} "-DNAMES=BOLT"
25+
"-DLLVM_SOURCE_DIR=${llvm_source_dir}"
26+
"-DBOLT_SOURCE_DIR=${bolt_source_dir}"
1327
"-DHEADER_FILE=${version_inc}"
14-
"-DBOLT_SOURCE_DIR=${BOLT_SOURCE_DIR}"
1528
"-DLLVM_VC_REPOSITORY=${llvm_vc_repository}"
1629
"-DLLVM_VC_REVISION=${llvm_vc_revision}"
1730
"-DLLVM_FORCE_VC_REVISION=${LLVM_FORCE_VC_REVISION}"

bolt/test/lit.local.cfg

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
host_linux_triple = config.target_triple.split("-")[0] + "-unknown-linux-gnu"
1+
host_triple = config.target_triple
2+
3+
# Force triple on non-linux hosts to get ELF binaries on all platforms.
4+
if not "linux" in host_triple:
5+
host_triple = host_triple.split("-")[0] + "-unknown-linux-gnu"
6+
27
common_linker_flags = "-fuse-ld=lld -Wl,--unresolved-symbols=ignore-all -Wl,--build-id=none -pie"
3-
flags = f"--target={host_linux_triple} -fPIE {common_linker_flags}"
8+
flags = f"--target={host_triple} -fPIE {common_linker_flags}"
49

510
config.substitutions.insert(0, ("%cflags", f"%cflags {flags}"))
611
config.substitutions.insert(0, ("%cxxflags", f"%cxxflags {flags}"))

clang-tools-extra/clang-doc/Representation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ mergeInfos(std::vector<std::unique_ptr<Info>> &Values) {
147147
return llvm::createStringError(llvm::inconvertibleErrorCode(),
148148
"unexpected info type");
149149
}
150+
llvm_unreachable("unhandled enumerator");
150151
}
151152

152153
bool CommentInfo::operator==(const CommentInfo &Other) const {

clang-tools-extra/clang-doc/Serialize.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ std::string serialize(std::unique_ptr<Info> &I) {
392392
case InfoType::IT_default:
393393
return "";
394394
}
395+
llvm_unreachable("unhandled enumerator");
395396
}
396397

397398
static void parseFullComment(const FullComment *C, CommentInfo &CI) {

clang-tools-extra/clang-reorder-fields/ReorderFieldsAction.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ getNewFieldsOrder(const RecordDecl *Definition,
8686
static void
8787
addReplacement(SourceRange Old, SourceRange New, const ASTContext &Context,
8888
std::map<std::string, tooling::Replacements> &Replacements) {
89+
if (Old.getBegin().isMacroID())
90+
Old = Context.getSourceManager().getExpansionRange(Old).getAsRange();
91+
if (New.getBegin().isMacroID())
92+
New = Context.getSourceManager().getExpansionRange(New).getAsRange();
8993
StringRef NewText =
9094
Lexer::getSourceText(CharSourceRange::getTokenRange(New),
9195
Context.getSourceManager(), Context.getLangOpts());

clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ UnnecessaryValueParamCheck::UnnecessaryValueParamCheck(
5050
utils::IncludeSorter::IS_LLVM),
5151
areDiagsSelfContained()),
5252
AllowedTypes(
53-
utils::options::parseStringList(Options.get("AllowedTypes", ""))) {}
53+
utils::options::parseStringList(Options.get("AllowedTypes", ""))),
54+
IgnoreCoroutines(Options.get("IgnoreCoroutines", true)) {}
5455

5556
void UnnecessaryValueParamCheck::registerMatchers(MatchFinder *Finder) {
5657
const auto ExpensiveValueParamDecl = parmVarDecl(
@@ -61,12 +62,14 @@ void UnnecessaryValueParamCheck::registerMatchers(MatchFinder *Finder) {
6162
matchers::matchesAnyListedName(AllowedTypes))))))),
6263
decl().bind("param"));
6364
Finder->addMatcher(
64-
traverse(
65-
TK_AsIs,
66-
functionDecl(hasBody(stmt()), isDefinition(), unless(isImplicit()),
67-
unless(cxxMethodDecl(anyOf(isOverride(), isFinal()))),
68-
has(typeLoc(forEach(ExpensiveValueParamDecl))),
69-
decl().bind("functionDecl"))),
65+
traverse(TK_AsIs,
66+
functionDecl(
67+
hasBody(IgnoreCoroutines ? stmt(unless(coroutineBodyStmt()))
68+
: stmt()),
69+
isDefinition(), unless(isImplicit()),
70+
unless(cxxMethodDecl(anyOf(isOverride(), isFinal()))),
71+
has(typeLoc(forEach(ExpensiveValueParamDecl))),
72+
decl().bind("functionDecl"))),
7073
this);
7174
}
7275

@@ -123,6 +126,7 @@ void UnnecessaryValueParamCheck::storeOptions(
123126
Options.store(Opts, "IncludeStyle", Inserter.getStyle());
124127
Options.store(Opts, "AllowedTypes",
125128
utils::options::serializeStringList(AllowedTypes));
129+
Options.store(Opts, "IgnoreCoroutines", IgnoreCoroutines);
126130
}
127131

128132
void UnnecessaryValueParamCheck::onEndOfTranslationUnit() {

clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class UnnecessaryValueParamCheck : public ClangTidyCheck {
4646
ExprMutationAnalyzer::Memoized MutationAnalyzerCache;
4747
utils::IncludeInserter Inserter;
4848
const std::vector<StringRef> AllowedTypes;
49+
bool IgnoreCoroutines;
4950
};
5051

5152
} // namespace clang::tidy::performance

0 commit comments

Comments
 (0)