Skip to content

Commit b83af78

Browse files
committed
Merge branch 'main' of github.com:llvm/llvm-project into loop-vectorize/split-VPWidenIntOrFpInductionRecipe
2 parents 27c724e + e2c27fd commit b83af78

File tree

724 files changed

+35822
-11310
lines changed

Some content is hidden

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

724 files changed

+35822
-11310
lines changed

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ FilterMemProfile("filter-mem-profile",
6161
cl::init(true),
6262
cl::cat(AggregatorCategory));
6363

64+
static cl::opt<bool> ParseMemProfile(
65+
"parse-mem-profile",
66+
cl::desc("enable memory profile parsing if it's present in the input data, "
67+
"on by default unless `--itrace` is set."),
68+
cl::init(true), cl::cat(AggregatorCategory));
69+
6470
static cl::opt<unsigned long long>
6571
FilterPID("pid",
6672
cl::desc("only use samples from process with specified PID"),
@@ -181,6 +187,10 @@ void DataAggregator::start() {
181187
"script -F pid,event,ip",
182188
/*Wait = */false);
183189
} else if (!opts::ITraceAggregation.empty()) {
190+
// Disable parsing memory profile from trace data, unless requested by user.
191+
if (!opts::ParseMemProfile.getNumOccurrences())
192+
opts::ParseMemProfile = false;
193+
184194
std::string ItracePerfScriptArgs = llvm::formatv(
185195
"script -F pid,brstack --itrace={0}", opts::ITraceAggregation);
186196
launchPerfProcess("branch events with itrace", MainEventsPPI,
@@ -191,12 +201,9 @@ void DataAggregator::start() {
191201
/*Wait = */ false);
192202
}
193203

194-
// Note: we launch script for mem events regardless of the option, as the
195-
// command fails fairly fast if mem events were not collected.
196-
launchPerfProcess("mem events",
197-
MemEventsPPI,
198-
"script -F pid,event,addr,ip",
199-
/*Wait = */false);
204+
if (opts::ParseMemProfile)
205+
launchPerfProcess("mem events", MemEventsPPI, "script -F pid,event,addr,ip",
206+
/*Wait = */ false);
200207

201208
launchPerfProcess("process events", MMapEventsPPI,
202209
"script --show-mmap-events --no-itrace",
@@ -217,7 +224,8 @@ void DataAggregator::abort() {
217224
sys::Wait(TaskEventsPPI.PI, 1, &Error);
218225
sys::Wait(MMapEventsPPI.PI, 1, &Error);
219226
sys::Wait(MainEventsPPI.PI, 1, &Error);
220-
sys::Wait(MemEventsPPI.PI, 1, &Error);
227+
if (opts::ParseMemProfile)
228+
sys::Wait(MemEventsPPI.PI, 1, &Error);
221229

222230
deleteTempFiles();
223231

@@ -506,7 +514,8 @@ Error DataAggregator::preprocessProfile(BinaryContext &BC) {
506514
errs() << "PERF2BOLT: failed to parse samples\n";
507515

508516
// Special handling for memory events
509-
if (!prepareToParse("mem events", MemEventsPPI, MemEventsErrorCallback))
517+
if (opts::ParseMemProfile &&
518+
!prepareToParse("mem events", MemEventsPPI, MemEventsErrorCallback))
510519
if (const std::error_code EC = parseMemEvents())
511520
errs() << "PERF2BOLT: failed to parse memory events: " << EC.message()
512521
<< '\n';

clang-tools-extra/clang-tidy/modernize/UseIntegerSignComparisonCheck.cpp

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,21 @@ intCastExpression(bool IsSigned,
3939
// std::cmp_{} functions trigger a compile-time error if either LHS or RHS
4040
// is a non-integer type, char, enum or bool
4141
// (unsigned char/ signed char are Ok and can be used).
42-
const auto HasIntegerType = hasType(hasCanonicalType(qualType(
42+
auto IntTypeExpr = expr(hasType(hasCanonicalType(qualType(
4343
isInteger(), IsSigned ? isSignedInteger() : isUnsignedInteger(),
44-
unless(isActualChar()), unless(booleanType()), unless(enumType()))));
45-
46-
const auto IntTypeExpr = expr(HasIntegerType);
44+
unless(isActualChar()), unless(booleanType()), unless(enumType())))));
4745

4846
const auto ImplicitCastExpr =
4947
CastBindName.empty() ? implicitCastExpr(hasSourceExpression(IntTypeExpr))
5048
: implicitCastExpr(hasSourceExpression(IntTypeExpr))
5149
.bind(CastBindName);
5250

53-
const auto ExplicitCastExpr =
54-
anyOf(explicitCastExpr(has(ImplicitCastExpr)),
55-
ignoringImpCasts(explicitCastExpr(has(ImplicitCastExpr))));
56-
57-
// Match function calls or variable references not directly wrapped by an
58-
// implicit cast
59-
const auto CallIntExpr = CastBindName.empty()
60-
? callExpr(HasIntegerType)
61-
: callExpr(HasIntegerType).bind(CastBindName);
51+
const auto CStyleCastExpr = cStyleCastExpr(has(ImplicitCastExpr));
52+
const auto StaticCastExpr = cxxStaticCastExpr(has(ImplicitCastExpr));
53+
const auto FunctionalCastExpr = cxxFunctionalCastExpr(has(ImplicitCastExpr));
6254

63-
return expr(anyOf(ImplicitCastExpr, ExplicitCastExpr, CallIntExpr));
55+
return expr(anyOf(ImplicitCastExpr, CStyleCastExpr, StaticCastExpr,
56+
FunctionalCastExpr));
6457
}
6558

6659
static StringRef parseOpCode(BinaryOperator::Opcode Code) {

clang-tools-extra/clangd/refactor/Rename.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ getMappedRanges(ArrayRef<Range> Indexed, ArrayRef<SymbolRange> Lexed) {
13081308
return std::nullopt;
13091309
}
13101310
// Fast check for the special subset case.
1311-
if (std::includes(Indexed.begin(), Indexed.end(), Lexed.begin(), Lexed.end()))
1311+
if (llvm::includes(Indexed, Lexed))
13121312
return Lexed.vec();
13131313

13141314
std::vector<size_t> Best;

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,6 @@ Changes in existing checks
237237
<clang-tidy/checks/modernize/use-designated-initializers>` check by avoiding
238238
diagnosing designated initializers for ``std::array`` initializations.
239239

240-
- Improved :doc:`modernize-use-integer-sign-comparison
241-
<clang-tidy/checks/modernize/use-integer-sign-comparison>` check by matching
242-
valid integer expressions not directly wrapped around an implicit cast.
243-
244240
- Improved :doc:`modernize-use-ranges
245241
<clang-tidy/checks/modernize/use-ranges>` check by updating suppress
246242
warnings logic for ``nullptr`` in ``std::find``.

clang-tools-extra/test/clang-tidy/checkers/modernize/use-integer-sign-comparison.cpp

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -121,81 +121,3 @@ int AllComparisons() {
121121

122122
return 0;
123123
}
124-
125-
namespace PR127471 {
126-
int getSignedValue();
127-
unsigned int getUnsignedValue();
128-
129-
void callExprTest() {
130-
131-
if (getSignedValue() < getUnsignedValue())
132-
return;
133-
// CHECK-MESSAGES: :[[@LINE-2]]:13: warning: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison]
134-
// CHECK-FIXES: if (std::cmp_less(getSignedValue() , getUnsignedValue()))
135-
136-
int sVar = 0;
137-
if (getUnsignedValue() > sVar)
138-
return;
139-
// CHECK-MESSAGES: :[[@LINE-2]]:13: warning: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison]
140-
// CHECK-FIXES: if (std::cmp_greater(getUnsignedValue() , sVar))
141-
142-
unsigned int uVar = 0;
143-
if (getSignedValue() > uVar)
144-
return;
145-
// CHECK-MESSAGES: :[[@LINE-2]]:13: warning: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison]
146-
// CHECK-FIXES: if (std::cmp_greater(getSignedValue() , uVar))
147-
148-
}
149-
150-
// Add a class with member functions for testing member function calls
151-
class TestClass {
152-
public:
153-
int getSignedValue() { return -5; }
154-
unsigned int getUnsignedValue() { return 5; }
155-
};
156-
157-
void memberFunctionTests() {
158-
TestClass obj;
159-
160-
if (obj.getSignedValue() < obj.getUnsignedValue())
161-
return;
162-
// CHECK-MESSAGES: :[[@LINE-2]]:13: warning: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison]
163-
// CHECK-FIXES: if (std::cmp_less(obj.getSignedValue() , obj.getUnsignedValue()))
164-
}
165-
166-
void castFunctionTests() {
167-
// C-style casts with function calls
168-
if ((int)getUnsignedValue() < (unsigned int)getSignedValue())
169-
return;
170-
// CHECK-MESSAGES: :[[@LINE-2]]:13: warning: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison]
171-
// CHECK-FIXES: if (std::cmp_less(getUnsignedValue(),getSignedValue()))
172-
173-
174-
// Static casts with function calls
175-
if (static_cast<int>(getUnsignedValue()) < static_cast<unsigned int>(getSignedValue()))
176-
return;
177-
// CHECK-MESSAGES: :[[@LINE-2]]:13: warning: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison]
178-
// CHECK-FIXES: if (std::cmp_less(getUnsignedValue(),getSignedValue()))
179-
}
180-
181-
// Define tests
182-
#define SIGNED_FUNC getSignedValue()
183-
#define UNSIGNED_FUNC getUnsignedValue()
184-
185-
void defineTests() {
186-
if (SIGNED_FUNC < UNSIGNED_FUNC)
187-
return;
188-
// CHECK-MESSAGES: :[[@LINE-2]]:13: warning: comparison between 'signed' and 'unsigned' integers [modernize-use-integer-sign-comparison]
189-
// CHECK-FIXES: if (std::cmp_less(SIGNED_FUNC , UNSIGNED_FUNC))
190-
}
191-
192-
// Template tests (should not warn)
193-
template <typename T1>
194-
void templateFunctionTest(T1 value) {
195-
if (value() < getUnsignedValue())
196-
return;
197-
198-
if (value() < (getSignedValue() || getUnsignedValue()))
199-
return;
200-
}
201-
} // namespace PR127471

clang/docs/HIPSupport.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
HIP Support
1818
=============
1919

20-
HIP (Heterogeneous-Compute Interface for Portability) `<https://github.com/ROCm-Developer-Tools/HIP>`_ is
20+
HIP (Heterogeneous-Compute Interface for Portability) `<https://github.com/ROCm/HIP>`_ is
2121
a C++ Runtime API and Kernel Language. It enables developers to create portable applications for
2222
offloading computation to different hardware platforms from a single source code.
2323

@@ -41,9 +41,9 @@ backend or the out-of-tree LLVM-SPIRV translator. The SPIR-V is then bundled and
4141
.. note::
4242
While Clang does not directly provide HIP support for NVIDIA GPUs and CPUs, these platforms are supported via other means:
4343

44-
- NVIDIA GPUs: HIP support is offered through the HIP project `<https://github.com/ROCm-Developer-Tools/HIP>`_, which provides a header-only library for translating HIP runtime APIs into CUDA runtime APIs. The code is subsequently compiled using NVIDIA's `nvcc`.
44+
- NVIDIA GPUs: HIP support is offered through the HIP project `<https://github.com/ROCm/HIP>`_, which provides a header-only library for translating HIP runtime APIs into CUDA runtime APIs. The code is subsequently compiled using NVIDIA's `nvcc`.
4545

46-
- CPUs: HIP support is available through the HIP-CPU runtime library `<https://github.com/ROCm-Developer-Tools/HIP-CPU>`_. This header-only library enables CPUs to execute unmodified HIP code.
46+
- CPUs: HIP support is available through the HIP-CPU runtime library `<https://github.com/ROCm/HIP-CPU>`_. This header-only library enables CPUs to execute unmodified HIP code.
4747

4848

4949
Example Usage
@@ -328,7 +328,7 @@ The `parallel_unsequenced_policy <https://en.cppreference.com/w/cpp/algorithm/ex
328328
maps relatively well to the execution model of AMD GPUs. This, coupled with the
329329
the availability and maturity of GPU accelerated algorithm libraries that
330330
implement most / all corresponding algorithms in the standard library
331-
(e.g. `rocThrust <https://github.com/ROCmSoftwarePlatform/rocThrust>`__), makes
331+
(e.g. `rocThrust <https://github.com/ROCm/rocm-libraries/tree/develop/projects/rocthrust>`__), makes
332332
it feasible to provide seamless accelerator offload for supported algorithms,
333333
when an accelerated version exists. Thus, it becomes possible to easily access
334334
the computational resources of an AMD accelerator, via a well specified,
@@ -483,7 +483,7 @@ such as GPUs, work.
483483
allocation / deallocation functions with accelerator-aware equivalents,
484484
based on a pre-established table; the list of functions that can be
485485
interposed is available
486-
`here <https://github.com/ROCmSoftwarePlatform/roc-stdpar#allocation--deallocation-interposition-status>`__;
486+
`here <https://github.com/ROCm/roc-stdpar#allocation--deallocation-interposition-status>`__;
487487
- This is only run when compiling for the host.
488488

489489
The second pass is optional.
@@ -627,7 +627,7 @@ Linux operating system. Support is synthesised in the following table:
627627
The minimum Linux kernel version for running in HMM mode is 6.4.
628628

629629
The forwarding header can be obtained from
630-
`its GitHub repository <https://github.com/ROCmSoftwarePlatform/roc-stdpar>`_.
630+
`its GitHub repository <https://github.com/ROCm/roc-stdpar>`_.
631631
It will be packaged with a future `ROCm <https://rocm.docs.amd.com/en/latest/>`_
632632
release. Because accelerated algorithms are provided via
633633
`rocThrust <https://rocm.docs.amd.com/projects/rocThrust/en/latest/>`_, a
@@ -636,7 +636,7 @@ transitive dependency on
636636
can be obtained either by installing their associated components of the
637637
`ROCm <https://rocm.docs.amd.com/en/latest/>`_ stack, or from their respective
638638
repositories. The list algorithms that can be offloaded is available
639-
`here <https://github.com/ROCmSoftwarePlatform/roc-stdpar#algorithm-support-status>`_.
639+
`here <https://github.com/ROCm/roc-stdpar#algorithm-support-status>`_.
640640

641641
HIP Specific Elements
642642
---------------------

clang/docs/SanitizerSpecialCaseList.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ precedence. Here are a few examples.
109109
.. code-block:: bash
110110
111111
$ cat ignorelist1.txt
112-
# test.cc will be instrumented.
112+
# test.cc will not be instrumented.
113113
src:*
114114
src:*/mylib/*=sanitize
115115
src:*/mylib/test.cc
116116
117117
$ cat ignorelist2.txt
118-
# test.cc will not be instrumented.
118+
# test.cc will be instrumented.
119119
src:*
120120
src:*/mylib/test.cc
121121
src:*/mylib/*=sanitize

clang/include/clang/AST/ASTContext.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,8 @@ class ASTContext : public RefCountedBase<ASTContext> {
488488
/// if possible.
489489
///
490490
/// Not serialized intentionally.
491-
llvm::StringMap<const Module *> PrimaryModuleNameMap;
492-
llvm::DenseMap<const Module *, const Module *> SameModuleLookupSet;
491+
mutable llvm::StringMap<const Module *> PrimaryModuleNameMap;
492+
mutable llvm::DenseMap<const Module *, const Module *> SameModuleLookupSet;
493493

494494
static constexpr unsigned ConstantArrayTypesLog2InitSize = 8;
495495
static constexpr unsigned GeneralTypesLog2InitSize = 9;
@@ -1151,7 +1151,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
11511151
///
11521152
/// FIXME: The signature may be confusing since `clang::Module` means to
11531153
/// a module fragment or a module unit but not a C++20 module.
1154-
bool isInSameModule(const Module *M1, const Module *M2);
1154+
bool isInSameModule(const Module *M1, const Module *M2) const;
11551155

11561156
TranslationUnitDecl *getTranslationUnitDecl() const {
11571157
return TUDecl->getMostRecentDecl();

clang/include/clang/AST/DeclBase.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,10 @@ class alignas(8) Decl {
646646
return getModuleOwnershipKind() == ModuleOwnershipKind::ModulePrivate;
647647
}
648648

649+
/// Whether this declaration was a local declaration to a C++20
650+
/// named module.
651+
bool isModuleLocal() const;
652+
649653
/// Whether this declaration was exported in a lexical context.
650654
/// e.g.:
651655
///

clang/include/clang/Basic/Attr.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4630,6 +4630,7 @@ def OMPDeclareVariant : InheritableAttr {
46304630
OMPTraitInfoArgument<"TraitInfos">,
46314631
VariadicExprArgument<"AdjustArgsNothing">,
46324632
VariadicExprArgument<"AdjustArgsNeedDevicePtr">,
4633+
VariadicExprArgument<"AdjustArgsNeedDeviceAddr">,
46334634
VariadicOMPInteropInfoArgument<"AppendArgs">,
46344635
];
46354636
let AdditionalMembers = [{

clang/include/clang/Basic/Diagnostic.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,13 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
424424
bool empty() const { return Files.empty(); }
425425

426426
/// Clear out this map.
427-
void clear() {
427+
void clear(bool Soft) {
428+
// Just clear the cache when in soft mode.
428429
Files.clear();
429-
FirstDiagState = CurDiagState = nullptr;
430-
CurDiagStateLoc = SourceLocation();
430+
if (!Soft) {
431+
FirstDiagState = CurDiagState = nullptr;
432+
CurDiagStateLoc = SourceLocation();
433+
}
431434
}
432435

433436
/// Produce a debugging dump of the diagnostic state.
@@ -920,6 +923,10 @@ class DiagnosticsEngine : public RefCountedBase<DiagnosticsEngine> {
920923
/// Reset the state of the diagnostic object to its initial configuration.
921924
/// \param[in] soft - if true, doesn't reset the diagnostic mappings and state
922925
void Reset(bool soft = false);
926+
/// We keep a cache of FileIDs for diagnostics mapped by pragmas. These might
927+
/// get invalidated when diagnostics engine is shared across different
928+
/// compilations. Provide users with a way to reset that.
929+
void ResetPragmas();
923930

924931
//===--------------------------------------------------------------------===//
925932
// DiagnosticsEngine classification and reporting interfaces.

clang/include/clang/Basic/DiagnosticDriverKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ def err_drv_cannot_open_randomize_layout_seed_file : Error<
206206
"cannot read randomize layout seed file '%0'">;
207207
def err_drv_invalid_version_number : Error<
208208
"invalid version number in '%0'">;
209+
def err_drv_invalid_version_number_inferred
210+
: Error<"invalid version number '%0' inferred from '%1'">;
209211
def err_drv_missing_version_number : Error<"missing version number in '%0'">;
210212
def err_drv_kcfi_arity_unsupported_target : Error<
211213
"target '%0' is unsupported by -fsanitize-kcfi-arity">;

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,8 +1581,10 @@ def err_omp_unexpected_append_op : Error<
15811581
"unexpected operation specified in 'append_args' clause, expected 'interop'">;
15821582
def err_omp_unexpected_execution_modifier : Error<
15831583
"unexpected 'execution' modifier in non-executable context">;
1584-
def err_omp_unknown_adjust_args_op : Error<
1585-
"incorrect adjust_args type, expected 'need_device_ptr' or 'nothing'">;
1584+
def err_omp_unknown_adjust_args_op
1585+
: Error<
1586+
"incorrect 'adjust_args' type, expected 'need_device_ptr'%select{|, "
1587+
"'need_device_addr',}0 or 'nothing'">;
15861588
def err_omp_declare_variant_wrong_clause : Error<
15871589
"expected %select{'match'|'match', 'adjust_args', or 'append_args'}0 clause "
15881590
"on 'omp declare variant' directive">;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,8 @@ def note_unsatisfied_trait
17671767
: Note<"%0 is not %enum_select<TraitName>{"
17681768
"%TriviallyRelocatable{trivially relocatable}|"
17691769
"%Replaceable{replaceable}|"
1770-
"%TriviallyCopyable{trivially copyable}"
1770+
"%TriviallyCopyable{trivially copyable}|"
1771+
"%Constructible{constructible with provided types}"
17711772
"}1">;
17721773

17731774
def note_unsatisfied_trait_reason
@@ -1797,7 +1798,10 @@ def note_unsatisfied_trait_reason
17971798
"%DeletedAssign{has a deleted %select{copy|move}1 "
17981799
"assignment operator}|"
17991800
"%UnionWithUserDeclaredSMF{is a union with a user-declared "
1800-
"%sub{select_special_member_kind}1}"
1801+
"%sub{select_special_member_kind}1}|"
1802+
"%FunctionType{is a function type}|"
1803+
"%CVVoidType{is a cv void type}|"
1804+
"%IncompleteArrayType{is an incomplete array type}"
18011805
"}0">;
18021806

18031807
def warn_consteval_if_always_true : Warning<

clang/include/clang/Basic/OpenMPKinds.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ OPENMP_ORIGINAL_SHARING_MODIFIER(default)
214214
// Adjust-op kinds for the 'adjust_args' clause.
215215
OPENMP_ADJUST_ARGS_KIND(nothing)
216216
OPENMP_ADJUST_ARGS_KIND(need_device_ptr)
217+
OPENMP_ADJUST_ARGS_KIND(need_device_addr)
217218

218219
// Binding kinds for the 'bind' clause.
219220
OPENMP_BIND_KIND(teams)

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,6 +2059,7 @@ def VecCreateOp : CIR_Op<"vec.create", [Pure]> {
20592059
}];
20602060

20612061
let hasVerifier = 1;
2062+
let hasFolder = 1;
20622063
}
20632064

20642065
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)