Skip to content

Commit cb43c24

Browse files
committed
Merge commit '4d6bff411b3584e346810515da315ab5a688a1fc' into llvmspirv_pulldown
2 parents 65cf01c + 4d6bff4 commit cb43c24

File tree

633 files changed

+89142
-15713
lines changed

Some content is hidden

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

633 files changed

+89142
-15713
lines changed

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -781,11 +781,6 @@ class BinaryContext {
781781
uint64_t PseudoProbeLooseMatchedSampleCount{0};
782782
/// the count of call matched samples
783783
uint64_t CallMatchedSampleCount{0};
784-
/// the number of stale functions that have matching number of blocks in
785-
/// the profile
786-
uint64_t NumStaleFuncsWithEqualBlockCount{0};
787-
/// the number of blocks that have matching size but a differing hash
788-
uint64_t NumStaleBlocksWithEqualIcount{0};
789784
} Stats;
790785

791786
// Original binary execution count stats.

bolt/include/bolt/Passes/MarkRAStates.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@
1313
#define BOLT_PASSES_MARK_RA_STATES
1414

1515
#include "bolt/Passes/BinaryPasses.h"
16+
#include <mutex>
1617

1718
namespace llvm {
1819
namespace bolt {
1920

2021
class MarkRAStates : public BinaryFunctionPass {
22+
// setIgnored() is not thread-safe, but the pass is running on functions in
23+
// parallel.
24+
std::mutex IgnoreMutex;
25+
2126
public:
2227
explicit MarkRAStates() : BinaryFunctionPass(false) {}
2328

bolt/lib/Passes/BinaryPasses.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,12 +1508,6 @@ Error PrintProgramStats::runOnFunctions(BinaryContext &BC) {
15081508
if (NumAllStaleFunctions) {
15091509
const float PctStale =
15101510
NumAllStaleFunctions / (float)NumAllProfiledFunctions * 100.0f;
1511-
const float PctStaleFuncsWithEqualBlockCount =
1512-
(float)BC.Stats.NumStaleFuncsWithEqualBlockCount /
1513-
NumAllStaleFunctions * 100.0f;
1514-
const float PctStaleBlocksWithEqualIcount =
1515-
(float)BC.Stats.NumStaleBlocksWithEqualIcount /
1516-
BC.Stats.NumStaleBlocks * 100.0f;
15171511
auto printErrorOrWarning = [&]() {
15181512
if (PctStale > opts::StaleThreshold)
15191513
BC.errs() << "BOLT-ERROR: ";
@@ -1536,17 +1530,6 @@ Error PrintProgramStats::runOnFunctions(BinaryContext &BC) {
15361530
<< "%) belong to functions with invalid"
15371531
" (possibly stale) profile.\n";
15381532
}
1539-
BC.outs() << "BOLT-INFO: " << BC.Stats.NumStaleFuncsWithEqualBlockCount
1540-
<< " stale function"
1541-
<< (BC.Stats.NumStaleFuncsWithEqualBlockCount == 1 ? "" : "s")
1542-
<< format(" (%.1f%% of all stale)",
1543-
PctStaleFuncsWithEqualBlockCount)
1544-
<< " have matching block count.\n";
1545-
BC.outs() << "BOLT-INFO: " << BC.Stats.NumStaleBlocksWithEqualIcount
1546-
<< " stale block"
1547-
<< (BC.Stats.NumStaleBlocksWithEqualIcount == 1 ? "" : "s")
1548-
<< format(" (%.1f%% of all stale)", PctStaleBlocksWithEqualIcount)
1549-
<< " have matching icount.\n";
15501533
if (PctStale > opts::StaleThreshold) {
15511534
return createFatalBOLTError(
15521535
Twine("BOLT-ERROR: stale functions exceed specified threshold of ") +

bolt/lib/Passes/MarkRAStates.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ bool MarkRAStates::runOnFunction(BinaryFunction &BF) {
4343
// Not all functions have .cfi_negate_ra_state in them. But if one does,
4444
// we expect psign/pauth instructions to have the hasNegateRAState
4545
// annotation.
46-
BF.setIgnored();
4746
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
4847
<< BF.getPrintName()
4948
<< ": ptr sign/auth inst without .cfi_negate_ra_state\n";
49+
std::lock_guard<std::mutex> Lock(IgnoreMutex);
50+
BF.setIgnored();
5051
return false;
5152
}
5253
}
@@ -67,6 +68,7 @@ bool MarkRAStates::runOnFunction(BinaryFunction &BF) {
6768
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
6869
<< BF.getPrintName()
6970
<< ": ptr signing inst encountered in Signed RA state\n";
71+
std::lock_guard<std::mutex> Lock(IgnoreMutex);
7072
BF.setIgnored();
7173
return false;
7274
}
@@ -80,6 +82,7 @@ bool MarkRAStates::runOnFunction(BinaryFunction &BF) {
8082
<< BF.getPrintName()
8183
<< ": ptr authenticating inst encountered in Unsigned RA "
8284
"state\n";
85+
std::lock_guard<std::mutex> Lock(IgnoreMutex);
8386
BF.setIgnored();
8487
return false;
8588
}

bolt/lib/Profile/YAMLProfileReader.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,6 @@ bool YAMLProfileReader::parseFunctionProfile(
350350
<< MismatchedCalls << " calls, and " << MismatchedEdges
351351
<< " edges in profile did not match function " << BF << '\n';
352352

353-
if (YamlBF.NumBasicBlocks != BF.size())
354-
++BC.Stats.NumStaleFuncsWithEqualBlockCount;
355-
356353
if (!opts::InferStaleProfile)
357354
return false;
358355
ArrayRef<ProbeMatchSpec> ProbeMatchSpecs;

bolt/test/X86/dwarf4-ftypes-dwp-input-dwo-output.test

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# UNSUPPORTED: system-linux
21
; RUN: rm -rf %t
32
; RUN: mkdir %t
43
; RUN: cd %t

clang-tools-extra/clang-tidy/ClangTidyOptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ ClangTidyOptions ClangTidyOptions::getDefaults() {
247247
Options.WarningsAsErrors = "";
248248
Options.HeaderFileExtensions = {"", "h", "hh", "hpp", "hxx"};
249249
Options.ImplementationFileExtensions = {"c", "cc", "cpp", "cxx"};
250-
Options.HeaderFilterRegex = "";
250+
Options.HeaderFilterRegex = ".*";
251251
Options.ExcludeHeaderFilterRegex = "";
252252
Options.SystemHeaders = false;
253253
Options.FormatStyle = "none";

clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidNonConstGlobalVariablesCheck.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ namespace clang::tidy::cppcoreguidelines {
1717
AvoidNonConstGlobalVariablesCheck::AvoidNonConstGlobalVariablesCheck(
1818
StringRef Name, ClangTidyContext *Context)
1919
: ClangTidyCheck(Name, Context),
20-
AllowInternalLinkage(Options.get("AllowInternalLinkage", false)) {}
20+
AllowInternalLinkage(Options.get("AllowInternalLinkage", false)),
21+
AllowThreadLocal(Options.get("AllowThreadLocal", false)) {}
2122

2223
void AvoidNonConstGlobalVariablesCheck::registerMatchers(MatchFinder *Finder) {
2324
auto NamespaceMatcher = AllowInternalLinkage
@@ -31,6 +32,8 @@ void AvoidNonConstGlobalVariablesCheck::registerMatchers(MatchFinder *Finder) {
3132
GlobalContext,
3233
AllowInternalLinkage ? varDecl(unless(isStaticStorageClass()))
3334
: varDecl(),
35+
AllowThreadLocal ? varDecl(unless(hasThreadStorageDuration()))
36+
: varDecl(),
3437
unless(anyOf(
3538
isConstexpr(), hasType(isConstQualified()),
3639
hasType(referenceType())))); // References can't be changed, only the

clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidNonConstGlobalVariablesCheck.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class AvoidNonConstGlobalVariablesCheck : public ClangTidyCheck {
2727

2828
private:
2929
const bool AllowInternalLinkage;
30+
const bool AllowThreadLocal;
3031
};
3132

3233
} // namespace clang::tidy::cppcoreguidelines

clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,26 @@ void MacroUsageCheck::registerPPCallbacks(const SourceManager &SM,
8282
void MacroUsageCheck::warnMacro(const MacroDirective *MD, StringRef MacroName) {
8383
const MacroInfo *Info = MD->getMacroInfo();
8484
StringRef Message;
85+
bool MacroBodyExpressionLike;
86+
if (Info->getNumTokens() > 0) {
87+
const Token &Tok = Info->getReplacementToken(0);
88+
// Now notice that keywords like `__attribute` cannot be a leading
89+
// token in an expression.
90+
MacroBodyExpressionLike = !Tok.is(tok::kw___attribute);
91+
} else {
92+
MacroBodyExpressionLike = true;
93+
}
8594

8695
if (llvm::all_of(Info->tokens(), std::mem_fn(&Token::isLiteral)))
8796
Message = "macro '%0' used to declare a constant; consider using a "
8897
"'constexpr' constant";
8998
// A variadic macro is function-like at the same time. Therefore variadic
9099
// macros are checked first and will be excluded for the function-like
91100
// diagnostic.
92-
else if (Info->isVariadic())
101+
else if (Info->isVariadic() && MacroBodyExpressionLike)
93102
Message = "variadic macro '%0' used; consider using a 'constexpr' "
94103
"variadic template function";
95-
else if (Info->isFunctionLike())
104+
else if (Info->isFunctionLike() && MacroBodyExpressionLike)
96105
Message = "function-like macro '%0' used; consider a 'constexpr' template "
97106
"function";
98107

0 commit comments

Comments
 (0)