Skip to content

Commit 75216c0

Browse files
authored
merge main into amd-staging (llvm#4386)
2 parents baf44d7 + 994edf7 commit 75216c0

File tree

250 files changed

+6966
-3031
lines changed

Some content is hidden

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

250 files changed

+6966
-3031
lines changed

.ci/all_requirements.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,6 @@ ml-dtypes==0.5.1 ; python_version < "3.13" \
194194
--hash=sha256:d13755f8e8445b3870114e5b6240facaa7cb0c3361e54beba3e07fa912a6e12b \
195195
--hash=sha256:fd918d4e6a4e0c110e2e05be7a7814d10dc1b95872accbf6512b80a109b71ae1
196196
# via -r mlir/python/requirements.txt
197-
nanobind==2.9.2 \
198-
--hash=sha256:c37957ffd5eac7eda349cff3622ecd32e5ee1244ecc912c99b5bc8188bafd16e \
199-
--hash=sha256:e7608472de99d375759814cab3e2c94aba3f9ec80e62cfef8ced495ca5c27d6e
200-
# via -r mlir/python/requirements.txt
201197
numpy==2.0.2 \
202198
--hash=sha256:0123ffdaa88fa4ab64835dcbde75dcdf89c453c922f18dced6e27c90d1d0ec5a \
203199
--hash=sha256:11a76c372d1d37437857280aa142086476136a8c0f373b2e648ab2c8f18fb195 \
@@ -299,10 +295,6 @@ pyasn1-modules==0.4.2 \
299295
--hash=sha256:29253a9207ce32b64c3ac6600edc75368f98473906e8fd1043bd6b5b1de2c14a \
300296
--hash=sha256:677091de870a80aae844b1ca6134f54652fa2c8c5a52aa396440ac3106e941e6
301297
# via google-auth
302-
pybind11==2.13.6 \
303-
--hash=sha256:237c41e29157b962835d356b370ededd57594a26d5894a795960f0047cb5caf5 \
304-
--hash=sha256:ba6af10348c12b24e92fa086b39cfba0eff619b61ac77c406167d813b096d39a
305-
# via -r mlir/python/requirements.txt
306298
pyyaml==6.0.1 \
307299
--hash=sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5 \
308300
--hash=sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc \

clang-tools-extra/clangd/CodeComplete.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "support/Trace.h"
4444
#include "clang/AST/Decl.h"
4545
#include "clang/AST/DeclBase.h"
46+
#include "clang/AST/DeclTemplate.h"
4647
#include "clang/Basic/CharInfo.h"
4748
#include "clang/Basic/LangOptions.h"
4849
#include "clang/Basic/SourceLocation.h"
@@ -1886,7 +1887,15 @@ class CodeCompleteFlow {
18861887
for (auto &Cand : C.first) {
18871888
if (Cand.SemaResult &&
18881889
Cand.SemaResult->Kind == CodeCompletionResult::RK_Declaration) {
1889-
auto ID = clangd::getSymbolID(Cand.SemaResult->getDeclaration());
1890+
const NamedDecl *DeclToLookup = Cand.SemaResult->getDeclaration();
1891+
// For instantiations of members of class templates, the
1892+
// documentation will be stored at the member's original
1893+
// declaration.
1894+
if (const NamedDecl *Adjusted =
1895+
dyn_cast<NamedDecl>(&adjustDeclToTemplate(*DeclToLookup))) {
1896+
DeclToLookup = Adjusted;
1897+
}
1898+
auto ID = clangd::getSymbolID(DeclToLookup);
18901899
if (!ID)
18911900
continue;
18921901
Req.IDs.insert(ID);

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

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,23 +1154,45 @@ TEST(CompletionTest, CommentsOnMembersFromHeader) {
11541154
/// This is a member function.
11551155
int delta();
11561156
};
1157+
1158+
template <typename T>
1159+
struct beta {
1160+
/// This is a member field inside a template.
1161+
int omega;
1162+
1163+
/// This is a member function inside a template.
1164+
int epsilon();
1165+
};
11571166
)cpp";
11581167

11591168
auto File = testPath("foo.cpp");
11601169
Annotations Test(R"cpp(
11611170
#include "foo.h"
11621171
alpha a;
1163-
int x = a.^
1172+
beta<int> b;
1173+
int x = a.$p1^;
1174+
int y = b.$p2^;
11641175
)cpp");
11651176
runAddDocument(Server, File, Test.code());
11661177
auto CompletionList =
1167-
llvm::cantFail(runCodeComplete(Server, File, Test.point(), {}));
1178+
llvm::cantFail(runCodeComplete(Server, File, Test.point("p1"), {}));
11681179

11691180
EXPECT_THAT(CompletionList.Completions,
11701181
Contains(AllOf(named("gamma"), doc("This is a member field."))));
11711182
EXPECT_THAT(
11721183
CompletionList.Completions,
11731184
Contains(AllOf(named("delta"), doc("This is a member function."))));
1185+
1186+
CompletionList =
1187+
llvm::cantFail(runCodeComplete(Server, File, Test.point("p2"), {}));
1188+
1189+
EXPECT_THAT(CompletionList.Completions,
1190+
Contains(AllOf(named("omega")
1191+
/* FIXME: Doc retrieval does not work yet*/)));
1192+
EXPECT_THAT(
1193+
CompletionList.Completions,
1194+
Contains(AllOf(named("epsilon"),
1195+
doc("This is a member function inside a template."))));
11741196
}
11751197

11761198
TEST(CompletionTest, CommentsOnMembersFromHeaderOverloadBundling) {

clang/include/clang/AST/DeclTemplate.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3399,6 +3399,11 @@ inline UnsignedOrNone getExpandedPackSize(const NamedDecl *Param) {
33993399
/// for their AssociatedDecl.
34003400
TemplateParameterList *getReplacedTemplateParameterList(const Decl *D);
34013401

3402+
/// If we have a 'templated' declaration for a template, adjust 'D' to
3403+
/// refer to the actual template.
3404+
/// If we have an implicit instantiation, adjust 'D' to refer to template.
3405+
const Decl &adjustDeclToTemplate(const Decl &D);
3406+
34023407
} // namespace clang
34033408

34043409
#endif // LLVM_CLANG_AST_DECLTEMPLATE_H

clang/include/clang/Analysis/FlowSensitive/StorageLocation.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,17 @@ class RecordStorageLocation final : public StorageLocation {
144144
/// The synthetic field must exist.
145145
StorageLocation &getSyntheticField(llvm::StringRef Name) const {
146146
StorageLocation *Loc = SyntheticFields.lookup(Name);
147+
LLVM_DEBUG({
148+
if (Loc == nullptr) {
149+
llvm::dbgs() << "Couldn't find synthetic field " << Name
150+
<< " on StorageLocation " << this << " of type "
151+
<< getType() << "\n";
152+
llvm::dbgs() << "Existing synthetic fields:\n";
153+
for ([[maybe_unused]] const auto &[Name, Loc] : SyntheticFields) {
154+
llvm::dbgs() << Name << "\n";
155+
}
156+
}
157+
});
147158
assert(Loc != nullptr);
148159
return *Loc;
149160
}

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2409,28 +2409,36 @@ let Features = "avx512f", Attributes = [NoThrow, Const, RequiredVectorWidth<512>
24092409
def psraq512 : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<2, long long int>)">;
24102410
def psrld512 : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<4, int>)">;
24112411
def psrlq512 : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<2, long long int>)">;
2412+
}
2413+
2414+
let Features = "avx512f",
2415+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<512>] in {
24122416
def pternlogd512_mask : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>, _Vector<16, int>, _Constant int, unsigned short)">;
24132417
def pternlogd512_maskz : X86Builtin<"_Vector<16, int>(_Vector<16, int>, _Vector<16, int>, _Vector<16, int>, _Constant int, unsigned short)">;
24142418
def pternlogq512_mask : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<8, long long int>, _Vector<8, long long int>, _Constant int, unsigned char)">;
24152419
def pternlogq512_maskz : X86Builtin<"_Vector<8, long long int>(_Vector<8, long long int>, _Vector<8, long long int>, _Vector<8, long long int>, _Constant int, unsigned char)">;
24162420
}
24172421

2418-
let Features = "avx512vl", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in {
2422+
let Features = "avx512vl",
2423+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
24192424
def pternlogd128_mask : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>, _Vector<4, int>, _Constant int, unsigned char)">;
24202425
def pternlogd128_maskz : X86Builtin<"_Vector<4, int>(_Vector<4, int>, _Vector<4, int>, _Vector<4, int>, _Constant int, unsigned char)">;
24212426
}
24222427

2423-
let Features = "avx512vl", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
2428+
let Features = "avx512vl",
2429+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
24242430
def pternlogd256_mask : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>, _Vector<8, int>, _Constant int, unsigned char)">;
24252431
def pternlogd256_maskz : X86Builtin<"_Vector<8, int>(_Vector<8, int>, _Vector<8, int>, _Vector<8, int>, _Constant int, unsigned char)">;
24262432
}
24272433

2428-
let Features = "avx512vl", Attributes = [NoThrow, Const, RequiredVectorWidth<128>] in {
2434+
let Features = "avx512vl",
2435+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<128>] in {
24292436
def pternlogq128_mask : X86Builtin<"_Vector<2, long long int>(_Vector<2, long long int>, _Vector<2, long long int>, _Vector<2, long long int>, _Constant int, unsigned char)">;
24302437
def pternlogq128_maskz : X86Builtin<"_Vector<2, long long int>(_Vector<2, long long int>, _Vector<2, long long int>, _Vector<2, long long int>, _Constant int, unsigned char)">;
24312438
}
24322439

2433-
let Features = "avx512vl", Attributes = [NoThrow, Const, RequiredVectorWidth<256>] in {
2440+
let Features = "avx512vl",
2441+
Attributes = [NoThrow, Const, Constexpr, RequiredVectorWidth<256>] in {
24342442
def pternlogq256_mask : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<4, long long int>, _Vector<4, long long int>, _Constant int, unsigned char)">;
24352443
def pternlogq256_maskz : X86Builtin<"_Vector<4, long long int>(_Vector<4, long long int>, _Vector<4, long long int>, _Vector<4, long long int>, _Constant int, unsigned char)">;
24362444
}

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,9 @@ def warn_drv_fine_grained_bitfield_accesses_ignored : Warning<
696696
"option '-ffine-grained-bitfield-accesses' cannot be enabled together with a sanitizer; flag ignored">,
697697
InGroup<OptionIgnored>;
698698

699+
def err_drv_profile_instrument_use_path_with_no_kind : Error<
700+
"option '-fprofile-instrument-use-path=' requires -fprofile-instrument-use=<kind>">;
701+
699702
def note_drv_verify_prefix_spelling : Note<
700703
"-verify prefixes must start with a letter and contain only alphanumeric"
701704
" characters, hyphens, and underscores">;

clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
125125
cir::ConstantOp getTrue(mlir::Location loc) { return getBool(true, loc); }
126126

127127
cir::BoolType getBoolTy() { return cir::BoolType::get(getContext()); }
128+
cir::VoidType getVoidTy() { return cir::VoidType::get(getContext()); }
128129

129130
cir::PointerType getPointerTo(mlir::Type ty) {
130131
return cir::PointerType::get(ty);

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ struct MissingFeatures {
3737
static bool opGlobalDLLImportExport() { return false; }
3838
static bool opGlobalPartition() { return false; }
3939
static bool opGlobalUsedOrCompilerUsed() { return false; }
40+
static bool opGlobalAnnotations() { return false; }
41+
static bool opGlobalDtorLowering() { return false; }
42+
static bool opGlobalCtorAttr() { return false; }
43+
static bool opGlobalCtorPriority() { return false; }
44+
static bool opGlobalCtorList() { return false; }
4045
static bool setDSOLocal() { return false; }
4146
static bool setComdat() { return false; }
4247

clang/include/clang/Driver/Options.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8135,6 +8135,11 @@ def fprofile_instrument_path_EQ : Joined<["-"], "fprofile-instrument-path=">,
81358135
HelpText<"Generate instrumented code to collect execution counts into "
81368136
"<file> (overridden by LLVM_PROFILE_FILE env var)">,
81378137
MarshallingInfoString<CodeGenOpts<"InstrProfileOutput">>;
8138+
def fprofile_instrument_use_EQ : Joined<["-"], "fprofile-instrument-use=">,
8139+
HelpText<"Enable PGO use instrumentation">, Values<"none,clang,llvm,csllvm,sample-coldcov">,
8140+
NormalizedValuesScope<"llvm::driver::ProfileInstrKind">,
8141+
NormalizedValues<["ProfileNone", "ProfileClangInstr", "ProfileIRInstr", "ProfileCSIRInstr", "ProfileIRSampleColdCov"]>,
8142+
MarshallingInfoEnum<CodeGenOpts<"ProfileUse">, "ProfileNone">;
81388143
def fprofile_instrument_use_path_EQ :
81398144
Joined<["-"], "fprofile-instrument-use-path=">,
81408145
HelpText<"Specify the profile path in PGO use compilation">,

0 commit comments

Comments
 (0)