Skip to content

Commit 756ba26

Browse files
committed
LLVM and SPIRV-LLVM-Translator pulldown (WW14)
LLVM: llvm/llvm-project@1d23d60c8d04 SPIRV-LLVM-Translator: KhronosGroup/SPIRV-LLVM-Translator@b30a2d2
2 parents bc063ac + f8ce16b commit 756ba26

File tree

1,879 files changed

+66222
-30453
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,879 files changed

+66222
-30453
lines changed

.github/workflows/release-tasks.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,15 @@ jobs:
4545
4646
- name: Build Documentation
4747
run: |
48-
./llvm/utils/release/build-docs.sh -srcdir llvm
48+
./llvm/utils/release/build-docs.sh -release ${{ steps.validate-tag.outputs.release-version }}
4949
./llvm/utils/release/github-upload-release.py --token ${{ github.token }} --release ${{ steps.validate-tag.outputs.release-version }} upload --files *doxygen*.tar.xz
5050
51+
- name: Create Release Notes Artifact
52+
uses: actions/download-artifact@v1
53+
with:
54+
name: release-notes
55+
path: docs-build/html-export/
56+
5157
- name: Clone www-releases
5258
if: ${{ !contains(steps.validate-tag.outputs.release-version, 'rc') }}
5359
uses: actions/checkout@v3

bolt/include/bolt/Core/BinaryFunction.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,6 +1794,10 @@ class BinaryFunction {
17941794
/// executions corresponding to this function.
17951795
uint64_t getRawBranchCount() const { return RawBranchCount; }
17961796

1797+
/// Set the profile data about the number of branch executions corresponding
1798+
/// to this function.
1799+
void setRawBranchCount(uint64_t Count) { RawBranchCount = Count; }
1800+
17971801
/// Return the execution count for functions with known profile.
17981802
/// Return 0 if the function has no profile.
17991803
uint64_t getKnownExecutionCount() const {

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ void BinaryFunction::print(raw_ostream &OS, std::string Annotation) {
470470
OS << "\n Image : 0x" << Twine::utohexstr(getImageAddress());
471471
if (ExecutionCount != COUNT_NO_PROFILE) {
472472
OS << "\n Exec Count : " << ExecutionCount;
473+
OS << "\n Branch Count: " << RawBranchCount;
473474
OS << "\n Profile Acc : " << format("%.1f%%", ProfileMatchRatio * 100.0f);
474475
}
475476

bolt/lib/Profile/YAMLProfileReader.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ bool YAMLProfileReader::parseFunctionProfile(
8383

8484
BF.setExecutionCount(YamlBF.ExecCount);
8585

86+
uint64_t FuncRawBranchCount = 0;
87+
for (const yaml::bolt::BinaryBasicBlockProfile &YamlBB : YamlBF.Blocks)
88+
for (const yaml::bolt::SuccessorInfo &YamlSI : YamlBB.Successors)
89+
FuncRawBranchCount += YamlSI.Count;
90+
BF.setRawBranchCount(FuncRawBranchCount);
91+
8692
if (!opts::IgnoreHash && YamlBF.Hash != BF.computeHash(/*UseDFS=*/true)) {
8793
if (opts::Verbosity >= 1)
8894
errs() << "BOLT-WARNING: function hash mismatch\n";

bolt/test/X86/branch-data.test

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@
33
# Also checks that llvm-bolt disassembler and CFG builder is working properly.
44

55
RUN: yaml2obj %p/Inputs/blarge.yaml &> %t.exe
6-
RUN: llvm-bolt %t.exe -o /dev/null --data %p/Inputs/blarge.fdata --print-cfg
6+
RUN: llvm-bolt %t.exe -o /dev/null --data %p/Inputs/blarge.fdata --print-cfg | FileCheck %s
77

88
CHECK: Binary Function "usqrt"
99
CHECK: State : CFG constructed
1010
CHECK: Address : 0x401170
1111
CHECK: Size : 0x43
12-
CHECK: MaxSize : 0x50
13-
CHECK: Offset : 0x1170
12+
CHECK: MaxSize : 0x43
13+
CHECK: Offset : 0xcb0
1414
CHECK: Section : .text
1515
CHECK: IsSimple : 1
1616
CHECK: BB Count : 5
1717
CHECK: Exec Count : 199
18+
CHECK: Branch Count: 7689
1819
CHECK: }
1920
CHECK: .LBB{{.*}}
2021
CHECK: Exec Count : 199

bolt/tools/merge-fdata/merge-fdata.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,7 @@ bool isYAML(const StringRef Filename) {
257257

258258
void mergeLegacyProfiles(const SmallVectorImpl<std::string> &Filenames) {
259259
errs() << "Using legacy profile format.\n";
260-
bool BoltedCollection = false;
261-
bool First = true;
260+
std::optional<bool> BoltedCollection;
262261
StringMap<uint64_t> Entries;
263262
for (const std::string &Filename : Filenames) {
264263
if (isYAML(Filename))
@@ -272,17 +271,18 @@ void mergeLegacyProfiles(const SmallVectorImpl<std::string> &Filenames) {
272271
StringRef Buf = MB.get()->getBuffer();
273272
// Check if the string "boltedcollection" is in the first line
274273
if (Buf.startswith("boltedcollection\n")) {
275-
if (!First && !BoltedCollection)
274+
if (!BoltedCollection.value_or(true))
276275
report_error(
277276
Filename,
278277
"cannot mix profile collected in BOLT and non-BOLT deployments");
279278
BoltedCollection = true;
280279
Buf = Buf.drop_front(17);
281280
} else {
282-
if (BoltedCollection)
281+
if (BoltedCollection.value_or(false))
283282
report_error(
284283
Filename,
285284
"cannot mix profile collected in BOLT and non-BOLT deployments");
285+
BoltedCollection = false;
286286
}
287287

288288
SmallVector<StringRef> Lines;
@@ -298,7 +298,6 @@ void mergeLegacyProfiles(const SmallVectorImpl<std::string> &Filenames) {
298298
Count += Entries.lookup(Signature);
299299
Entries.insert_or_assign(Signature, Count);
300300
}
301-
First = false;
302301
}
303302

304303
if (BoltedCollection)

clang-tools-extra/clang-tidy/add_new_check.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ def write_implementation(module_path, module, namespace, check_name_camel):
138138
if (!MatchedDecl->getIdentifier() || MatchedDecl->getName().startswith("awesome_"))
139139
return;
140140
diag(MatchedDecl->getLocation(), "function %%0 is insufficiently awesome")
141-
<< MatchedDecl;
142-
diag(MatchedDecl->getLocation(), "insert 'awesome'", DiagnosticIDs::Note)
141+
<< MatchedDecl
143142
<< FixItHint::CreateInsertion(MatchedDecl->getLocation(), "awesome_");
143+
diag(MatchedDecl->getLocation(), "insert 'awesome'", DiagnosticIDs::Note);
144144
}
145145
146146
} // namespace clang::tidy::%(namespace)s
@@ -293,7 +293,7 @@ def write_test(module_path, module, check_name, test_extension):
293293

294294

295295
def get_actual_filename(dirname, filename):
296-
if not os.path.isdir(dirname):
296+
if not os.path.isdir(dirname):
297297
return ''
298298
name = os.path.join(dirname, filename)
299299
if (os.path.isfile(name)):

clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,23 @@
1010

1111
#include "clang/AST/Expr.h"
1212
#include "clang/AST/ExprCXX.h"
13-
#include "clang/AST/ExprConcepts.h"
1413
#include "clang/ASTMatchers/ASTMatchers.h"
1514
#include "clang/Analysis/CFG.h"
1615
#include "clang/Lex/Lexer.h"
1716
#include "llvm/ADT/STLExtras.h"
1817

1918
#include "../utils/ExprSequence.h"
19+
#include "../utils/Matchers.h"
2020
#include <optional>
2121

2222
using namespace clang::ast_matchers;
2323
using namespace clang::tidy::utils;
2424

2525
namespace clang::tidy::bugprone {
2626

27-
namespace {
27+
using matchers::hasUnevaluatedContext;
2828

29-
AST_MATCHER(Expr, hasUnevaluatedContext) {
30-
if (isa<CXXNoexceptExpr>(Node) || isa<RequiresExpr>(Node))
31-
return true;
32-
if (const auto *UnaryExpr = dyn_cast<UnaryExprOrTypeTraitExpr>(&Node)) {
33-
switch (UnaryExpr->getKind()) {
34-
case UETT_SizeOf:
35-
case UETT_AlignOf:
36-
return true;
37-
default:
38-
return false;
39-
}
40-
}
41-
if (const auto *TypeIDExpr = dyn_cast<CXXTypeidExpr>(&Node))
42-
return !TypeIDExpr->isPotentiallyEvaluated();
43-
return false;
44-
}
29+
namespace {
4530

4631
/// Contains information about a use-after-move.
4732
struct UseAfterMove {
@@ -86,7 +71,6 @@ class UseAfterMoveFinder {
8671

8772
} // namespace
8873

89-
9074
// Matches nodes that are
9175
// - Part of a decltype argument or class template argument (we check this by
9276
// seeing if they are children of a TypeLoc), or

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

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ using namespace clang::ast_matchers;
1818

1919
namespace clang::tidy::cppcoreguidelines {
2020

21+
AvoidCaptureDefaultWhenCapturingThisCheck::
22+
AvoidCaptureDefaultWhenCapturingThisCheck(StringRef Name,
23+
ClangTidyContext *Context)
24+
: ClangTidyCheck(Name, Context),
25+
IgnoreCaptureDefaultByReference(
26+
Options.get("IgnoreCaptureDefaultByReference", false)) {}
27+
28+
void AvoidCaptureDefaultWhenCapturingThisCheck::storeOptions(
29+
ClangTidyOptions::OptionMap &Opts) {
30+
Options.store(Opts, "IgnoreCaptureDefaultByReference",
31+
IgnoreCaptureDefaultByReference);
32+
}
33+
2134
void AvoidCaptureDefaultWhenCapturingThisCheck::registerMatchers(
2235
MatchFinder *Finder) {
2336
Finder->addMatcher(lambdaExpr(hasAnyCapture(capturesThis())).bind("lambda"),
@@ -74,24 +87,30 @@ static std::string createReplacementText(const LambdaExpr *Lambda) {
7487

7588
void AvoidCaptureDefaultWhenCapturingThisCheck::check(
7689
const MatchFinder::MatchResult &Result) {
77-
if (const auto *Lambda = Result.Nodes.getNodeAs<LambdaExpr>("lambda")) {
78-
if (Lambda->getCaptureDefault() != LCD_None) {
79-
bool IsThisImplicitlyCaptured = std::any_of(
80-
Lambda->implicit_capture_begin(), Lambda->implicit_capture_end(),
81-
[](const LambdaCapture &Capture) { return Capture.capturesThis(); });
82-
auto Diag = diag(Lambda->getCaptureDefaultLoc(),
83-
"lambdas that %select{|implicitly }0capture 'this' "
84-
"should not specify a capture default")
85-
<< IsThisImplicitlyCaptured;
86-
87-
std::string ReplacementText = createReplacementText(Lambda);
88-
SourceLocation DefaultCaptureEnd =
89-
findDefaultCaptureEnd(Lambda, *Result.Context);
90-
Diag << FixItHint::CreateReplacement(
91-
CharSourceRange::getCharRange(Lambda->getCaptureDefaultLoc(),
92-
DefaultCaptureEnd),
93-
ReplacementText);
94-
}
90+
const auto *Lambda = Result.Nodes.getNodeAs<LambdaExpr>("lambda");
91+
if (!Lambda)
92+
return;
93+
94+
if (IgnoreCaptureDefaultByReference &&
95+
Lambda->getCaptureDefault() == LCD_ByRef)
96+
return;
97+
98+
if (Lambda->getCaptureDefault() != LCD_None) {
99+
bool IsThisImplicitlyCaptured = std::any_of(
100+
Lambda->implicit_capture_begin(), Lambda->implicit_capture_end(),
101+
[](const LambdaCapture &Capture) { return Capture.capturesThis(); });
102+
auto Diag = diag(Lambda->getCaptureDefaultLoc(),
103+
"lambdas that %select{|implicitly }0capture 'this' "
104+
"should not specify a capture default")
105+
<< IsThisImplicitlyCaptured;
106+
107+
std::string ReplacementText = createReplacementText(Lambda);
108+
SourceLocation DefaultCaptureEnd =
109+
findDefaultCaptureEnd(Lambda, *Result.Context);
110+
Diag << FixItHint::CreateReplacement(
111+
CharSourceRange::getCharRange(Lambda->getCaptureDefaultLoc(),
112+
DefaultCaptureEnd),
113+
ReplacementText);
95114
}
96115
}
97116

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,16 @@ namespace clang::tidy::cppcoreguidelines {
2727
class AvoidCaptureDefaultWhenCapturingThisCheck : public ClangTidyCheck {
2828
public:
2929
AvoidCaptureDefaultWhenCapturingThisCheck(StringRef Name,
30-
ClangTidyContext *Context)
31-
: ClangTidyCheck(Name, Context) {}
30+
ClangTidyContext *Context);
3231
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
3332
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
33+
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
3434
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
3535
return LangOpts.CPlusPlus11;
3636
}
37+
38+
private:
39+
bool IgnoreCaptureDefaultByReference;
3740
};
3841

3942
} // namespace clang::tidy::cppcoreguidelines

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "RvalueReferenceParamNotMovedCheck.h"
10+
#include "../utils/Matchers.h"
1011
#include "clang/AST/ASTContext.h"
1112
#include "clang/ASTMatchers/ASTMatchFinder.h"
1213

1314
using namespace clang::ast_matchers;
1415

1516
namespace clang::tidy::cppcoreguidelines {
1617

18+
using matchers::hasUnevaluatedContext;
19+
1720
namespace {
1821
AST_MATCHER_P(LambdaExpr, valueCapturesVar, DeclarationMatcher, VarMatcher) {
1922
return std::find_if(Node.capture_begin(), Node.capture_end(),
@@ -39,16 +42,18 @@ void RvalueReferenceParamNotMovedCheck::registerMatchers(MatchFinder *Finder) {
3942

4043
StatementMatcher MoveCallMatcher =
4144
callExpr(
45+
argumentCountIs(1),
4246
anyOf(callee(functionDecl(hasName("::std::move"))),
4347
callee(unresolvedLookupExpr(hasAnyDeclaration(
4448
namedDecl(hasUnderlyingDecl(hasName("::std::move"))))))),
45-
argumentCountIs(1),
4649
hasArgument(
4750
0, argumentOf(
4851
AllowPartialMove,
4952
declRefExpr(to(equalsBoundNode("param"))).bind("ref"))),
5053
unless(hasAncestor(
51-
lambdaExpr(valueCapturesVar(equalsBoundNode("param"))))))
54+
lambdaExpr(valueCapturesVar(equalsBoundNode("param"))))),
55+
unless(anyOf(hasAncestor(typeLoc()),
56+
hasAncestor(expr(hasUnevaluatedContext())))))
5257
.bind("move-call");
5358

5459
Finder->addMatcher(

clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,11 @@ void DefinitionsInHeadersCheck::check(const MatchFinder::MatchResult &Result) {
9090
// Internal linkage variable definitions are ignored for now:
9191
// const int a = 1;
9292
// static int b = 1;
93+
// namespace { int c = 1; }
9394
//
9495
// Although these might also cause ODR violations, we can be less certain and
9596
// should try to keep the false-positive rate down.
96-
//
97-
// FIXME: Should declarations in anonymous namespaces get the same treatment
98-
// as static / const declarations?
99-
if (!ND->hasExternalFormalLinkage() && !ND->isInAnonymousNamespace())
97+
if (!ND->hasExternalFormalLinkage() || ND->isInAnonymousNamespace())
10098
return;
10199

102100
if (const auto *FD = dyn_cast<FunctionDecl>(ND)) {

clang-tools-extra/clang-tidy/readability/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ add_clang_library(clangTidyReadabilityModule
2929
NamedParameterCheck.cpp
3030
NamespaceCommentCheck.cpp
3131
NonConstParameterCheck.cpp
32+
OperatorsRepresentationCheck.cpp
3233
QualifiedAutoCheck.cpp
3334
ReadabilityTidyModule.cpp
3435
RedundantAccessSpecifiersCheck.cpp

clang-tools-extra/clang-tidy/readability/MisleadingIndentationCheck.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ void MisleadingIndentationCheck::missingBracesCheck(const SourceManager &SM,
104104
}
105105

106106
void MisleadingIndentationCheck::registerMatchers(MatchFinder *Finder) {
107-
Finder->addMatcher(ifStmt(hasElse(stmt())).bind("if"), this);
107+
Finder->addMatcher(
108+
ifStmt(unless(hasThen(nullStmt())), hasElse(stmt())).bind("if"), this);
108109
Finder->addMatcher(
109110
compoundStmt(has(stmt(anyOf(ifStmt(), forStmt(), whileStmt()))))
110111
.bind("compound"),

0 commit comments

Comments
 (0)