Skip to content

Commit f18430a

Browse files
authored
Merge branch 'main' into users/rpatel321/lit-report-failures-only-option
2 parents 0c7747f + f77101e commit f18430a

File tree

202 files changed

+4238
-2545
lines changed

Some content is hidden

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

202 files changed

+4238
-2545
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,9 @@ void SizeofExpressionCheck::check(const MatchFinder::MatchResult &Result) {
400400
"suspicious usage of 'sizeof(array)/sizeof(...)';"
401401
" denominator differs from the size of array elements")
402402
<< E->getLHS()->getSourceRange() << E->getRHS()->getSourceRange();
403-
} else if (NumTy && DenomTy && NumTy == DenomTy) {
403+
} else if (NumTy && DenomTy && NumTy == DenomTy &&
404+
!NumTy->isDependentType()) {
405+
// Dependent type should not be compared.
404406
diag(E->getOperatorLoc(),
405407
"suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions "
406408
"have the same type")

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ Changes in existing checks
175175
- Improved :doc:`bugprone-sizeof-expression
176176
<clang-tidy/checks/bugprone/sizeof-expression>` check to find suspicious
177177
usages of ``sizeof()``, ``alignof()``, and ``offsetof()`` when adding or
178-
subtracting from a pointer directly or when used to scale a numeric value.
178+
subtracting from a pointer directly or when used to scale a numeric value and
179+
fix false positive when sizeof expression with template types.
179180

180181
- Improved :doc:`bugprone-throw-keyword-missing
181182
<clang-tidy/checks/bugprone/throw-keyword-missing>` by fixing a false positive

clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,3 +385,10 @@ int ValidExpressions() {
385385
sum += sizeof(PtrArray) / sizeof(A[0]);
386386
return sum;
387387
}
388+
389+
namespace gh115175 {
390+
template<class T>
391+
int ValidateTemplateTypeExpressions(T t) {
392+
return sizeof(t.val) / sizeof(t.val[0]);
393+
}
394+
} // namespace gh115175

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,8 @@ Bug Fixes to C++ Support
652652
an implicitly instantiated class template specialization. (#GH51051)
653653
- Fixed an assertion failure caused by invalid enum forward declarations. (#GH112208)
654654
- Name independent data members were not correctly initialized from default member initializers. (#GH114069)
655+
- Fixed expression transformation for ``[[assume(...)]]``, allowing using pack indexing expressions within the
656+
assumption if they also occur inside of a dependent lambda. (#GH114787)
655657

656658
Bug Fixes to AST Handling
657659
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -739,6 +741,7 @@ X86 Support
739741
* Supported intrinsics of ``_mm(256|512)_(mask(z))_loadrs_epi(8|16|32|64)``.
740742
- Support ISA of ``AMX-FP8``.
741743
- Support ISA of ``AMX-TRANSPOSE``.
744+
- Support ISA of ``AMX-MOVRS``.
742745
- Support ISA of ``AMX-AVX512``.
743746
- Support ISA of ``AMX-TF32``.
744747

clang/include/clang/Basic/BuiltinsX86_64.def

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ TARGET_BUILTIN(__builtin_ia32_uwrmsr, "vULLiULLi", "n", "usermsr")
117117
// AMX internal builtin
118118
TARGET_BUILTIN(__builtin_ia32_tile_loadconfig_internal, "vvC*", "n", "amx-tile")
119119
TARGET_BUILTIN(__builtin_ia32_tileloadd64_internal, "V256iUsUsvC*z", "n", "amx-tile")
120+
TARGET_BUILTIN(__builtin_ia32_tileloaddrs64_internal, "V256iUsUsvC*z", "n", "amx-movrs")
120121
TARGET_BUILTIN(__builtin_ia32_tileloaddt164_internal, "V256iUsUsvC*z", "n", "amx-tile")
122+
TARGET_BUILTIN(__builtin_ia32_tileloaddrst164_internal, "V256iUsUsvC*z", "n", "amx-movrs")
121123
TARGET_BUILTIN(__builtin_ia32_tdpbssd_internal, "V256iUsUsUsV256iV256iV256i", "n", "amx-int8")
122124
TARGET_BUILTIN(__builtin_ia32_tdpbsud_internal, "V256iUsUsUsV256iV256iV256i", "n", "amx-int8")
123125
TARGET_BUILTIN(__builtin_ia32_tdpbusd_internal, "V256iUsUsUsV256iV256iV256i", "n", "amx-int8")
@@ -129,10 +131,15 @@ TARGET_BUILTIN(__builtin_ia32_tdpfp16ps_internal, "V256iUsUsUsV256iV256iV256i",
129131
TARGET_BUILTIN(__builtin_ia32_tcmmimfp16ps_internal, "V256iUsUsUsV256iV256iV256i", "n", "amx-complex")
130132
TARGET_BUILTIN(__builtin_ia32_tcmmrlfp16ps_internal, "V256iUsUsUsV256iV256iV256i", "n", "amx-complex")
131133
TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz0_internal, "vUsUsUsV256i*V256i*vC*z", "n", "amx-transpose")
134+
TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz0rs_internal, "vUsUsUsV256i*V256i*vC*z", "n", "amx-movrs,amx-transpose")
132135
TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz0t1_internal, "vUsUsUsV256i*V256i*vC*z", "n", "amx-transpose")
136+
TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz0rst1_internal, "vUsUsUsV256i*V256i*vC*z", "n", "amx-movrs,amx-transpose")
133137
TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz1_internal, "vUsUsUsV256i*V256i*vC*z", "n", "amx-transpose")
138+
TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz1rs_internal, "vUsUsUsV256i*V256i*vC*z", "n", "amx-movrs,amx-transpose")
134139
TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz1t1_internal, "vUsUsUsV256i*V256i*vC*z", "n", "amx-transpose")
140+
TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz1rst1_internal, "vUsUsUsV256i*V256i*vC*z", "n", "amx-movrs,amx-transpose")
135141
TARGET_BUILTIN(__builtin_ia32_ttransposed_internal, "V256iUsUsV256i", "n", "amx-transpose")
142+
136143
TARGET_BUILTIN(__builtin_ia32_tcvtrowd2ps_internal, "V16fUsUsV256iUi", "n", "amx-avx512,avx10.2-512")
137144
TARGET_BUILTIN(__builtin_ia32_tcvtrowps2pbf16h_internal, "V32yUsUsV256iUi", "n", "amx-avx512,avx10.2-512")
138145
TARGET_BUILTIN(__builtin_ia32_tcvtrowps2pbf16l_internal, "V32yUsUsV256iUi", "n", "amx-avx512,avx10.2-512")
@@ -147,6 +154,13 @@ TARGET_BUILTIN(__builtin_ia32_tile_loadconfig, "vvC*", "n", "amx-tile")
147154
TARGET_BUILTIN(__builtin_ia32_tile_storeconfig, "vvC*", "n", "amx-tile")
148155
TARGET_BUILTIN(__builtin_ia32_tilerelease, "v", "n", "amx-tile")
149156
TARGET_BUILTIN(__builtin_ia32_tilezero, "vUc", "n", "amx-tile")
157+
TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz0rs, "vIUcvC*z", "n", "amx-movrs,amx-transpose")
158+
TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz0rst1, "vIUcvC*z", "n", "amx-movrs,amx-transpose")
159+
TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz1rs, "vIUcvC*z", "n", "amx-movrs,amx-transpose")
160+
TARGET_BUILTIN(__builtin_ia32_t2rpntlvwz1rst1, "vIUcvC*z", "n", "amx-movrs,amx-transpose")
161+
162+
TARGET_BUILTIN(__builtin_ia32_tileloaddrs64, "vIUcvC*z", "n", "amx-movrs")
163+
TARGET_BUILTIN(__builtin_ia32_tileloaddrst164, "vIUcvC*z", "n", "amx-movrs")
150164

151165
TARGET_BUILTIN(__builtin_ia32_tileloadd64, "vIUcvC*z", "n", "amx-tile")
152166
TARGET_BUILTIN(__builtin_ia32_tileloaddt164, "vIUcvC*z", "n", "amx-tile")

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6303,6 +6303,8 @@ def mamx_tile : Flag<["-"], "mamx-tile">, Group<m_x86_Features_Group>;
63036303
def mno_amx_tile : Flag<["-"], "mno-amx-tile">, Group<m_x86_Features_Group>;
63046304
def mamx_transpose : Flag<["-"], "mamx-transpose">, Group<m_x86_Features_Group>;
63056305
def mno_amx_transpose : Flag<["-"], "mno-amx-transpose">, Group<m_x86_Features_Group>;
6306+
def mamx_movrs: Flag<["-"], "mamx-movrs">, Group<m_x86_Features_Group>;
6307+
def mno_amx_movrs: Flag<["-"], "mno-amx-movrs">, Group<m_x86_Features_Group>;
63066308
def mcmpccxadd : Flag<["-"], "mcmpccxadd">, Group<m_x86_Features_Group>;
63076309
def mno_cmpccxadd : Flag<["-"], "mno-cmpccxadd">, Group<m_x86_Features_Group>;
63086310
def msse : Flag<["-"], "msse">, Group<m_x86_Features_Group>;

clang/include/clang/Lex/HeaderSearchOptions.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,10 @@ class HeaderSearchOptions {
255255
LLVM_PREFERRED_TYPE(bool)
256256
unsigned ModulesHashContent : 1;
257257

258+
/// Whether AST files should only contain the preprocessor information.
259+
LLVM_PREFERRED_TYPE(bool)
260+
unsigned ModulesSerializeOnlyPreprocessor : 1;
261+
258262
/// Whether we should include all things that could impact the module in the
259263
/// hash.
260264
///
@@ -288,6 +292,7 @@ class HeaderSearchOptions {
288292
ModulesSkipHeaderSearchPaths(false),
289293
ModulesSkipPragmaDiagnosticMappings(false),
290294
ModulesPruneNonAffectingModuleMaps(true), ModulesHashContent(false),
295+
ModulesSerializeOnlyPreprocessor(false),
291296
ModulesStrictContextHash(false), ModulesIncludeVFSUsage(false),
292297
AllowModuleMapSubdirectorySearch(true) {}
293298

clang/include/clang/Serialization/ASTWriter.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -929,9 +929,9 @@ class PCHGenerator : public SemaConsumer {
929929
void anchor() override;
930930

931931
Preprocessor &PP;
932+
llvm::PointerUnion<Sema *, Preprocessor *> Subject;
932933
std::string OutputFile;
933934
std::string isysroot;
934-
Sema *SemaPtr;
935935
std::shared_ptr<PCHBuffer> Buffer;
936936
llvm::BitstreamWriter Stream;
937937
ASTWriter Writer;
@@ -946,9 +946,7 @@ class PCHGenerator : public SemaConsumer {
946946
bool isComplete() const { return Buffer->IsComplete; }
947947
PCHBuffer *getBufferPtr() { return Buffer.get(); }
948948
StringRef getOutputFile() const { return OutputFile; }
949-
DiagnosticsEngine &getDiagnostics() const {
950-
return SemaPtr->getDiagnostics();
951-
}
949+
DiagnosticsEngine &getDiagnostics() const;
952950
Preprocessor &getPreprocessor() { return PP; }
953951

954952
virtual Module *getEmittingModule(ASTContext &Ctx);
@@ -964,7 +962,7 @@ class PCHGenerator : public SemaConsumer {
964962
bool GeneratingReducedBMI = false);
965963
~PCHGenerator() override;
966964

967-
void InitializeSema(Sema &S) override { SemaPtr = &S; }
965+
void InitializeSema(Sema &S) override;
968966
void HandleTranslationUnit(ASTContext &Ctx) override;
969967
void HandleVTable(CXXRecordDecl *RD) override { Writer.handleVTable(RD); }
970968
ASTMutationListener *GetASTMutationListener() override;

clang/lib/AST/ByteCode/Descriptor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ struct Descriptor final {
201201
SourceLocation getLocation() const;
202202
SourceInfo getLoc() const;
203203

204-
const Decl *asDecl() const { return Source.dyn_cast<const Decl *>(); }
205-
const Expr *asExpr() const { return Source.dyn_cast<const Expr *>(); }
204+
const Decl *asDecl() const { return dyn_cast<const Decl *>(Source); }
205+
const Expr *asExpr() const { return dyn_cast<const Expr *>(Source); }
206206
const DeclTy &getSource() const { return Source; }
207207

208208
const ValueDecl *asValueDecl() const {

clang/lib/AST/ByteCode/Function.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ class Function final {
9494

9595
/// Returns the original FunctionDecl.
9696
const FunctionDecl *getDecl() const {
97-
return Source.dyn_cast<const FunctionDecl *>();
97+
return dyn_cast<const FunctionDecl *>(Source);
9898
}
9999
const BlockExpr *getExpr() const {
100-
return Source.dyn_cast<const BlockExpr *>();
100+
return dyn_cast<const BlockExpr *>(Source);
101101
}
102102

103103
/// Returns the name of the function decl this code
@@ -146,18 +146,18 @@ class Function final {
146146
/// Checks if the function is a constructor.
147147
bool isConstructor() const {
148148
return isa_and_nonnull<CXXConstructorDecl>(
149-
Source.dyn_cast<const FunctionDecl *>());
149+
dyn_cast<const FunctionDecl *>(Source));
150150
}
151151
/// Checks if the function is a destructor.
152152
bool isDestructor() const {
153153
return isa_and_nonnull<CXXDestructorDecl>(
154-
Source.dyn_cast<const FunctionDecl *>());
154+
dyn_cast<const FunctionDecl *>(Source));
155155
}
156156

157157
/// Returns the parent record decl, if any.
158158
const CXXRecordDecl *getParentDecl() const {
159159
if (const auto *MD = dyn_cast_if_present<CXXMethodDecl>(
160-
Source.dyn_cast<const FunctionDecl *>()))
160+
dyn_cast<const FunctionDecl *>(Source)))
161161
return MD->getParent();
162162
return nullptr;
163163
}
@@ -166,7 +166,7 @@ class Function final {
166166
/// which we generate custom byte code for.
167167
bool isLambdaStaticInvoker() const {
168168
if (const auto *MD = dyn_cast_if_present<CXXMethodDecl>(
169-
Source.dyn_cast<const FunctionDecl *>()))
169+
dyn_cast<const FunctionDecl *>(Source)))
170170
return MD->isLambdaStaticInvoker();
171171
return false;
172172
}
@@ -175,7 +175,7 @@ class Function final {
175175
/// of a lambda record decl.
176176
bool isLambdaCallOperator() const {
177177
if (const auto *MD = dyn_cast_if_present<CXXMethodDecl>(
178-
Source.dyn_cast<const FunctionDecl *>()))
178+
dyn_cast<const FunctionDecl *>(Source)))
179179
return clang::isLambdaCallOperator(MD);
180180
return false;
181181
}

0 commit comments

Comments
 (0)