Skip to content

Commit 6c799a5

Browse files
author
malixian
committed
Merge branch 'amd-gpu' of https://github.com/malixian/llvm into amd-gpu
2 parents d089464 + 797a976 commit 6c799a5

File tree

1,807 files changed

+65677
-26637
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,807 files changed

+65677
-26637
lines changed

buildbot/dependency.conf

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[VERSIONS]
2-
# https://github.com/intel/llvm/releases/download/2021-WW11/oclcpuexp-2021.11.3.0.09_rel.tar.gz
3-
ocl_cpu_rt_ver=2021.11.3.0.09
4-
# https://github.com/intel/llvm/releases/download/2021-WW11/win-oclcpuexp-2021.11.3.0.09_rel.zip
5-
ocl_cpu_rt_ver_win=2021.11.3.0.09
2+
# https://github.com/intel/llvm/releases/download/2021-WW26/oclcpuexp-2021.12.6.0.19_rel.tar.gz
3+
ocl_cpu_rt_ver=2021.12.6.0.19
4+
# https://github.com/intel/llvm/releases/download/2021-WW26/win-oclcpuexp-2021.12.6.0.19_rel.zip
5+
ocl_cpu_rt_ver_win=2021.12.6.0.19
66
# Same GPU driver supports Level Zero and OpenCL
77
# https://github.com/intel/compute-runtime/releases/tag/21.19.19792
88
ocl_gpu_rt_ver=21.19.19792
@@ -14,26 +14,26 @@ intel_sycl_ver=build
1414
# TBB binaries can be built from sources following instructions under
1515
# https://github.com/oneapi-src/oneTBB/blob/master/cmake/README.md
1616
# or downloaded using links below:
17-
# https://github.com/oneapi-src/oneTBB/releases/download/v2021.1.1/oneapi-tbb-2021.1.1-lin.tgz
18-
tbb_ver=2021.2.0.236
19-
# https://github.com/oneapi-src/oneTBB/releases/download/v2021.1.1/oneapi-tbb-2021.1.1-win.zip
20-
tbb_ver_win=2021.2.0.221
17+
# https://github.com/oneapi-src/oneTBB/releases/download/v2021.2.0/oneapi-tbb-2021.2.0-lin.tgz
18+
tbb_ver=2021.3.0.418
19+
# https://github.com/oneapi-src/oneTBB/releases/download/v2021.2.0/oneapi-tbb-2021.2.0-win.zip
20+
tbb_ver_win=2021.3.0.418
2121

22-
# https://github.com/intel/llvm/releases/download/2021-WW11/fpgaemu-2021.11.3.0.09_rel.tar.gz
23-
ocl_fpga_emu_ver=2021.11.3.0.09
24-
# https://github.com/intel/llvm/releases/download/2021-WW11/win-fpgaemu-2021.11.3.0.09_rel.zip
25-
ocl_fpga_emu_ver_win=2021.11.3.0.09
26-
fpga_ver=20210205_000003
27-
fpga_ver_win=20210204_000003_signed_bom_fixed
22+
# https://github.com/intel/llvm/releases/download/2021-WW26/fpgaemu-2021.12.6.0.19_rel.tar.gz
23+
ocl_fpga_emu_ver=2021.12.6.0.19
24+
# https://github.com/intel/llvm/releases/download/2021-WW26/win-fpgaemu-2021.12.6.0.19_rel.zip
25+
ocl_fpga_emu_ver_win=2021.12.6.0.19
26+
fpga_ver=20210519_000004
27+
fpga_ver_win=20210509_000006
2828
ocloc_ver_win=27.20.100.9168
2929

3030
[DRIVER VERSIONS]
31-
cpu_driver_lin=2021.11.3.0.09
32-
cpu_driver_win=2021.11.3.0.09
31+
cpu_driver_lin=2021.12.6.0.19
32+
cpu_driver_win=2021.12.6.0.19
3333
gpu_driver_lin=21.19.19792
3434
gpu_driver_win=27.20.100.9466
35-
fpga_driver_lin=2021.11.3.0.09
36-
fpga_driver_win=2021.11.3.0.09
35+
fpga_driver_lin=2021.12.6.0.19
36+
fpga_driver_win=2021.12.6.0.19
3737
# NVidia CUDA driver
3838
# TODO provide URL for CUDA driver
3939
nvidia_gpu_driver_lin=435.21

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

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "../utils/LexerUtils.h"
1313
#include "../utils/Matchers.h"
1414
#include "../utils/OptionsUtils.h"
15+
#include "clang/AST/Decl.h"
1516
#include "clang/Basic/Diagnostic.h"
1617

1718
namespace clang {
@@ -72,14 +73,14 @@ AST_MATCHER_FUNCTION(StatementMatcher, isConstRefReturningFunctionCall) {
7273
.bind(InitFunctionCallId);
7374
}
7475

75-
AST_MATCHER_FUNCTION(StatementMatcher, isInitializedFromReferenceToConst) {
76+
AST_MATCHER_FUNCTION(StatementMatcher, initializerReturnsReferenceToConst) {
7677
auto OldVarDeclRef =
7778
declRefExpr(to(varDecl(hasLocalStorage()).bind(OldVarDeclId)));
78-
return declStmt(has(varDecl(hasInitializer(
79+
return expr(
7980
anyOf(isConstRefReturningFunctionCall(), isConstRefReturningMethodCall(),
8081
ignoringImpCasts(OldVarDeclRef),
81-
ignoringImpCasts(unaryOperator(
82-
hasOperatorName("&"), hasUnaryOperand(OldVarDeclRef))))))));
82+
ignoringImpCasts(unaryOperator(hasOperatorName("&"),
83+
hasUnaryOperand(OldVarDeclRef)))));
8384
}
8485

8586
// This checks that the variable itself is only used as const, and also makes
@@ -106,18 +107,14 @@ static bool isInitializingVariableImmutable(const VarDecl &InitializingVar,
106107
if (!isa<ReferenceType, PointerType>(T))
107108
return true;
108109

109-
auto Matches =
110-
match(findAll(declStmt(has(varDecl(equalsNode(&InitializingVar))))
111-
.bind("declStmt")),
112-
BlockStmt, Context);
113-
// The reference or pointer is not initialized in the BlockStmt. We assume
114-
// its pointee is not modified then.
115-
if (Matches.empty())
110+
// The reference or pointer is not declared and hence not initialized anywhere
111+
// in the function. We assume its pointee is not modified then.
112+
if (!InitializingVar.isLocalVarDecl() || !InitializingVar.hasInit()) {
116113
return true;
114+
}
117115

118-
const auto *Initialization = selectFirst<DeclStmt>("declStmt", Matches);
119-
Matches =
120-
match(isInitializedFromReferenceToConst(), *Initialization, Context);
116+
auto Matches = match(initializerReturnsReferenceToConst(),
117+
*InitializingVar.getInit(), Context);
121118
// The reference is initialized from a free function without arguments
122119
// returning a const reference. This is a global immutable object.
123120
if (selectFirst<CallExpr>(InitFunctionCallId, Matches) != nullptr)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PERFORMANCE_UNNECESSARY_COPY_INITIALIZATION_H
1111

1212
#include "../ClangTidyCheck.h"
13+
#include "clang/AST/Decl.h"
1314

1415
namespace clang {
1516
namespace tidy {

clang-tools-extra/clangd/CompileCommands.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include "llvm/Support/MemoryBuffer.h"
2121
#include "llvm/Support/Path.h"
2222
#include "llvm/Support/Program.h"
23+
#include <string>
24+
#include <vector>
2325

2426
namespace clang {
2527
namespace clangd {
@@ -209,14 +211,20 @@ void CommandMangler::adjust(std::vector<std::string> &Cmd) const {
209211
Cmd = tooling::getStripPluginsAdjuster()(Cmd, "");
210212
Cmd = tooling::getClangSyntaxOnlyAdjuster()(Cmd, "");
211213

214+
std::vector<std::string> ToAppend;
212215
if (ResourceDir && !Has("-resource-dir"))
213-
Cmd.push_back(("-resource-dir=" + *ResourceDir));
216+
ToAppend.push_back(("-resource-dir=" + *ResourceDir));
214217

215218
// Don't set `-isysroot` if it is already set or if `--sysroot` is set.
216219
// `--sysroot` is a superset of the `-isysroot` argument.
217220
if (Sysroot && !Has("-isysroot") && !Has("--sysroot")) {
218-
Cmd.push_back("-isysroot");
219-
Cmd.push_back(*Sysroot);
221+
ToAppend.push_back("-isysroot");
222+
ToAppend.push_back(*Sysroot);
223+
}
224+
225+
if (!ToAppend.empty()) {
226+
Cmd = tooling::getInsertArgumentAdjuster(
227+
std::move(ToAppend), tooling::ArgumentInsertPosition::END)(Cmd, "");
220228
}
221229

222230
if (!Cmd.empty()) {
@@ -504,7 +512,6 @@ void ArgStripper::process(std::vector<std::string> &Args) const {
504512
Args.resize(Write);
505513
}
506514

507-
508515
std::string printArgv(llvm::ArrayRef<llvm::StringRef> Args) {
509516
std::string Buf;
510517
llvm::raw_string_ostream OS(Buf);

clang-tools-extra/clangd/ConfigCompile.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include "llvm/Support/Regex.h"
4848
#include "llvm/Support/SMLoc.h"
4949
#include "llvm/Support/SourceMgr.h"
50+
#include <algorithm>
5051
#include <string>
5152

5253
namespace clang {
@@ -270,7 +271,9 @@ struct FragmentCompiler {
270271
Add.push_back(std::move(*A));
271272
Out.Apply.push_back([Add(std::move(Add))](const Params &, Config &C) {
272273
C.CompileFlags.Edits.push_back([Add](std::vector<std::string> &Args) {
273-
Args.insert(Args.end(), Add.begin(), Add.end());
274+
// The point to insert at. Just append when `--` isn't present.
275+
auto It = llvm::find(Args, "--");
276+
Args.insert(It, Add.begin(), Add.end());
274277
});
275278
});
276279
}

clang-tools-extra/clangd/Diagnostics.cpp

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ bool mentionsMainFile(const Diag &D) {
7676
return false;
7777
}
7878

79-
bool isExcluded(const Diag &D) {
79+
bool isExcluded(unsigned DiagID) {
8080
// clang will always fail parsing MS ASM, we don't link in desc + asm parser.
81-
if (D.ID == clang::diag::err_msasm_unable_to_create_target ||
82-
D.ID == clang::diag::err_msasm_unsupported_arch)
81+
if (DiagID == clang::diag::err_msasm_unable_to_create_target ||
82+
DiagID == clang::diag::err_msasm_unsupported_arch)
8383
return true;
8484
return false;
8585
}
@@ -726,44 +726,42 @@ void StoreDiags::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
726726
// Handle the new main diagnostic.
727727
flushLastDiag();
728728

729-
if (Adjuster) {
729+
LastDiag = Diag();
730+
// FIXME: Merge with feature modules.
731+
if (Adjuster)
730732
DiagLevel = Adjuster(DiagLevel, Info);
731-
if (DiagLevel == DiagnosticsEngine::Ignored) {
732-
LastPrimaryDiagnosticWasSuppressed = true;
733-
return;
734-
}
735-
}
736-
LastPrimaryDiagnosticWasSuppressed = false;
737733

738-
LastDiag = Diag();
739734
FillDiagBase(*LastDiag);
735+
if (isExcluded(LastDiag->ID))
736+
LastDiag->Severity = DiagnosticsEngine::Ignored;
737+
if (DiagCB)
738+
DiagCB(Info, *LastDiag);
739+
// Don't bother filling in the rest if diag is going to be dropped.
740+
if (LastDiag->Severity == DiagnosticsEngine::Ignored)
741+
return;
742+
740743
LastDiagLoc.emplace(Info.getLocation(), Info.getSourceManager());
741744
LastDiagOriginallyError = OriginallyError;
742-
743745
if (!Info.getFixItHints().empty())
744746
AddFix(true /* try to invent a message instead of repeating the diag */);
745747
if (Fixer) {
746-
auto ExtraFixes = Fixer(DiagLevel, Info);
748+
auto ExtraFixes = Fixer(LastDiag->Severity, Info);
747749
LastDiag->Fixes.insert(LastDiag->Fixes.end(), ExtraFixes.begin(),
748750
ExtraFixes.end());
749751
}
750-
if (DiagCB)
751-
DiagCB(Info, *LastDiag);
752752
} else {
753753
// Handle a note to an existing diagnostic.
754-
755-
// If a diagnostic was suppressed due to the suppression filter,
756-
// also suppress notes associated with it.
757-
if (LastPrimaryDiagnosticWasSuppressed) {
758-
return;
759-
}
760-
761754
if (!LastDiag) {
762755
assert(false && "Adding a note without main diagnostic");
763756
IgnoreDiagnostics::log(DiagLevel, Info);
764757
return;
765758
}
766759

760+
// If a diagnostic was suppressed due to the suppression filter,
761+
// also suppress notes associated with it.
762+
if (LastDiag->Severity == DiagnosticsEngine::Ignored)
763+
return;
764+
767765
if (!Info.getFixItHints().empty()) {
768766
// A clang note with fix-it is not a separate diagnostic in clangd. We
769767
// attach it as a Fix to the main diagnostic instead.
@@ -788,7 +786,7 @@ void StoreDiags::flushLastDiag() {
788786
LastDiag.reset();
789787
});
790788

791-
if (isExcluded(*LastDiag))
789+
if (LastDiag->Severity == DiagnosticsEngine::Ignored)
792790
return;
793791
// Move errors that occur from headers into main file.
794792
if (!LastDiag->InsideMainFile && LastDiagLoc && LastDiagOriginallyError) {

clang-tools-extra/clangd/Diagnostics.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ class StoreDiags : public DiagnosticConsumer {
171171
SourceManager *OrigSrcMgr = nullptr;
172172

173173
llvm::DenseSet<std::pair<unsigned, unsigned>> IncludedErrorLocations;
174-
bool LastPrimaryDiagnosticWasSuppressed = false;
175174
};
176175

177176
/// Determine whether a (non-clang-tidy) diagnostic is suppressed by config.

clang-tools-extra/clangd/InlayHints.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,19 @@ class InlayHintVisitor : public RecursiveASTVisitor<InlayHintVisitor> {
7272
return true;
7373
}
7474

75+
bool VisitFunctionDecl(FunctionDecl *D) {
76+
if (auto *AT = D->getReturnType()->getContainedAutoType()) {
77+
QualType Deduced = AT->getDeducedType();
78+
if (!Deduced.isNull()) {
79+
addInlayHint(D->getFunctionTypeLoc().getRParenLoc(),
80+
InlayHintKind::TypeHint,
81+
"-> " + D->getReturnType().getAsString(TypeHintPolicy));
82+
}
83+
}
84+
85+
return true;
86+
}
87+
7588
bool VisitVarDecl(VarDecl *D) {
7689
// Do not show hints for the aggregate in a structured binding.
7790
// In the future, we may show hints for the individual bindings.

clang-tools-extra/clangd/tool/ClangdMain.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,11 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
909909

910910
if (CheckFile.getNumOccurrences()) {
911911
llvm::SmallString<256> Path;
912-
llvm::sys::fs::real_path(CheckFile, Path, /*expand_tilde=*/true);
912+
if (auto Error =
913+
llvm::sys::fs::real_path(CheckFile, Path, /*expand_tilde=*/true)) {
914+
elog("Failed to resolve path {0}: {1}", CheckFile, Error.message());
915+
return 1;
916+
}
913917
log("Entering check mode (no LSP server)");
914918
uint32_t Begin = 0, End = std::numeric_limits<uint32_t>::max();
915919
if (!CheckFileLines.empty()) {

clang-tools-extra/clangd/unittests/CompileCommandsTests.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ TEST(CommandMangler, Everything) {
4141
Mangler.ClangPath = testPath("fake/clang");
4242
Mangler.ResourceDir = testPath("fake/resources");
4343
Mangler.Sysroot = testPath("fake/sysroot");
44-
std::vector<std::string> Cmd = {"clang++", "-Xclang", "-load", "-Xclang",
45-
"plugin", "-MF", "dep", "foo.cc"};
44+
std::vector<std::string> Cmd = {"clang++", "-Xclang", "-load",
45+
"-Xclang", "plugin", "-MF",
46+
"dep", "--", "foo.cc"};
4647
Mangler.adjust(Cmd);
47-
EXPECT_THAT(Cmd, ElementsAre(testPath("fake/clang++"), "foo.cc",
48-
"-fsyntax-only",
48+
EXPECT_THAT(Cmd, ElementsAre(testPath("fake/clang++"), "-fsyntax-only",
4949
"-resource-dir=" + testPath("fake/resources"),
50-
"-isysroot", testPath("fake/sysroot")));
50+
"-isysroot", testPath("fake/sysroot"), "--",
51+
"foo.cc"));
5152
}
5253

5354
TEST(CommandMangler, ResourceDir) {
@@ -378,4 +379,3 @@ TEST(PrintArgvTest, All) {
378379
} // namespace
379380
} // namespace clangd
380381
} // namespace clang
381-

0 commit comments

Comments
 (0)