Skip to content

Commit 33f5c2a

Browse files
Merge branch 'llvm:main' into gh-101657
2 parents 0b68935 + 43be31e commit 33f5c2a

File tree

541 files changed

+30570
-9449
lines changed

Some content is hidden

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

541 files changed

+30570
-9449
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/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/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/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
//===----------------------------------------------------------------------===//

clang/include/clang/CIR/MissingFeatures.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ struct MissingFeatures {
8181
static bool opFuncCPUAndFeaturesAttributes() { return false; }
8282
static bool opFuncSection() { return false; }
8383
static bool opFuncSetComdat() { return false; }
84+
static bool opFuncAttributesForDefinition() { return false; }
8485

8586
// CallOp handling
8687
static bool opCallPseudoDtor() { return false; }
@@ -171,6 +172,7 @@ struct MissingFeatures {
171172
static bool astVarDeclInterface() { return false; }
172173
static bool stackSaveOp() { return false; }
173174
static bool aggValueSlot() { return false; }
175+
static bool aggValueSlotMayOverlap() { return false; }
174176
static bool generateDebugInfo() { return false; }
175177
static bool pointerOverflowSanitizer() { return false; }
176178
static bool fpConstraints() { return false; }
@@ -226,6 +228,8 @@ struct MissingFeatures {
226228
static bool implicitConstructorArgs() { return false; }
227229
static bool intrinsics() { return false; }
228230
static bool attributeNoBuiltin() { return false; }
231+
static bool thunks() { return false; }
232+
static bool runCleanupsScope() { return false; }
229233

230234
// Missing types
231235
static bool dataMemberType() { return false; }

0 commit comments

Comments
 (0)