Skip to content

Commit 5dfa889

Browse files
committed
Vector load size should be at least 2*XLen or the codegen isn't optimal
Created using spr 1.3.6-beta.1
2 parents 3fd27bd + 080b9fd commit 5dfa889

File tree

2,657 files changed

+150264
-70322
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,657 files changed

+150264
-70322
lines changed

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ env:
4949
jobs:
5050
stage1:
5151
if: github.repository_owner == 'llvm'
52-
runs-on: libcxx-runners-8-set
52+
runs-on: libcxx-runners-set
53+
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
5354
continue-on-error: false
5455
strategy:
5556
fail-fast: false
@@ -79,12 +80,14 @@ jobs:
7980
path: |
8081
**/test-results.xml
8182
**/*.abilist
83+
**/CMakeConfigureLog.yaml
8284
**/CMakeError.log
8385
**/CMakeOutput.log
8486
**/crash_diagnostics/*
8587
stage2:
8688
if: github.repository_owner == 'llvm'
87-
runs-on: libcxx-runners-8-set
89+
runs-on: libcxx-runners-set
90+
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
8891
needs: [ stage1 ]
8992
continue-on-error: false
9093
strategy:
@@ -123,6 +126,7 @@ jobs:
123126
path: |
124127
**/test-results.xml
125128
**/*.abilist
129+
**/CMakeConfigureLog.yaml
126130
**/CMakeError.log
127131
**/CMakeOutput.log
128132
**/crash_diagnostics/*
@@ -160,20 +164,21 @@ jobs:
160164
'benchmarks',
161165
'bootstrapping-build'
162166
]
163-
machine: [ 'libcxx-runners-8-set' ]
167+
machine: [ 'libcxx-runners-set' ]
164168
include:
165169
- config: 'generic-cxx26'
166-
machine: libcxx-runners-8-set
170+
machine: libcxx-runners-set
167171
- config: 'generic-asan'
168-
machine: libcxx-runners-8-set
172+
machine: libcxx-runners-set
169173
- config: 'generic-tsan'
170-
machine: libcxx-runners-8-set
174+
machine: libcxx-runners-set
171175
- config: 'generic-ubsan'
172-
machine: libcxx-runners-8-set
176+
machine: libcxx-runners-set
173177
# Use a larger machine for MSAN to avoid timeout and memory allocation issues.
174178
- config: 'generic-msan'
175-
machine: libcxx-runners-8-set
179+
machine: libcxx-runners-set
176180
runs-on: ${{ matrix.machine }}
181+
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
177182
steps:
178183
- uses: actions/checkout@v4
179184
- name: ${{ matrix.config }}
@@ -188,6 +193,7 @@ jobs:
188193
path: |
189194
**/test-results.xml
190195
**/*.abilist
196+
**/CMakeConfigureLog.yaml
191197
**/CMakeError.log
192198
**/CMakeOutput.log
193199
**/crash_diagnostics/*
@@ -230,6 +236,7 @@ jobs:
230236
path: |
231237
**/test-results.xml
232238
**/*.abilist
239+
**/CMakeConfigureLog.yaml
233240
**/CMakeError.log
234241
**/CMakeOutput.log
235242
**/crash_diagnostics/*

bolt/lib/Core/HashUtilities.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ std::string hashBlockLoose(BinaryContext &BC, const BinaryBasicBlock &BB) {
145145
continue;
146146
}
147147

148-
std::string Mnemonic = BC.InstPrinter->getMnemonic(&Inst).first;
148+
std::string Mnemonic = BC.InstPrinter->getMnemonic(Inst).first;
149149
llvm::erase_if(Mnemonic, [](unsigned char ch) { return std::isspace(ch); });
150150
Opcodes.insert(Mnemonic);
151151
}

clang-tools-extra/clang-query/Query.cpp

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ bool HelpQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
4444
" set bind-root (true|false) "
4545
"Set whether to bind the root matcher to \"root\".\n"
4646
" set print-matcher (true|false) "
47-
"Set whether to print the current matcher,\n"
47+
"Set whether to print the current matcher.\n"
48+
" set enable-profile (true|false) "
49+
"Set whether to enable matcher profiling.\n"
4850
" set traversal <kind> "
4951
"Set traversal kind of clang-query session. Available kinds are:\n"
5052
" AsIs "
@@ -82,27 +84,53 @@ namespace {
8284

8385
struct CollectBoundNodes : MatchFinder::MatchCallback {
8486
std::vector<BoundNodes> &Bindings;
85-
CollectBoundNodes(std::vector<BoundNodes> &Bindings) : Bindings(Bindings) {}
87+
StringRef Unit;
88+
CollectBoundNodes(std::vector<BoundNodes> &Bindings, StringRef Unit)
89+
: Bindings(Bindings), Unit(Unit) {}
8690
void run(const MatchFinder::MatchResult &Result) override {
8791
Bindings.push_back(Result.Nodes);
8892
}
93+
StringRef getID() const override { return Unit; }
94+
};
95+
96+
struct QueryProfiler {
97+
llvm::StringMap<llvm::TimeRecord> Records;
98+
99+
~QueryProfiler() {
100+
llvm::TimerGroup TG("clang-query", "clang-query matcher profiling",
101+
Records);
102+
TG.print(llvm::errs());
103+
llvm::errs().flush();
104+
}
89105
};
90106

91107
} // namespace
92108

93109
bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
94110
unsigned MatchCount = 0;
95111

112+
std::optional<QueryProfiler> Profiler;
113+
if (QS.EnableProfile)
114+
Profiler.emplace();
115+
96116
for (auto &AST : QS.ASTs) {
97-
MatchFinder Finder;
117+
ast_matchers::MatchFinder::MatchFinderOptions FinderOptions;
118+
std::optional<llvm::StringMap<llvm::TimeRecord>> Records;
119+
if (QS.EnableProfile) {
120+
Records.emplace();
121+
FinderOptions.CheckProfiling.emplace(*Records);
122+
}
123+
124+
MatchFinder Finder(FinderOptions);
98125
std::vector<BoundNodes> Matches;
99126
DynTypedMatcher MaybeBoundMatcher = Matcher;
100127
if (QS.BindRoot) {
101128
std::optional<DynTypedMatcher> M = Matcher.tryBind("root");
102129
if (M)
103130
MaybeBoundMatcher = *M;
104131
}
105-
CollectBoundNodes Collect(Matches);
132+
StringRef OrigSrcName = AST->getOriginalSourceFileName();
133+
CollectBoundNodes Collect(Matches, OrigSrcName);
106134
if (!Finder.addDynamicMatcher(MaybeBoundMatcher, &Collect)) {
107135
OS << "Not a valid top-level matcher.\n";
108136
return false;
@@ -111,6 +139,8 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
111139
ASTContext &Ctx = AST->getASTContext();
112140
Ctx.getParentMapContext().setTraversalKind(QS.TK);
113141
Finder.matchAST(Ctx);
142+
if (QS.EnableProfile)
143+
Profiler->Records[OrigSrcName] += (*Records)[OrigSrcName];
114144

115145
if (QS.PrintMatcher) {
116146
SmallVector<StringRef, 4> Lines;

clang-tools-extra/clang-query/QueryParser.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ enum ParsedQueryVariable {
182182
PQV_Output,
183183
PQV_BindRoot,
184184
PQV_PrintMatcher,
185+
PQV_EnableProfile,
185186
PQV_Traversal
186187
};
187188

@@ -285,6 +286,7 @@ QueryRef QueryParser::doParse() {
285286
.Case("output", PQV_Output)
286287
.Case("bind-root", PQV_BindRoot)
287288
.Case("print-matcher", PQV_PrintMatcher)
289+
.Case("enable-profile", PQV_EnableProfile)
288290
.Case("traversal", PQV_Traversal)
289291
.Default(PQV_Invalid);
290292
if (VarStr.empty())
@@ -303,6 +305,9 @@ QueryRef QueryParser::doParse() {
303305
case PQV_PrintMatcher:
304306
Q = parseSetBool(&QuerySession::PrintMatcher);
305307
break;
308+
case PQV_EnableProfile:
309+
Q = parseSetBool(&QuerySession::EnableProfile);
310+
break;
306311
case PQV_Traversal:
307312
Q = parseSetTraversalKind(&QuerySession::TK);
308313
break;

clang-tools-extra/clang-query/QuerySession.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class QuerySession {
2626
QuerySession(llvm::ArrayRef<std::unique_ptr<ASTUnit>> ASTs)
2727
: ASTs(ASTs), PrintOutput(false), DiagOutput(true),
2828
DetailedASTOutput(false), BindRoot(true), PrintMatcher(false),
29-
Terminate(false), TK(TK_AsIs) {}
29+
EnableProfile(false), Terminate(false), TK(TK_AsIs) {}
3030

3131
llvm::ArrayRef<std::unique_ptr<ASTUnit>> ASTs;
3232

@@ -36,6 +36,7 @@ class QuerySession {
3636

3737
bool BindRoot;
3838
bool PrintMatcher;
39+
bool EnableProfile;
3940
bool Terminate;
4041

4142
TraversalKind TK;

clang-tools-extra/clang-tidy/altera/IdDependentBackwardBranchCheck.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,33 +78,44 @@ void IdDependentBackwardBranchCheck::registerMatchers(MatchFinder *Finder) {
7878

7979
IdDependentBackwardBranchCheck::IdDependencyRecord *
8080
IdDependentBackwardBranchCheck::hasIdDepVar(const Expr *Expression) {
81+
if (!Expression)
82+
return nullptr;
83+
8184
if (const auto *Declaration = dyn_cast<DeclRefExpr>(Expression)) {
8285
// It is a DeclRefExpr, so check if it's an ID-dependent variable.
83-
const auto *CheckVariable = dyn_cast<VarDecl>(Declaration->getDecl());
86+
const auto *CheckVariable =
87+
dyn_cast_if_present<VarDecl>(Declaration->getDecl());
88+
if (!CheckVariable)
89+
return nullptr;
8490
auto FoundVariable = IdDepVarsMap.find(CheckVariable);
8591
if (FoundVariable == IdDepVarsMap.end())
8692
return nullptr;
8793
return &(FoundVariable->second);
8894
}
8995
for (const auto *Child : Expression->children())
90-
if (const auto *ChildExpression = dyn_cast<Expr>(Child))
96+
if (const auto *ChildExpression = dyn_cast_if_present<Expr>(Child))
9197
if (IdDependencyRecord *Result = hasIdDepVar(ChildExpression))
9298
return Result;
9399
return nullptr;
94100
}
95101

96102
IdDependentBackwardBranchCheck::IdDependencyRecord *
97103
IdDependentBackwardBranchCheck::hasIdDepField(const Expr *Expression) {
104+
if (!Expression)
105+
return nullptr;
106+
98107
if (const auto *MemberExpression = dyn_cast<MemberExpr>(Expression)) {
99108
const auto *CheckField =
100-
dyn_cast<FieldDecl>(MemberExpression->getMemberDecl());
109+
dyn_cast_if_present<FieldDecl>(MemberExpression->getMemberDecl());
110+
if (!CheckField)
111+
return nullptr;
101112
auto FoundField = IdDepFieldsMap.find(CheckField);
102113
if (FoundField == IdDepFieldsMap.end())
103114
return nullptr;
104115
return &(FoundField->second);
105116
}
106117
for (const auto *Child : Expression->children())
107-
if (const auto *ChildExpression = dyn_cast<Expr>(Child))
118+
if (const auto *ChildExpression = dyn_cast_if_present<Expr>(Child))
108119
if (IdDependencyRecord *Result = hasIdDepField(ChildExpression))
109120
return Result;
110121
return nullptr;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ struct CognitiveComplexity final {
126126
// Limit of 25 is the "upstream"'s default.
127127
static constexpr unsigned DefaultLimit = 25U;
128128

129-
// Based on the publicly-avaliable numbers for some big open-source projects
129+
// Based on the publicly-available numbers for some big open-source projects
130130
// https://sonarcloud.io/projects?languages=c%2Ccpp&size=5 we can estimate:
131131
// value ~20 would result in no allocs for 98% of functions, ~12 for 96%, ~10
132132
// for 91%, ~8 for 88%, ~6 for 84%, ~4 for 77%, ~2 for 64%, and ~1 for 37%.

clang-tools-extra/clangd/Protocol.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,16 @@ bool fromJSON(const llvm::json::Value &Params, ClientCapabilities &R,
504504
P.field("offsetEncoding")))
505505
return false;
506506
}
507+
508+
if (auto *Experimental = O->getObject("experimental")) {
509+
if (auto *TextDocument = Experimental->getObject("textDocument")) {
510+
if (auto *Completion = TextDocument->getObject("completion")) {
511+
if (auto EditsNearCursor = Completion->getBoolean("editsNearCursor"))
512+
R.CompletionFixes |= *EditsNearCursor;
513+
}
514+
}
515+
}
516+
507517
return true;
508518
}
509519

clang-tools-extra/clangd/TidyProvider.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class DotClangTidyCache : private FileCache {
4646
[this](std::optional<llvm::StringRef> Data) {
4747
Value.reset();
4848
if (Data && !Data->empty()) {
49-
tidy::DiagCallback Diagnostics = [](const llvm::SMDiagnostic &D) {
49+
auto Diagnostics = [](const llvm::SMDiagnostic &D) {
5050
switch (D.getKind()) {
5151
case llvm::SourceMgr::DK_Error:
5252
elog("tidy-config error at {0}:{1}:{2}: {3}", D.getFilename(),
@@ -149,7 +149,7 @@ static void mergeCheckList(std::optional<std::string> &Checks,
149149
*Checks = llvm::join_items(",", *Checks, List);
150150
}
151151

152-
TidyProviderRef provideEnvironment() {
152+
TidyProvider provideEnvironment() {
153153
static const std::optional<std::string> User = [] {
154154
std::optional<std::string> Ret = llvm::sys::Process::GetEnv("USER");
155155
#ifdef _WIN32
@@ -167,7 +167,7 @@ TidyProviderRef provideEnvironment() {
167167
return [](tidy::ClangTidyOptions &, llvm::StringRef) {};
168168
}
169169

170-
TidyProviderRef provideDefaultChecks() {
170+
TidyProvider provideDefaultChecks() {
171171
// These default checks are chosen for:
172172
// - low false-positive rate
173173
// - providing a lot of value
@@ -251,7 +251,7 @@ TidyProvider disableUnusableChecks(llvm::ArrayRef<std::string> ExtraBadChecks) {
251251
};
252252
}
253253

254-
TidyProviderRef provideClangdConfig() {
254+
TidyProvider provideClangdConfig() {
255255
return [](tidy::ClangTidyOptions &Opts, llvm::StringRef) {
256256
const auto &CurTidyConfig = Config::current().Diagnostics.ClangTidy;
257257
if (!CurTidyConfig.Checks.empty())

clang-tools-extra/clangd/TidyProvider.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ using TidyProviderRef = llvm::function_ref<void(tidy::ClangTidyOptions &,
3030
TidyProvider combine(std::vector<TidyProvider> Providers);
3131

3232
/// Provider that just sets the defaults.
33-
TidyProviderRef provideEnvironment();
33+
TidyProvider provideEnvironment();
3434

3535
/// Provider that will enable a nice set of default checks if none are
3636
/// specified.
37-
TidyProviderRef provideDefaultChecks();
37+
TidyProvider provideDefaultChecks();
3838

3939
/// Provider the enables a specific set of checks and warnings as errors.
4040
TidyProvider addTidyChecks(llvm::StringRef Checks,
@@ -51,7 +51,7 @@ disableUnusableChecks(llvm::ArrayRef<std::string> ExtraBadChecks = {});
5151
TidyProvider provideClangTidyFiles(ThreadsafeFS &);
5252

5353
// Provider that uses clangd configuration files.
54-
TidyProviderRef provideClangdConfig();
54+
TidyProvider provideClangdConfig();
5555

5656
tidy::ClangTidyOptions getTidyOptionsForFile(TidyProviderRef Provider,
5757
llvm::StringRef Filename);

clang-tools-extra/clangd/XRefs.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2238,7 +2238,10 @@ prepareCallHierarchy(ParsedAST &AST, Position Pos, PathRef TUPath) {
22382238
for (const NamedDecl *Decl : getDeclAtPosition(AST, *Loc, {})) {
22392239
if (!(isa<DeclContext>(Decl) &&
22402240
cast<DeclContext>(Decl)->isFunctionOrMethod()) &&
2241-
Decl->getKind() != Decl::Kind::FunctionTemplate)
2241+
Decl->getKind() != Decl::Kind::FunctionTemplate &&
2242+
!(Decl->getKind() == Decl::Kind::Var &&
2243+
!cast<VarDecl>(Decl)->isLocalVarDecl()) &&
2244+
Decl->getKind() != Decl::Kind::Field)
22422245
continue;
22432246
if (auto CHI = declToCallHierarchyItem(*Decl, AST.tuPath()))
22442247
Result.emplace_back(std::move(*CHI));

0 commit comments

Comments
 (0)