Skip to content

Commit 3abd248

Browse files
authored
Merge branch 'llvm:main' into partial_chunk_heuristic
2 parents c3a2be9 + 65f66d2 commit 3abd248

File tree

1,327 files changed

+48623
-15472
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,327 files changed

+48623
-15472
lines changed

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ jobs:
146146
'generic-no-experimental',
147147
'generic-no-filesystem',
148148
'generic-no-localization',
149+
'generic-no-terminal',
149150
'generic-no-random_device',
150151
'generic-no-threads',
151152
'generic-no-tzdb',

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2502,7 +2502,7 @@ void BinaryFunction::annotateCFIState() {
25022502
}
25032503
}
25042504

2505-
if (!StateStack.empty()) {
2505+
if (opts::Verbosity >= 1 && !StateStack.empty()) {
25062506
BC.errs() << "BOLT-WARNING: non-empty CFI stack at the end of " << *this
25072507
<< '\n';
25082508
}

bolt/lib/Core/BinaryFunctionProfile.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ void BinaryFunction::inferFallThroughCounts() {
336336
if (SuccBI.Count == 0) {
337337
SuccBI.Count = Inferred;
338338
SuccBI.MispredictedCount = BinaryBasicBlock::COUNT_INFERRED;
339-
Succ->ExecutionCount += Inferred;
339+
Succ->ExecutionCount =
340+
std::max(Succ->getKnownExecutionCount(), Inferred);
340341
}
341342
}
342343
}

bolt/test/X86/infer-fall-throughs.s

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## Test that infer-fall-throughs would correctly infer the wrong fall-through
2+
## edge count in the example
3+
4+
# RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o
5+
# RUN: link_fdata %s %t.o %t.fdata
6+
# RUN: llvm-strip --strip-unneeded %t.o
7+
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
8+
# RUN: llvm-bolt %t.exe -o %t.bolt \
9+
# RUN: --print-estimate-edge-counts --data=%t.fdata \
10+
# RUN: 2>&1 | FileCheck --check-prefix=WITHOUTINFERENCE %s
11+
# RUN: llvm-bolt %t.exe -o %t.bolt --infer-fall-throughs \
12+
# RUN: --print-estimate-edge-counts --data=%t.fdata \
13+
# RUN: 2>&1 | FileCheck --check-prefix=CORRECTINFERENCE %s
14+
15+
16+
# WITHOUTINFERENCE: Binary Function "main" after estimate-edge-counts
17+
# WITHOUTINFERENCE: {{^\.Ltmp0}}
18+
# WITHOUTINFERENCE: Successors: .Ltmp1 (mispreds: 0, count: 10), .LFT0 (mispreds: 0, count: 0)
19+
# WITHOUTINFERENCE: {{^\.LFT0}}
20+
# WITHOUTINFERENCE: Exec Count : 490
21+
22+
# CORRECTINFERENCE: Binary Function "main" after estimate-edge-counts
23+
# CORRECTINFERENCE: {{^\.Ltmp0}}
24+
# CORRECTINFERENCE: Successors: .Ltmp1 (mispreds: 0, count: 10), .LFT0 (inferred count: 490)
25+
# CORRECTINFERENCE: {{^\.LFT0}}
26+
# CORRECTINFERENCE: Exec Count : 490
27+
28+
29+
.globl main
30+
.type main, @function
31+
main:
32+
LLmain_LLstart:
33+
jmp LLstart
34+
# FDATA: 1 main #LLmain_LLstart# 1 main #LLstart# 0 500
35+
LLstart:
36+
jge LLexit
37+
# FDATA: 1 main #LLstart# 1 main #LLexit# 0 10
38+
# FDATA: 1 main #LLstart# 1 main #LLmore# 0 0
39+
LLmore:
40+
movl $5, %eax
41+
# FDATA: 1 main #LLmore# 1 main #LLexit# 0 490
42+
LLexit:
43+
ret
44+
.LLmain_end:
45+
.size main, .LLmain_end-main

clang-tools-extra/clang-doc/HTMLGenerator.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,19 @@ static std::unique_ptr<HTMLNode> genHTML(const CommentInfo &I) {
678678
return std::move(ParagraphComment);
679679
}
680680

681+
if (I.Kind == "BlockCommandComment") {
682+
auto BlockComment = std::make_unique<TagNode>(HTMLTag::TAG_DIV);
683+
BlockComment->Children.emplace_back(
684+
std::make_unique<TagNode>(HTMLTag::TAG_DIV, I.Name));
685+
for (const auto &Child : I.Children) {
686+
std::unique_ptr<HTMLNode> Node = genHTML(*Child);
687+
if (Node)
688+
BlockComment->Children.emplace_back(std::move(Node));
689+
}
690+
if (BlockComment->Children.empty())
691+
return nullptr;
692+
return std::move(BlockComment);
693+
}
681694
if (I.Kind == "TextComment") {
682695
if (I.Text == "")
683696
return nullptr;

clang-tools-extra/test/clang-doc/basic-project.test

Lines changed: 68 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,32 +56,62 @@
5656

5757
// HTML-SHAPE: <h1>class Shape</h1>
5858
// HTML-SHAPE: <p>Defined at line 8 of file {{.*}}Shape.h</p>
59+
// HTML-SHAPE: <div>brief</div>
60+
// HTML-SHAPE: <p> Abstract base class for shapes.</p>
5961
// HTML-SHAPE: <p> Provides a common interface for different types of shapes.</p>
6062
// HTML-SHAPE: <h2 id="Functions">Functions</h2>
6163
// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
6264
// HTML-SHAPE: <p>public double area()</p>
65+
// HTML-SHAPE: <div>brief</div>
66+
// HTML-SHAPE: <p> Calculates the area of the shape.</p>
6367
// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
6468
// HTML-SHAPE: <p>public double perimeter()</p>
69+
// HTML-SHAPE: <div>brief</div>
70+
// HTML-SHAPE: <p> Calculates the perimeter of the shape.</p>
71+
// HTML-SHAPE: <div>return</div>
72+
// HTML-SHAPE: <p> double The perimeter of the shape.</p>
6573
// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">~Shape</h3>
6674
// HTML-SHAPE: <p>public void ~Shape()</p>
6775
// HTML-SHAPE: <p>Defined at line 13 of file {{.*}}Shape.h</p>
76+
// HTML-SHAPE: <div>brief</div>
77+
// HTML-SHAPE: <p> Virtual destructor.</p>
6878

69-
// HTML-CALC: <h1>class Calculator</h1>
70-
// HTML-CALC: <p>Defined at line 8 of file {{.*}}Calculator.h</p>
71-
// HTML-CALC: <p> Provides basic arithmetic operations.</p>
72-
// HTML-CALC: <h2 id="Functions">Functions</h2>
73-
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">add</h3>
74-
// HTML-CALC: <p>public int add(int a, int b)</p>
75-
// HTML-CALC: <p>Defined at line 3 of file {{.*}}Calculator.cpp</p>
76-
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">subtract</h3>
77-
// HTML-CALC: <p>public int subtract(int a, int b)</p>
78-
// HTML-CALC: <p>Defined at line 7 of file {{.*}}Calculator.cpp</p>
79-
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">multiply</h3>
80-
// HTML-CALC: <p>public int multiply(int a, int b)</p>
81-
// HTML-CALC: <p>Defined at line 11 of file {{.*}}Calculator.cpp</p>
82-
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">divide</h3>
83-
// HTML-CALC: <p>public double divide(int a, int b)</p>
84-
// HTML-CALC: <p>Defined at line 15 of file {{.*}}Calculator.cpp</p>
79+
// HTML-CALC: <h1>class Calculator</h1>
80+
// HTML-CALC: <p>Defined at line 8 of file {{.*}}Calculator.h</p>
81+
// HTML-CALC: <div>brief</div>
82+
// HTML-CALC: <p> A simple calculator class.</p>
83+
// HTML-CALC: <p> Provides basic arithmetic operations.</p>
84+
// HTML-CALC: <h2 id="Functions">Functions</h2>
85+
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">add</h3>
86+
// HTML-CALC: <p>public int add(int a, int b)</p>
87+
// HTML-CALC: <p>Defined at line 3 of file {{.*}}Calculator.cpp</p>
88+
// HTML-CALC: <div>brief</div>
89+
// HTML-CALC: <p> Adds two integers.</p>
90+
// HTML-CALC: <div>return</div>
91+
// HTML-CALC: <p> int The sum of a and b.</p>
92+
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">subtract</h3>
93+
// HTML-CALC: <p>public int subtract(int a, int b)</p>
94+
// HTML-CALC: <p>Defined at line 7 of file {{.*}}Calculator.cpp</p>
95+
// HTML-CALC: <div>brief</div>
96+
// HTML-CALC: <p> Subtracts the second integer from the first.</p>
97+
// HTML-CALC: <div>return</div>
98+
// HTML-CALC: <p> int The result of a - b.</p>
99+
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">multiply</h3>
100+
// HTML-CALC: <p>public int multiply(int a, int b)</p>
101+
// HTML-CALC: <p>Defined at line 11 of file {{.*}}Calculator.cpp</p>
102+
// HTML-CALC: <div>brief</div>
103+
// HTML-CALC: <p> Multiplies two integers.</p>
104+
// HTML-CALC: <div>return</div>
105+
// HTML-CALC: <p> int The product of a and b.</p>
106+
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">divide</h3>
107+
// HTML-CALC: <p>public double divide(int a, int b)</p>
108+
// HTML-CALC: <p>Defined at line 15 of file {{.*}}Calculator.cpp</p>
109+
// HTML-CALC: <div>brief</div>
110+
// HTML-CALC: <p> Divides the first integer by the second.</p>
111+
// HTML-CALC: <div>return</div>
112+
// HTML-CALC: <p> double The result of a / b.</p>
113+
// HTML-CALC: <div>throw</div>
114+
// HTML-CALC: <p>if b is zero.</p>
85115

86116
// HTML-RECTANGLE: <h1>class Rectangle</h1>
87117
// HTML-RECTANGLE: <p>Defined at line 10 of file {{.*}}Rectangle.h</p>
@@ -99,15 +129,27 @@
99129
// HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">Rectangle</h3>
100130
// HTML-RECTANGLE: <p>public void Rectangle(double width, double height)</p>
101131
// HTML-RECTANGLE: <p>Defined at line 3 of file {{.*}}Rectangle.cpp</p>
132+
// HTML-RECTANGLE: <div>brief</div>
133+
// HTML-RECTANGLE: <p> Constructs a new Rectangle object.</p>
102134
// HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
103135
// HTML-RECTANGLE: <p>public double area()</p>
104136
// HTML-RECTANGLE: <p>Defined at line 6 of file {{.*}}Rectangle.cpp</p>
137+
// HTML-RECTANGLE: <div>brief</div>
138+
// HTML-RECTANGLE: <p> Calculates the area of the rectangle.</p>
139+
// HTML-RECTANGLE: <div>return</div>
140+
// HTML-RECTANGLE: <p> double The area of the rectangle.</p>
105141
// HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
106142
// HTML-RECTANGLE: <p>public double perimeter()</p>
107143
// HTML-RECTANGLE: <p>Defined at line 10 of file {{.*}}Rectangle.cpp</p>
144+
// HTML-RECTANGLE: <div>brief</div>
145+
// HTML-RECTANGLE: <p> Calculates the perimeter of the rectangle.</p>
146+
// HTML-RECTANGLE: <div>return</div>
147+
// HTML-RECTANGLE: <p> double The perimeter of the rectangle.</p>
108148

109149
// HTML-CIRCLE: <h1>class Circle</h1>
110150
// HTML-CIRCLE: <p>Defined at line 10 of file {{.*}}Circle.h</p>
151+
// HTML-CIRCLE: <div>brief</div>
152+
// HTML-CIRCLE: <p> Circle class derived from Shape.</p>
111153
// HTML-CIRCLE: <p> Represents a circle with a given radius.</p>
112154
// HTML-CIRCLE: <p>
113155
// HTML-CIRCLE: Inherits from
@@ -120,12 +162,22 @@
120162
// HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">Circle</h3>
121163
// HTML-CIRCLE: <p>public void Circle(double radius)</p>
122164
// HTML-CIRCLE: <p>Defined at line 3 of file {{.*}}Circle.cpp</p>
165+
// HTML-CIRCLE: <div>brief</div>
166+
// HTML-CIRCLE: <p> Constructs a new Circle object.</p>
123167
// HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
124168
// HTML-CIRCLE: <p>public double area()</p>
125169
// HTML-CIRCLE: <p>Defined at line 5 of file {{.*}}Circle.cpp</p>
170+
// HTML-CIRCLE: <div>brief</div>
171+
// HTML-CIRCLE: <p> Calculates the area of the circle.</p>
172+
// HTML-CIRCLE: <div>return</div>
173+
// HTML-CIRCLE: <p> double The area of the circle.</p>
126174
// HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
127175
// HTML-CIRCLE: <p>public double perimeter()</p>
128176
// HTML-CIRCLE: <p>Defined at line 9 of file {{.*}}Circle.cpp</p>
177+
// HTML-CIRCLE: <div>brief</div>
178+
// HTML-CIRCLE: <p> Calculates the perimeter of the circle.</p>
179+
// HTML-CIRCLE: <div>return</div>
180+
// HTML-CIRCLE: <p> double The perimeter of the circle.</p>
129181

130182
// MD-CALC: # class Calculator
131183
// MD-CALC: *Defined at .{{[\/]}}include{{[\/]}}Calculator.h#8*

clang/cmake/caches/CrossWinToARMLinux.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ endif()
108108

109109
message(STATUS "Toolchain target to build: ${LLVM_TARGETS_TO_BUILD}")
110110

111-
# Allow to override libc++ ABI version. Use 2 by default.
111+
# Allow to override libc++ ABI version (1 is default).
112112
if (NOT DEFINED LIBCXX_ABI_VERSION)
113-
set(LIBCXX_ABI_VERSION 2)
113+
set(LIBCXX_ABI_VERSION 1)
114114
endif()
115115

116116
message(STATUS "Toolchain's Libc++ ABI version: ${LIBCXX_ABI_VERSION}")
@@ -217,6 +217,8 @@ set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_ENABLE_SHARED
217217
set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_ABI_VERSION ${LIBCXX_ABI_VERSION} CACHE STRING "")
218218
set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_CXX_ABI "libcxxabi" CACHE STRING "") #!!!
219219
set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
220+
# Merge libc++ and libc++abi libraries into the single libc++ library file.
221+
set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
220222

221223
# Avoid searching for the python3 interpreter during the runtimes configuration for the cross builds.
222224
# It starts searching the python3 package using the target's sysroot path, that usually is not compatible with the build host.

clang/docs/InternalsManual.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3200,7 +3200,7 @@ are similar.
32003200
always involve two functions: an ``ActOnXXX`` function that will be called
32013201
directly from the parser, and a ``BuildXXX`` function that performs the
32023202
actual semantic analysis and will (eventually!) build the AST node. It's
3203-
fairly common for the ``ActOnCXX`` function to do very little (often just
3203+
fairly common for the ``ActOnXXX`` function to do very little (often just
32043204
some minor translation from the parser's representation to ``Sema``'s
32053205
representation of the same thing), but the separation is still important:
32063206
C++ template instantiation, for example, should always call the ``BuildXXX``

clang/docs/LanguageExtensions.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3987,7 +3987,7 @@ ellipsis (``...``) in the function signature. Alternatively, in C23 mode or
39873987
later, it may be the integer literal ``0`` if there is no parameter preceding
39883988
the ellipsis. This function initializes the given ``__builtin_va_list`` object.
39893989
It is undefined behavior to call this function on an already initialized
3990-
``__builin_va_list`` object.
3990+
``__builtin_va_list`` object.
39913991
39923992
* ``void __builtin_va_end(__builtin_va_list list)``
39933993
@@ -4321,7 +4321,7 @@ an appropriate value during the emission.
43214321
43224322
Note that there is no builtin matching the `llvm.coro.save` intrinsic. LLVM
43234323
automatically will insert one if the first argument to `llvm.coro.suspend` is
4324-
token `none`. If a user calls `__builin_suspend`, clang will insert `token none`
4324+
token `none`. If a user calls `__builtin_suspend`, clang will insert `token none`
43254325
as the first argument to the intrinsic.
43264326
43274327
Source location builtins

clang/docs/ReleaseNotes.rst

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ Resolutions to C++ Defect Reports
149149
of the target type, even if the type of the bit-field is larger.
150150
(`CWG2627: Bit-fields and narrowing conversions <https://cplusplus.github.io/CWG/issues/2627.html>`_)
151151

152+
- ``nullptr`` is now promoted to ``void*`` when passed to a C-style variadic function.
153+
(`CWG722: Can nullptr be passed to an ellipsis? <https://cplusplus.github.io/CWG/issues/722.html>`_)
154+
155+
- Allow ``void{}`` as a prvalue of type ``void``.
156+
(`CWG2351: void{} <https://cplusplus.github.io/CWG/issues/2351.html>`_).
157+
152158
C Language Changes
153159
------------------
154160

@@ -176,6 +182,14 @@ Modified Compiler Flags
176182

177183
- The compiler flag `-fbracket-depth` default value is increased from 256 to 2048.
178184

185+
- The ``-ffp-model`` option has been updated to enable a more limited set of
186+
optimizations when the ``fast`` argument is used and to accept a new argument,
187+
``aggressive``. The behavior of ``-ffp-model=aggressive`` is equivalent
188+
to the previous behavior of ``-ffp-model=fast``. The updated
189+
``-ffp-model=fast`` behavior no longer assumes finite math only and uses
190+
the ``promoted`` algorithm for complex division when possible rather than the
191+
less basic (limited range) algorithm.
192+
179193
Removed Compiler Flags
180194
-------------------------
181195

@@ -276,6 +290,8 @@ Bug Fixes to C++ Support
276290
- Clang now properly handles the order of attributes in `extern` blocks. (#GH101990).
277291
- Fixed an assertion failure by preventing null explicit object arguments from being deduced. (#GH102025).
278292
- Correctly check constraints of explicit instantiations of member functions. (#GH46029)
293+
- Fixed an assertion failure about a constraint of a friend function template references to a value with greater
294+
template depth than the friend function template. (#GH98258)
279295

280296
Bug Fixes to AST Handling
281297
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -294,6 +310,12 @@ Miscellaneous Clang Crashes Fixed
294310
- Fixed a crash caused by long chains of ``sizeof`` and other similar operators
295311
that can be followed by a non-parenthesized expression. (#GH45061)
296312

313+
- Fixed an crash when compiling ``#pragma STDC FP_CONTRACT DEFAULT`` with
314+
``-ffp-contract=fast-honor-pragmas``. (#GH104830)
315+
316+
- Fixed a crash when function has more than 65536 parameters.
317+
Now a diagnostic is emitted. (#GH35741)
318+
297319
OpenACC Specific Changes
298320
------------------------
299321

@@ -380,6 +402,9 @@ AST Matchers
380402
- Fixed an issue with the `hasName` and `hasAnyName` matcher when matching
381403
inline namespaces with an enclosing namespace of the same name.
382404

405+
- Fixed an ordering issue with the `hasOperands` matcher occuring when setting a
406+
binding in the first matcher and using it in the second matcher.
407+
383408
clang-format
384409
------------
385410

@@ -424,6 +449,36 @@ Moved checkers
424449
Sanitizers
425450
----------
426451

452+
- Added the ``-fsanitize-undefined-ignore-overflow-pattern`` flag which can be
453+
used to disable specific overflow-dependent code patterns. The supported
454+
patterns are: ``add-overflow-test``, ``negated-unsigned-const``, and
455+
``post-decr-while``. The sanitizer instrumentation can be toggled off for all
456+
available patterns by specifying ``all``. Conversely, you can disable all
457+
exclusions with ``none``.
458+
459+
.. code-block:: c++
460+
461+
/// specified with ``-fsanitize-undefined-ignore-overflow-pattern=add-overflow-test``
462+
int common_overflow_check_pattern(unsigned base, unsigned offset) {
463+
if (base + offset < base) { /* ... */ } // The pattern of `a + b < a`, and other re-orderings, won't be instrumented
464+
}
465+
466+
/// specified with ``-fsanitize-undefined-ignore-overflow-pattern=negated-unsigned-const``
467+
void negation_overflow() {
468+
unsigned long foo = -1UL; // No longer causes a negation overflow warning
469+
unsigned long bar = -2UL; // and so on...
470+
}
471+
472+
/// specified with ``-fsanitize-undefined-ignore-overflow-pattern=post-decr-while``
473+
void while_post_decrement() {
474+
unsigned char count = 16;
475+
while (count--) { /* ... */} // No longer causes unsigned-integer-overflow sanitizer to trip
476+
}
477+
478+
Many existing projects have a large amount of these code patterns present.
479+
This new flag should allow those projects to enable integer sanitizers with
480+
less noise.
481+
427482
Python Binding Changes
428483
----------------------
429484
- Fixed an issue that led to crashes when calling ``Type.get_exception_specification_kind``.

0 commit comments

Comments
 (0)