Brian Cain [Fri, 5 Apr 2024 16:06:37 +0000 (11:06 -0500)]
[libcxx] coerce formatter precision to int (#87738)
__precision_ is declared as an int32_t which on some hexagon platforms
is defined as a long.
This change fixes errors like the ones below:
In file included from
/local/mnt/workspace/hex/llvm-project/libcxx/test/libcxx/diagnostics/format.nodiscard_extensions.compile.pass.cpp:19:
In file included from
/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/format:202:
In file included from
/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/format_functions.h:29:
/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/formatter_floating_point.h:700:17:
error: no matching function for call to 'max'
700 | int __p = std::max(1, (__specs.__has_precision() ?
__specs.__precision_ : 6));
| ^~~~~~~~
/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/formatter_floating_point.h:771:25:
note: in instantiation of function template specialization
'std::__formatter::__format_floating_point<float, char,
std::format_context>' requested here
771 | return __formatter::__format_floating_point(__value, __ctx,
__parser_.__get_parsed_std_specifications(__ctx));
| ^
/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/format_functions.h:284:42:
note: in instantiation of function template specialization
'std::__formatter_floating_point<char>::format<float,
std::format_context>' requested here
284 | __ctx.advance_to(__formatter.format(__arg, __ctx));
| ^
/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/format_functions.h:429:15:
note: in instantiation of function template specialization
'std::__vformat_to<std::back_insert_iterator<std::string>, char,
std::back_insert_iterator<std::__format::__output_buffer<char>>>'
requested here
429 | return std::__vformat_to(std::move(__out_it), __fmt, __args);
| ^
/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/format_functions.h:462:8:
note: in instantiation of function template specialization
'std::vformat_to<std::back_insert_iterator<std::string>>' requested here
462 | std::vformat_to(std::back_inserter(__res), __fmt, __args);
| ^
/local/mnt/workspace/hex/llvm-project/libcxx/test/libcxx/diagnostics/format.nodiscard_extensions.compile.pass.cpp:29:8:
note: in instantiation of function template specialization
'std::vformat<void>' requested here
29 | std::vformat("", std::make_format_args());
| ^
/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__algorithm/max.h:35:1:
note: candidate template ignored: deduced conflicting types for
parameter '_Tp' ('int' vs. 'int32_t' (aka 'long'))
35 | max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND
const _Tp& __b) {
| ^
/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__algorithm/max.h:43:1:
note: candidate template ignored: could not match
'initializer_list<_Tp>' against 'int'
43 | max(initializer_list<_Tp> __t, _Compare __comp) {
| ^
/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__algorithm/max.h:48:86:
note: candidate function template not viable: requires single argument
'__t', but 2 arguments were provided
48 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
_LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp max(initializer_list<_Tp> __t) {
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
/local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__algorithm/max.h:29:1:
note: candidate function template not viable: requires 3 arguments, but
2 were provided
29 | max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND
const _Tp& __b, _Compare __comp) {
| ^
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(cherry picked from commit
e1830f586ac4c504f632bdb69aab49234256e899)
Koakuma [Thu, 4 Apr 2024 21:34:07 +0000 (04:34 +0700)]
[SPARC] Implement L and H inline asm argument modifiers (#87259)
This adds support for using the L and H argument modifiers for twinword
operands in inline asm code, such as in:
```
%1 = tail call i64 asm sideeffect "rd %pc, ${0:L} ; srlx ${0:L}, 32, ${0:H}", "={o4}"()
```
This is needed by the Linux kernel.
(cherry picked from commit
697dd93ae30f489e5bcdac74c2ef2d876e3ca064)
Louis Dionne [Tue, 2 Apr 2024 12:14:04 +0000 (08:14 -0400)]
[libc++] Simplify the implementation of <stddef.h> (#86843)
Libc++'s own <stddef.h> is complicated by the need to handle various
platform-specific macros and to support duplicate inclusion. In reality,
we only need to add a declaration of nullptr_t to it, so we can simply
include the underlying <stddef.h> outside of our guards to let it handle
re-inclusion itself.
(cherry picked from commit
2950283dddab03c183c1be2d7de9d4999cc86131)
Schuyler Eldridge [Tue, 9 Apr 2024 15:55:17 +0000 (11:55 -0400)]
[lit][ci] Publish lit wheels (#88072)
Add wheel publishing in addition to existing source distribution
publishing of lit.
Fixes #63369. This also uses the exact fix proposed by @EFord36 in
#63369.
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
(cherry picked from commit
8a8ab8f70cbb5507d1aa55efcd9c6e61ad4e891c)
Owen Pan [Mon, 19 Feb 2024 20:41:22 +0000 (12:41 -0800)]
[clang-format] Correctly annotate braces of empty ctors/dtors (#82097)
Also reformat Polly.
Fixes #79834.
(cherry picked from commit
8de230093f585b64fcd642b46e6560131e95b394)
Ian Anderson [Thu, 4 Apr 2024 20:01:49 +0000 (13:01 -0700)]
[Headers] Don't declare unreachable() from stddef.h in C++ (#86748)
Even if __need_unreachable is set, stddef.h should not declare
unreachable() in C++ because it conflicts with the declaration in
\<utility>.
(cherry picked from commit
df69a305253f1d1b4a4066055a07101a4cc03e55)
Craig Topper [Thu, 21 Mar 2024 16:25:13 +0000 (09:25 -0700)]
[ConstantRange] Fix off by 1 bugs in UIToFP and SIToFP handling. (#86041)
We were passing the min and max values of the range to the ConstantRange
constructor, but the constructor expects the upper bound to 1 more than
the max value so we need to add 1.
We also need to use getNonEmpty so that passing 0, 0 to the constructor
creates a full range rather than an empty range. And passing smin,
smax+1 doesn't cause an assertion.
I believe this fixes at least some of the reason #79158 was reverted.
(cherry picked from commit
12836467b76c56872b4c22a6fd44bcda696ea720)
Craig Topper [Thu, 21 Mar 2024 00:05:17 +0000 (17:05 -0700)]
[Float2Int] Pre-commit test for SIToFP/UIToFP ConstantRange bug. NFC
The range for these operations is being constructed without the
maximum value for the range due to an incorrect usage of the
ConstantRange constructor.
This causes Float2Int to think the range for 'uitofp i1' only
contains 0 instead of 0 and 1.
(cherry picked from commit
6295e677220bb6ec1fa8abe2f4a94b513b91b786)
Tom Stellard [Wed, 10 Apr 2024 21:18:52 +0000 (14:18 -0700)]
Bump version to 18.1.4 (#87715)
Mariya Podchishchaeva [Mon, 12 Feb 2024 09:44:20 +0000 (12:44 +0300)]
[clang] Avoid -Wshadow warning when init-capture named same as class field (#74512)
Shadowing warning doesn't make much sense since field is not available
in lambda's body without capturing this.
Fixes https://github.com/llvm/llvm-project/issues/71976
Fangrui Song [Tue, 26 Mar 2024 21:09:39 +0000 (14:09 -0700)]
[tsan] Refine fstat{,64} interceptors (#86625)
In glibc versions before 2.33. `libc_nonshared.a` defines
`__fxstat/__fxstat64` but there is no `fstat/fstat64`. glibc 2.33 added
`fstat/fstat64` and obsoleted `__fxstat/__fxstat64`. Ports added after
2.33 do not provide `__fxstat/__fxstat64`, so our `fstat/fstat64`
interceptors using `__fxstat/__fxstat64` interceptors would lead to
runtime failures on such ports (LoongArch and certain RISC-V ports).
Similar to https://reviews.llvm.org/
D118423, refine the conditions that
we define fstat{,64} interceptors. `fstat` is supported by musl/*BSD
while `fstat64` is glibc only.
(cherry picked from commit
d5224b73ccd09a6759759791f58426b6acd4a2e2)
Younan Zhang [Fri, 29 Mar 2024 15:28:54 +0000 (23:28 +0800)]
[clang][Sema] Fix a CTAD regression after
42239d2e9 (#86914)
The most recent declaration of a template as a friend can introduce a
different template parameter depth compared to what we anticipate from a
CTAD guide.
Fixes https://github.com/llvm/llvm-project/issues/86769
Congcong Cai [Mon, 4 Mar 2024 19:58:12 +0000 (03:58 +0800)]
[mlir][transform] replace original op to loop ops (#83537)
(cherry picked from commit
0597644a6466ae9148b0b41cb8f95d5022e045c2)
Xing Xue [Fri, 22 Mar 2024 19:25:08 +0000 (15:25 -0400)]
[OpenMP][AIX] Affinity implementation for AIX (#84984)
This patch implements `affinity` for AIX, which is quite different from
platforms such as Linux.
- Setting CPU affinity through masks and related functions are not
supported. System call `bindprocessor()` is used to bind a thread to one
CPU per call.
- There are no system routines to get the affinity info of a thread. The
implementation of `get_system_affinity()` for AIX gets the mask of all
available CPUs, to be used as the full mask only.
- Topology is not available from the file system. It is obtained through
system SRAD (Scheduler Resource Allocation Domain).
This patch has run through the libomp LIT tests successfully with
`affinity` enabled.
(cherry picked from commit
d394f3a162b871668d0c8e8bf6a94922fa8698ae)
Andrew Ng [Thu, 28 Mar 2024 11:41:49 +0000 (11:41 +0000)]
[Support] Fix color handling in formatted_raw_ostream (#86700)
The color methods in formatted_raw_ostream were forwarding directly to
the underlying stream without considering existing buffered output. This
would cause incorrect colored output for buffered uses of
formatted_raw_ostream.
Fix this issue by applying the color to the formatted_raw_ostream itself
and temporarily disabling scanning of any color related output so as not
to affect the position tracking.
This fix means that workarounds that forced formatted_raw_ostream
buffering to be disabled can be removed. In the case of llvm-objdump,
this can improve disassembly performance when redirecting to a file by
more than an order of magnitude on both Windows and Linux. This
improvement restores the disassembly performance when redirecting to a
file to a level similar to before color support was added.
(cherry picked from commit
c9db031c48852af491747dab86ef6f19195eb20d)
Martin Storsjö [Thu, 21 Mar 2024 15:29:15 +0000 (17:29 +0200)]
Reapply [libcxx] [modules] Fix relative paths with absolute LIBCXX_INSTALL_MODULES_DIR (#86020)
This reapplies
272d1b44efdedb68c194970a610f0ca1b7b769c5 (from #85756),
which was reverted in
407937036fa7640f61f225474b1ea6623a40dbdd.
In the previous attempt, empty CMAKE_INSTALL_PREFIX was handled by
quoting them, in
d209d1340b99d4fbd325dffb5e13b757ab8264ea. That made the
calls to cmake_path(ABSOLUTE_PATH) succeed, but the output paths of that
weren't actually absolute, which was required by file(RELATIVE_PATH).
Avoid this issue by constructing a non-empty base directory variable
to use for calculating the relative path.
(cherry picked from commit
50801f1095d33e712c3a51fdeef82569bd09007f)
Ulrich Weigand [Wed, 27 Mar 2024 23:22:38 +0000 (00:22 +0100)]
release/18.x: [SystemZ] Fix overflow flag for i128 USUBO (#86491)
We use the VSCBIQ/VSBIQ/VSBCBIQ family of instructions to implement
USUBO/USUBO_CARRY for the i128 data type. However, these instructions
use an inverted sense of the borrow indication flag (a value of 1
indicates *no* borrow, while a value of 0 indicated borrow). This does
not match the semantics of the boolean "overflow" flag of the
USUBO/USUBO_CARRY ISD nodes.
Fix this by generating code to explicitly invert the flag. These cancel
out of the result of USUBO feeds into an USUBO_CARRY.
To avoid unnecessary zero-extend operations, also improve the DAGCombine
handling of ZERO_EXTEND to optimize (zext (xor (trunc))) sequences where
appropriate.
Fixes: https://github.com/llvm/llvm-project/issues/83268
Arthur Eubanks [Sun, 24 Mar 2024 17:43:15 +0000 (11:43 -0600)]
[lld/ELF][X86] Respect outSecOff when checking if GOTPCREL can be relaxed (#86334)
The existing implementation didn't handle when the input text section
was some offset from the output section.
This resulted in an assert in relaxGot() with an lld built with asserts
for some large binaries, or even worse, a silently broken binary with an
lld without asserts.
(cherry picked from commit
48048051323d5dd74057dc5f32df8c3c323afcd5)
Andrei Golubev [Mon, 25 Mar 2024 21:47:39 +0000 (23:47 +0200)]
[ODS][NFC] Cast range.size() to int32_t in accumulation (#85629)
Using range.size() "as is" means we accumulate 'size_t' values into
'int32_t' variable. This may produce narrowing conversion warnings
(particularly, on MSVC). The surrounding code seems to cast <x>.size()
to 'int32_t' so following this practice seems safe enough.
Co-authored-by: Ovidiu Pintican <ovidiu.pintican@intel.com>
(cherry picked from commit
bce17034157fdfe4d898d30366c1eeca3442fa3d)
yingopq [Sun, 24 Mar 2024 06:35:42 +0000 (14:35 +0800)]
[Mips] Restore wrong deletion of instruction 'and' in unsigned min/max processing. (#85902)
Fix #61881
(cherry picked from commit
5d7fd6a04a6748936dece9d90481b2ba4ec97e53)
yingopq [Fri, 8 Mar 2024 20:41:31 +0000 (04:41 +0800)]
[Mips] Fix missing sign extension in expansion of sub-word atomic max (#77072)
Add sign extension "SEB/SEH" before compare.
Fix #61881
(cherry picked from commit
755b439694432d4f68e20e979b479cbc30602bb1)
George Koehler [Sun, 3 Mar 2024 03:18:24 +0000 (22:18 -0500)]
[PowerPC] provide CFI for ELF32 to unwind cr2, cr3, cr4 (#83098)
Delete the code that skips the CFI for the condition register on ELF32.
The code checked !MustSaveCR, which happened only when
Subtarget.is32BitELFABI(), where spillCalleeSavedRegisters is spilling
cr in a different way. The spill was missing CFI. After deleting this
code, a spill of cr2 to cr4 gets CFI in the same way as a spill of r14
to r31.
Fixes #83094
(cherry picked from commit
6b70c5d79fe44cbe01b0443454c6952c5b541585)
Chen Zheng [Thu, 29 Feb 2024 09:41:39 +0000 (04:41 -0500)]
[NFC][PowerPC] use script to regenerate the CHECK lines
(cherry picked from commit
3196005f6bedbed61a86626a9e4f8fee7437a914)
Thurston Dang [Fri, 15 Mar 2024 16:49:00 +0000 (09:49 -0700)]
[msan] Re-exec with no ASLR if memory layout is incompatible on Linux (#85142)
This ports the change from TSan
(https://github.com/llvm/llvm-project/commit/
0784b1eefa36d4acbb0dacd2d18796e26313b6c5).
Testing notes: run 'sudo sysctl vm.mmap_rnd_bits=32; ninja check-msan'
before and after this patch.
N.B. aggressive ASLR may also cause the app to overlap with the
allocator region; for MSan, this was fixed in
https://github.com/llvm/llvm-project/commit/
af2bf86a372cacf5f536bae06e2f2d3886eefb7b
(cherry picked from commit
58f7251820b14c93168726a24816d8a094599be5)
Thurston Dang [Thu, 14 Mar 2024 23:19:30 +0000 (16:19 -0700)]
[msan] Add 'MappingDesc::ALLOCATOR' type and check it is available (#85153)
MSan divides the virtual address space into APP, INVALID, SHADOW and
ORIGIN memory. The allocator usually just steals a bit of the APP
address space: typically the bottom portion of the PIE binaries section,
which works because the Linux kernel maps from the top of the PIE
binaries section. However, if ASLR is very aggressive, the binary may
end up mapped in the same location where the allocator wants to live;
this results in a segfault.
This patch adds in a MappingDesc::ALLOCATOR type and enforces that the
memory range for the allocator is not occupied by anything else.
Since the allocator range information is not readily available in
msan.h, we duplicate the information from msan_allocator.cpp.
Note: aggressive ASLR can also lead to a different type of failure,
where the PIE binaries/libraries are mapped entirely outside of the
APP/ALLOCATOR sections; that will be addressed in a separate patch
(https://github.com/llvm/llvm-project/pull/85142).
(cherry picked from commit
af2bf86a372cacf5f536bae06e2f2d3886eefb7b)
Antonio Frighetto [Thu, 7 Mar 2024 06:49:40 +0000 (07:49 +0100)]
[clang][CodeGen] Allow `memcpy` replace with trivial auto var init
When emitting the storage (or memory copy operations) for constant
initializers, the decision whether to split a constant structure or
array store into a sequence of field stores or to use `memcpy` is
based upon the optimization level and the size of the initializer.
In
afe8b93ffdfef5d8879e1894b9d7dda40dee2b8d, we extended this by
allowing constants to be split when the array (or struct) type does
not match the type of data the address to the object (constant) is
expected to contain. This may happen when `emitStoresForConstant` is
called by `EmitAutoVarInit`, as the element type of the address gets
shrunk. When this occurs, let the initializer be split into a bunch
of stores only under `-ftrivial-auto-var-init=pattern`.
Fixes: https://github.com/llvm/llvm-project/issues/84178.
hev [Wed, 21 Feb 2024 13:15:17 +0000 (21:15 +0800)]
[LoongArch] Assume no-op addrspacecasts by default (#82332)
This PR indicates that `addrspacecasts` are always no-ops on LoongArch.
Fixes #82330
(cherry picked from commit
dd3e0a4643670f33850278ad281a358bbdd04e92)
Jeffrey Byrnes [Mon, 19 Feb 2024 20:59:13 +0000 (12:59 -0800)]
[SROA]: Only defer trying partial sized ptr or ptr vector types
Change-Id: Ic77f87290905addadd5819dff2d0c62f031022ab
(cherry picked from commit
1e828f838cc0f15074f3dbbb04929c06ef0c9729)
ostannard [Mon, 26 Feb 2024 12:23:25 +0000 (12:23 +0000)]
[ARM] Update IsRestored for LR based on all returns (#82745)
PR #75527 fixed ARMFrameLowering to set the IsRestored flag for LR based
on all of the return instructions in the function, not just one.
However, there is also code in ARMLoadStoreOptimizer which changes
return instructions, but it set IsRestored based on the one instruction
it changed, not the whole function.
The fix is to factor out the code added in #75527, and also call it from
ARMLoadStoreOptimizer if it made a change to return instructions.
Fixes #80287.
(cherry picked from commit
749384c08e042739342c88b521c8ba5dac1b9276)
Oliver Stannard [Fri, 23 Feb 2024 09:31:25 +0000 (09:31 +0000)]
Pre-commit test showing bug #80287
This test shows the bug where LR is used as a general-purpose register
on a code path where it is not spilled to the stack.
(cherry picked from commit
8779cf68e80dcc0b15e8034f39e6ce18b08352b6)
Tom Stellard [Fri, 22 Mar 2024 18:44:29 +0000 (11:44 -0700)]
Bump version to 18.1.3 (#86168)
Phoebe Wang [Mon, 4 Mar 2024 10:09:41 +0000 (18:09 +0800)]
[X86] Add missing subvector_subreg_lowering for BF16 (#83720)
Chuanqi Xu [Mon, 11 Mar 2024 03:14:40 +0000 (11:14 +0800)]
[C++20] [Moduls] Avoid computing odr hash for functions from comparing constraint expression
Previously we disabled to compute ODR hash for declarations from the
global module fragment. However, we missed the case that the functions
lives in the concept requiments (see the attached the test files for
example). And the mismatch causes the potential crashment.
Due to we will set the function body as lazy after we deserialize it and
we will only take its body when needed. However, we don't allow to take
the body during deserializing. So it is actually potentially problematic
if we set the body as lazy first and computing the hash value of the
function, which requires to deserialize its body. So we will meet a
crash here.
This patch tries to solve the issue by not taking the body of the
function from GMF. Note that we can't skip comparing the constraint
expression from the GMF directly since it is an key part of the
function selecting and it may be the reason why we can't return 0
directly for `FunctionDecl::getODRHash()` from the GMF.
Luke Lau [Thu, 22 Feb 2024 03:50:27 +0000 (11:50 +0800)]
[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (#82506)
This fixes the miscompile reported in #82430 by telling
isSimpleVIDSequence to sign extend to XLen instead of the width of the
indices, since the "sequence" of indices generated by a strided load
will be at XLen.
This was the simplest way I could think of getting isSimpleVIDSequence
to treat the indexes as if they were zero extended to XLenVT.
Another way we could do this is by refactoring out the "get constant
integers" part from isSimpleVIDSequence and handle them as APInts so we
can separately zero extend it.
Fixes #82430
(cherry picked from commit
815644b4dd882ade2e5649d4f97c3dd6f7aea200)
Luke Lau [Thu, 22 Feb 2024 03:05:06 +0000 (11:05 +0800)]
[RISCV] Adjust test case to show wrong stride. NFC
See https://github.com/llvm/llvm-project/pull/82506#discussion_r1498080785
(cherry picked from commit
11d115d0569b212dfeb7fe6485be48070e068e19)
Luke Lau [Wed, 21 Feb 2024 10:05:04 +0000 (18:05 +0800)]
[RISCV] Add test case for miscompile in gather -> strided load combine. NFC
This shows the issue in #82430, but triggers it via the widening SEW combine
rather than a GEP that RISCVGatherScatterLowering doesn't detect.
(cherry picked from commit
2cd59bdc891ab59a1abfe5205feb45791a530a47)
Nikita Popov [Fri, 15 Mar 2024 08:02:10 +0000 (09:02 +0100)]
[TSan] Fix atomicrmw xchg with pointer and floats (#85228)
atomicrmw xchg also accepts pointer and floating-point values. To handle
those, insert necessary casts to and from integer. This is what we do
for cmpxchg as well.
Fixes https://github.com/llvm/llvm-project/issues/85226.
(cherry picked from commit
ff2fb2a1d78585944dcdb9061c8487fe1476dfa4)
Patryk Wychowaniec [Fri, 15 Mar 2024 11:07:54 +0000 (12:07 +0100)]
[AVR] Remove earlyclobber from LDDRdPtrQ (#85277)
LDDRdPtrQ was marked as `earlyclobber`, which doesn't play well with
GreedyRA (which can generate this instruction through `loadRegFromStackSlot()`).
This seems to be the same case as:
https://github.com/llvm/llvm-project/blob/
a99b912c9b74f6ef91786b4dfbc25160c27d3b41/llvm/lib/Target/AVR/AVRInstrInfo.td#L1421
Closes https://github.com/llvm/llvm-project/issues/81911.
David CARLIER [Sat, 16 Mar 2024 13:41:33 +0000 (13:41 +0000)]
Revert "release/18.x: [openmp] __kmp_x86_cpuid fix for i386/PIC builds. (#846…"
This reverts commit
9b3edb592debc00a5c3fbf7a71f63e07d6af44be.
Qiu Chaofan [Mon, 18 Mar 2024 14:31:05 +0000 (22:31 +0800)]
[PowerPC] Update chain uses when emitting lxsizx (#84892)
(cherry picked from commit
e5b20c83e5ba25e6e0650df30352ce54c2f6ea2f)
Martin Storsjö [Tue, 19 Mar 2024 06:48:57 +0000 (08:48 +0200)]
[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
This reverts the changes from
91a384621e5b762d9c173ffd247cfeadd5f436a2
for Windows targets. The changes in that commit don't work as expected
for Windows targets (those parts of llvm_add_library don't quite behave
the same for Windows), while the previous status quo (producing a
library named "libLLVM-<major>.dll") is the defacto standard way of
doing versioned library names there, contrary to on Unix.
After that commit, the library always ended up named "libLLVM.dll",
executables linking against it would reference "libLLVM.dll", and
"libLLVM-<major>.dll" was provided as a symlink.
Thus revert this bit back to as it were, so that executables actually
link against a versioned libLLVM, and no separate symlink is needed.
The only thing that might be improved compared to the status quo as it
was before these changes, is that the import library is named
"lib/libLLVM-<major>.dll.a", while the common style would be to name it
plainly "lib/libLLVM.dll.a" (even while it produces references to
"libLLVM-<major>.dll", but none of these had that effect for Windows
targets.
(As a side note, the llvm-shlib library can be built for MinGW, but not
currently in MSVC configurations.)
(cherry picked from commit
cb2ca23345d3d9bde027a18d301949e8bdf606a6)
Tom Stellard [Sun, 17 Mar 2024 05:47:27 +0000 (22:47 -0700)]
[llvm-shlib] Fix libLLVM-18 symlink on mingw (#85554)
The TARGET_SONAME_FILE_NAME generator expression is not available on dll
target platforms.
(cherry picked from commit
f84980570d3f85bdf5c9432647c05bae04a735a0)
Tom Stellard [Fri, 15 Mar 2024 15:16:46 +0000 (08:16 -0700)]
llvm-shlib: Fix libLLVM-${MAJOR}.so symlink on MacOS (#85163)
This is a partial revert of
10c48a772742b7afe665a815b7eba2047f17dc4b
with a fix for the symlink target name on MacOS
See #84637
(cherry picked from commit
ec2b7522dbee1cb91111d6ade6e1768462247dcf)
Alex Crichton [Tue, 19 Mar 2024 00:55:34 +0000 (19:55 -0500)]
[WebAssembly] Change the default linker for `wasm32-wasip2` (#84569)
This commit changes the default linker in the WebAssembly toolchain for
the `wasm32-wasip2` target. This target is being added to the
WebAssembly/wasi-sdk and WebAssembly/wasi-libc projects to target the
Component Model by default, in contrast with the preexisting
`wasm32-wasi` target (in the process of being renamed to
`wasm32-wasip1`) which outputs a core WebAssembly module by default.
The `wasm-component-ld` project currently lives in my GitHub account at
https://github.com/alexcrichton/wasm-component-ld and isn't necessarily
"official" yet, but it's expected to continue to evolve as the
`wasm32-wasip2` target continues to shape up and evolve.
(cherry picked from commit
d66121d74a458e098511b9de920d815440acaa1b)
Tom Stellard [Tue, 19 Mar 2024 13:55:10 +0000 (06:55 -0700)]
workflows: Fix baseline version for llvm abi checks (#85166)
The baseline version calculations was assuming the minor release would
always be 0.
(cherry picked from commit
d93363a0e803a9fb2889ff03237f4e93aacf0108)
Yingwei Zheng [Sun, 17 Mar 2024 06:15:27 +0000 (14:15 +0800)]
[InstCombine] Drop UB-implying attrs/metadata after speculating an instruction (#85542)
When speculating an instruction in `InstCombinerImpl::FoldOpIntoSelect`,
the call may result in undefined behavior. This patch drops all
UB-implying attrs/metadata to fix this.
Fixes #85536.
(cherry picked from commit
252d01952c087cf0d141f7f281cf60efeb98be41)
Weining Lu [Tue, 5 Mar 2024 15:19:16 +0000 (23:19 +0800)]
[lld][LoongArch] Fix handleUleb128
(cherry picked from commit
a41bcb3930534ef1525b4fc30e53e818b39e2b60)
Weining Lu [Tue, 5 Mar 2024 14:01:07 +0000 (22:01 +0800)]
[lld][test] Fix sanitizer buildbot failure
Buildbot failure:
https://lab.llvm.org/buildbot/#/builders/5/builds/41530/steps/9/logs/stdio
(cherry picked from commit
d9b435c24ddddcc8148fd97b42f6bb1124e52307)
Daniel Paoliello [Wed, 13 Mar 2024 23:18:10 +0000 (16:18 -0700)]
Remove support for EXPORTAS in def files to maintain ABI compatibility for COFFShortExport
Daniel Paoliello [Tue, 12 Mar 2024 21:10:49 +0000 (14:10 -0700)]
[Arm64EC] Copy import descriptors to the EC Map (#84834)
As noted in <https://github.com/llvm/llvm-project/pull/78537>, MSVC
places import descriptors in both the EC and regular map - that PR moved
the descriptors to ONLY the regular map, however this causes linking
errors when linking as Arm64EC:
```
bcryptprimitives.lib(bcryptprimitives.dll) : error LNK2001: unresolved external symbol __IMPORT_DESCRIPTOR_bcryptprimitives (EC Symbol)
```
This change copies import descriptors from the regular map to the EC
map, which fixes this linking error.
Jacek Caban [Sat, 10 Feb 2024 11:46:42 +0000 (12:46 +0100)]
[llvm-lib][Object] Add support for EC importlib symbols. (#81059)
ARM64EC import libraries expose two additional symbols: mangled thunk
symbol (like `#func`) and auxiliary import symbol (like`__imp_aux_func`).
The main functional change with this patch is that those symbols are
properly added to static library ECSYMBOLS.
Jacek Caban [Sat, 10 Feb 2024 00:00:14 +0000 (01:00 +0100)]
[llvm-lib][llvm-dlltool][Object] Add support for EXPORTAS name types. (#78772)
EXPORTAS is a new name type in import libraries. It's used by default on ARM64EC,
but it's allowed on other platforms as well.
Jacek Caban [Tue, 6 Feb 2024 12:47:58 +0000 (13:47 +0100)]
[llvm-readobj][Object][COFF] Print COFF import library symbol export name. (#78769)
getExportName implementation is based on lld-link. In its current form,
it's mostly about convenience, but it will be more useful for EXPORTAS
support, for which export name is not possible to deduce from other
printed properties.
Louis Dionne [Sat, 16 Mar 2024 22:32:44 +0000 (18:32 -0400)]
[libc++] Use clang-tidy version that matches the compiler we use in the CI (#85305)
This works around ODR violations in the clang-tidy plugin we use to
perform the modules tests.
Fixes #85242
Nathan Ridge [Mon, 4 Mar 2024 05:12:56 +0000 (00:12 -0500)]
[clangd] [HeuristicResolver] Protect against infinite recursion on DependentNameTypes (#83542)
When resolving names inside templates that implement recursive
compile-time functions (e.g. waldo<N>::type is defined in terms
of waldo<N-1>::type), HeuristicResolver could get into an infinite
recursion, specifically one where resolveDependentNameType() can
be called recursively with the same DependentNameType*.
To guard against this, HeuristicResolver tracks, for each external
call into a HeuristicResolver function, the set of DependentNameTypes
that it has seen, and bails if it sees the same DependentNameType again.
To implement this, a helper class HeuristicResolverImpl is introduced
to store state that persists for the duration of an external call into
HeuristicResolver (but does not persist between such calls).
Fixes https://github.com/clangd/clangd/issues/1951
(cherry picked from commit
e6e53ca8470d719882539359ebe3ad8b442a8cb0)
Ian Anderson [Wed, 13 Mar 2024 18:15:41 +0000 (11:15 -0700)]
[clang][modules] giving the __stddef_ headers their own modules can cause redeclaration errors with -fbuiltin-headers-in-system-modules (#84127)
On Apple platforms, some of the stddef.h types are also declared in
system headers. In particular NULL has a conflicting declaration in
<sys/_types/_null.h>. When that's in a different module from
<__stddef_null.h>, redeclaration errors can occur.
Make the \_\_stddef_ headers be non-modular in
-fbuiltin-headers-in-system-modules and restore them back to not
respecting their header guards. Still define the header guards though.
__stddef_max_align_t.h was in _Builtin_stddef_max_align_t prior to the
addition of _Builtin_stddef, and it needs to stay in a module because
struct's can't be type merged. __stddef_wint_t.h didn't used to have a
module, but leave it in it current module since it doesn't really belong
to stddef.h.
(cherry picked from commit
f50d3582b4844b86ad86372028e44b52c560ec7d)
Tom Stellard [Fri, 15 Mar 2024 15:15:53 +0000 (08:15 -0700)]
workflows: Add workaround for lld failures on MacOS (#85021) (#85110)
See #81967
(cherry picked from commit
175b533720956017bb18d1280362f6890ee15b05)
David CARLIER [Fri, 15 Mar 2024 04:43:47 +0000 (04:43 +0000)]
release/18.x: [openmp] __kmp_x86_cpuid fix for i386/PIC builds. (#84626) (#85053)
Nathan Ridge [Fri, 15 Mar 2024 04:37:43 +0000 (00:37 -0400)]
[clangd] Add clangd 18 release notes (#84436)
Martin Storsjö [Wed, 13 Mar 2024 20:01:01 +0000 (22:01 +0200)]
[runtimes] Prefer -fvisibility-global-new-delete=force-hidden (#84917)
27ce26b06655cfece3d54b30e442ef93d3e78ac7 added the new option
-fvisibility-global-new-delete=, where -fvisibility-global-new-delete=force-hidden
is equivalent to the old option -fvisibility-global-new-delete-hidden.
At the same time, the old option was deprecated.
Test for and use the new option form first; if unsupported, try
using the old form.
This avoids warnings in the MinGW builds, if built with Clang 18 or
newer.
(cherry picked from commit
1f973efd335f34c75fcba1ccbe288fd5ece15a64)
Fangrui Song [Thu, 14 Mar 2024 16:51:27 +0000 (09:51 -0700)]
[ELF] Eliminate symbols demoted due to /DISCARD/ discarded sections (#85167)
#69295 demoted Defined symbols relative to discarded sections.
If such a symbol is unreferenced, the desired behavior is to
eliminate it from .symtab just like --gc-sections discarded
definitions.
Linux kernel's CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y configuration expects
that the unreferenced `unused` is not emitted to .symtab
(https://github.com/ClangBuiltLinux/linux/issues/2006).
For relocations referencing demoted symbols, the symbol index restores
to 0 like older lld (`R_X86_64_64 0` in `discard-section.s`).
Fix #85048
(cherry picked from commit
8fe3e70e810b409dce36f6d415e86f0f9b1cf22d)
Jonas Paulsson [Wed, 13 Mar 2024 23:27:21 +0000 (19:27 -0400)]
SystemZ release notes for 18.x. (#84560)
Nikita Popov [Tue, 5 Mar 2024 13:21:33 +0000 (14:21 +0100)]
[X86][Inline] Skip inline asm in inlining target feature check (#83820)
When inlining across functions with different target features, we
perform roughly two checks:
1. The caller features must be a superset of the callee features.
2. Calls in the callee cannot use types where the target features would
change the call ABI (e.g. by changing whether something is passed in a
zmm or two ymm registers). The latter check is very crude right now.
The latter check currently also catches inline asm "calls". I believe
that inline asm should be excluded from this check, as it is independent
from the usual call ABI, and instead governed by the inline asm
constraint string.
Fixes https://github.com/llvm/llvm-project/issues/67054.
(cherry picked from commit
e84182af919d136d74b75ded4d599b38fb47dfb0)
Nikita Popov [Mon, 4 Mar 2024 10:32:07 +0000 (11:32 +0100)]
[Inline] Add test for #67054 (NFC)
(cherry picked from commit
cad6ad2759a782c48193f83886488dacc9f330e3)
Florian Hahn [Tue, 12 Mar 2024 08:55:03 +0000 (08:55 +0000)]
[ValueTracking] Treat phi as underlying obj when not decomposing further (#84339)
At the moment, getUnderlyingObjects simply continues for phis that do
not refer to the same underlying object in loops, without adding them to
the list of underlying objects, effectively ignoring those phis.
Instead of ignoring those phis, add them to the list of underlying
objects. This fixes a miscompile where LoopAccessAnalysis fails to
identify a memory dependence, because no underlying objects can be found
for a set of memory accesses.
Fixes https://github.com/llvm/llvm-project/issues/82665.
PR: https://github.com/llvm/llvm-project/pull/84339
(cherry picked from commit
b274b23665dec30f3ae4fb83ccca8b77e6d3ada3)
Florian Hahn [Thu, 7 Mar 2024 13:53:02 +0000 (13:53 +0000)]
[LAA] Add test case for #82665.
Test case for https://github.com/llvm/llvm-project/issues/82665.
(cherry picked from commit
4cfd4a7896b5fd50274ec8573c259d7ad41741de)
azhan92 [Fri, 16 Feb 2024 02:27:45 +0000 (21:27 -0500)]
[Release] Install compiler-rt builtins during Phase 1 on AIX (#81485)
The current test-release.sh script does not install the necessary
compiler-rt builtin's during Phase 1 on AIX, resulting on a
non-functional Phase 1 clang. Futhermore, the installation is also
necessary for Phase 2 on AIX.
Co-authored-by: Alison Zhang <alisonzhang@ibm.com>
(cherry picked from commit
3af5c98200e0b1268f755c3f289be4f73aac4214)
Florian Hahn [Tue, 12 Mar 2024 09:47:42 +0000 (09:47 +0000)]
[ArgPromotion] Remove incorrect TranspBlocks set for loads. (#84835)
The TranspBlocks set was used to cache aliasing decision for all
processed loads in the parent loop. This is incorrect, because each load
can access a different location, which means one load not being modified
in a block doesn't translate to another load not being modified in the
same block.
All loads access the same underlying object, so we could perhaps use a
location without size for all loads and retain the cache, but that would
mean we loose precision.
For now, just drop the cache.
Fixes https://github.com/llvm/llvm-project/issues/84807
PR: https://github.com/llvm/llvm-project/pull/84835
(cherry picked from commit
bba4a1daff6ee09941f1369a4e56b4af95efdc5c)
Florian Hahn [Mon, 11 Mar 2024 21:06:03 +0000 (21:06 +0000)]
[ArgPromotion] Add test case for #84807.
Test case for https://github.com/llvm/llvm-project/issues/84807,
showing a mis-compile in ArgPromotion.
(cherry picked from commit
31ffdb56b4df9b772d763dccabbfde542545d695)
Martin Storsjö [Mon, 11 Mar 2024 22:03:26 +0000 (00:03 +0200)]
[LLD] [COFF] Set the right alignment for DelayDirectoryChunk (#84697)
This makes a difference when linking executables with delay loaded
libraries for arm32; the delay loader implementation can load data from
the registry with instructions that assume alignment.
This issue does not show up when linking in MinGW mode, because a
PseudoRelocTableChunk gets injected, which also sets alignment, even if
the chunk itself is empty.
(cherry picked from commit
c93c76b562784926b22a69d3f82a5032dcb4a274)
Simon Pilgrim [Sun, 10 Mar 2024 16:23:51 +0000 (16:23 +0000)]
[X86] combineAndShuffleNot - ensure the type is legal before create X86ISD::ANDNP target nodes
Fixes #84660
(cherry picked from commit
862c7e0218f27b55a5b75ae59a4f73cd4610448d)
Florian Hahn [Wed, 6 Mar 2024 20:08:00 +0000 (20:08 +0000)]
[DSE] Remove malloc from EarliestEscapeInfo before removing. (#84157)
Not removing the malloc from earliest escape info leaves stale entries
in the cache.
Fixes https://github.com/llvm/llvm-project/issues/84051.
PR: https://github.com/llvm/llvm-project/pull/84157
(cherry picked from commit
eb8f379567e8d014194faefe02ce92813e237afc)
Yingwei Zheng [Tue, 5 Mar 2024 14:34:04 +0000 (22:34 +0800)]
[InstCombine] Fix miscompilation in PR83947 (#83993)
https://github.com/llvm/llvm-project/blob/
762f762504967efbe159db5c737154b989afc9bb/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp#L394-L407
Comment from @topperc:
> This transforms assumes the mask is a non-zero splat. We only know its
a splat and not provably all 0s. The mask is a constexpr that includes
the address of the global variable. We can't resolve the constant
expression to an exact value.
Fixes #83947.
wanglei [Wed, 6 Mar 2024 02:03:28 +0000 (10:03 +0800)]
[Clang][LoongArch] Fix wrong return value type of __iocsrrd_h (#84100)
relate:
https://gcc.gnu.org/pipermail/gcc-patches/2024-February/645016.html
(cherry picked from commit
2f479b811274fede36535e34ecb545ac22e399c3)
wanglei [Tue, 5 Mar 2024 11:44:28 +0000 (19:44 +0800)]
[Clang][LoongArch] Precommit test for fix wrong return value type of __iocsrrd_h. NFC
(cherry picked from commit
aeda1a6e800e0dd6c91c0332b4db95094ad5b301)
wanglei [Mon, 11 Mar 2024 00:59:17 +0000 (08:59 +0800)]
[LoongArch] Make sure that the LoongArchISD::BSTRINS node uses the correct `MSB` value (#84454)
The `MSB` must not be greater than `GRLen`. Without this patch, newly
added test cases will crash with LoongArch32, resulting in a 'cannot
select' error.
(cherry picked from commit
edd4c6c6dca4c556de22b2ab73d5bfc02d28e59b)
Exile [Wed, 6 Mar 2024 16:01:30 +0000 (00:01 +0800)]
[analyzer] Fix crash on dereference invalid return value of getAdjustedParameterIndex() (#83585)
Fixes #78810
Thanks for Snape3058 's comment
---------
Co-authored-by: miaozhiyuan <miaozhiyuan@feysh.com>
(cherry picked from commit
d4687fe7d1639ea5d16190c89a54de1f2c6e2a9a)
Louis Dionne [Thu, 7 Mar 2024 20:12:21 +0000 (15:12 -0500)]
[libc++] Enable availability based on the compiler instead of __has_extension (#84065)
__has_extension(...) doesn't work as intended when -pedantic-errors is
used with Clang. With that flag, __has_extension(...) is equivalent to
__has_feature(...), which means that checks like
__has_extension(pragma_clang_attribute_external_declaration)
will return 0. In turn, this has the effect of disabling availability
markup in libc++, which is undesirable.
rdar://
124078119
(cherry picked from commit
292a28df6c55679fad0589dea35278a8c66b2ae1)
Yingwei Zheng [Tue, 5 Mar 2024 09:21:16 +0000 (17:21 +0800)]
[InstCombine] Handle scalable splat in `getFlippedStrictnessPredicateAndConstant`
(cherry picked from commit
d51fcd4ed86ac6075c8a25b053c2b66051feaf62)
Jinyang He [Tue, 5 Mar 2024 07:50:14 +0000 (15:50 +0800)]
[lld][LoongArch] Support the R_LARCH_{ADD,SUB}_ULEB128 relocation types (#81133)
For a label difference like `.uleb128 A-B`, MC generates a pair of
R_LARCH_{ADD,SUB}_ULEB128 if A-B cannot be folded as a constant. GNU
assembler generates a pair of relocations in more cases (when A or B is
in a code section with linker relaxation). It is similar to RISCV.
R_LARCH_{ADD,SUB}_ULEB128 relocations are created by Clang and GCC in
`.gcc_except_table` and other debug sections with linker relaxation
enabled. On LoongArch, first read the buf and count the available space.
Then add or sub the value. Finally truncate the expected value and fill
it into the available space.
(cherry picked from commit
eaa9ef678c63bf392ec2d5b736605db7ea7e7338)
Sirraide [Tue, 27 Feb 2024 19:19:44 +0000 (20:19 +0100)]
[Clang] [Sema] Handle placeholders in '.*' expressions (#83103)
When analysing whether we should handle a binary expression as an
overloaded operator call or a builtin operator, we were calling
`checkPlaceholderForOverload()`, which takes care of any placeholders
that are not overload sets—which would usually make sense since those
need to be handled as part of overload resolution.
Unfortunately, we were also doing that for `.*`, which is not
overloadable, and then proceeding to create a builtin operator anyway,
which would crash if the RHS happened to be an unresolved overload set
(due hitting an assertion in `CreateBuiltinBinOp()`—specifically, in one
of its callees—in the `.*` case that makes sure its arguments aren’t
placeholders).
This pr instead makes it so we check for *all* placeholders early if the
operator is `.*`.
It’s worth noting that,
1. In the `.*` case, we now additionally also check for *any*
placeholders (not just non-overload-sets) in the LHS; this shouldn’t
make a difference, however—at least I couldn’t think of a way to trigger
the assertion with an overload set as the LHS of `.*`; it is worth
noting that the assertion in question would also complain if the LHS
happened to be of placeholder type, though.
2. There is another case in which we also don’t perform overload
resolution—namely `=` if the LHS is not of class or enumeration type
after handling non-overload-set placeholders—as in the `.*` case, but
similarly to 1., I first couldn’t think of a way of getting this case to
crash, and secondly, `CreateBuiltinBinOp()` doesn’t seem to care about
placeholders in the LHS or RHS in the `=` case (from what I can tell,
it, or rather one of its callees, only checks that the LHS is not a
pseudo-object type, but those will have already been handled by the call
to `checkPlaceholderForOverload()` by the time we get to this function),
so I don’t think this case suffers from the same problem.
This fixes #53815.
---------
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Shih-Po Hung [Sat, 2 Mar 2024 04:33:55 +0000 (12:33 +0800)]
[RISCV] Fix crash when unrolling loop containing vector instructions (#83384)
When MVT is not a vector type, TCK_CodeSize should return an invalid
cost. This patch adds a check in the beginning to make sure all cost
kinds return invalid costs consistently.
Before this patch, TCK_CodeSize returns a valid cost on scalar MVT but
other cost kinds doesn't.
This fixes the issue #83294 where a loop contains vector instructions
and MVT is scalar after type legalization when the vector extension is
not enabled,
(cherry picked from commit
fb67dce1cb87e279593c27bd4122fe63bad75f04)
Fangrui Song [Fri, 1 Mar 2024 19:17:22 +0000 (11:17 -0800)]
[ELF] Internalize enum
g++ -flto has a diagnostic `-Wodr` about mismatched redeclarations,
which even apply to `enum`.
Fix #83529
Reviewers: thesamesam
Reviewed By: thesamesam
Pull Request: https://github.com/llvm/llvm-project/pull/83604
(cherry picked from commit
4a3f7e798a31072a80a0731b8fb1da21b9c626ed)
Alexander Richardson [Wed, 21 Feb 2024 20:59:56 +0000 (12:59 -0800)]
Unbreak *tf builtins for hexfloat (#82208)
This re-lands
cc0065a7d082f0bd322a538cf62cfaef1c8f89f8 in a way that
keeps existing targets working.
---------
Original commit message:
#68132 ended up removing
__multc3 & __divtc3 from compiler-rt library builds that have
QUAD_PRECISION but not TF_MODE due to missing int128 support.
I added support for QUAD_PRECISION to use the native hex float long double representation.
---------
Co-authored-by: Sean Perry <perry@ca.ibm.com>
(cherry picked from commit
99c457dc2ef395872d7448c85609f6cb73a7f89b)
Billy Laws [Tue, 27 Feb 2024 18:32:15 +0000 (18:32 +0000)]
[AArch64] Skip over shadow space for ARM64EC entry thunk variadic calls (#80994)
When in an entry thunk the x64 SP is passed in x4 but this cannot be
directly passed through since x64 varargs calls have a 32 byte shadow
store at SP followed by the in-stack parameters. ARM64EC varargs calls
on the other hand expect x4 to point to the first in-stack parameter.
Billy Laws [Mon, 5 Feb 2024 17:26:16 +0000 (17:26 +0000)]
[AArch64] Fix generated types for ARM64EC variadic entry thunk targets (#80595)
ISel handles filling in x4/x5 when calling variadic functions as they
don't correspond to the 5th/6th X64 arguments but rather to the end of
the shadow space on the stack and the size in bytes of all stack
parameters (ignored and written as 0 for calls from entry thunks).
Will PR a follow up with ISel handling after this is merged.
Billy Laws [Wed, 31 Jan 2024 02:32:15 +0000 (02:32 +0000)]
[AArch64] Fix variadic tail-calls on ARM64EC (#79774)
ARM64EC varargs calls expect that x4 = sp at entry, special handling is
needed to ensure this with tail calls since they occur after the
epilogue and the x4 write happens before.
I tried going through AArch64MachineFrameLowering for this, hoping to
avoid creating the dummy object but this was the best I could do since
the stack info that uses isn't populated at this stage,
CreateFixedObject also explicitly forbids 0 sized objects.
Lu Weining [Mon, 4 Mar 2024 00:38:52 +0000 (08:38 +0800)]
[LoongArch] Override LoongArchTargetLowering::getExtendForAtomicCmpSwapArg (#83656)
This patch aims to solve Firefox issue:
https://bugzilla.mozilla.org/show_bug.cgi?id=
1882301
Similar to
616289ed2922. Currently LoongArch uses an ll.[wd]/sc.[wd]
loop for ATOMIC_CMP_XCHG. Because the comparison in the loop is
full-width (i.e. the `bne` instruction), we must sign extend the input
comparsion argument.
Note that LoongArch ISA manual V1.1 has introduced compare-and-swap
instructions. We would change the implementation (return `ANY_EXTEND`)
when we support them.
(cherry picked from commit
5f058aa211995d2f0df2a0e063532832569cb7a8)
Wang Pengcheng [Tue, 5 Mar 2024 11:54:02 +0000 (19:54 +0800)]
[TableGen] Fix wrong codegen of BothFusionPredicateWithMCInstPredicate (#83990)
We should generate the `MCInstPredicate` twice, one with `FirstMI`
and another with `SecondMI`.
(cherry picked from commit
de1f33873beff93063577195e1214a9509e229e0)
Vadim Paretsky [Sat, 9 Mar 2024 18:47:31 +0000 (10:47 -0800)]
[OpenMP] fix endianness dependent definitions in OMP headers for MSVC (#84540)
MSVC does not define __BYTE_ORDER__ making the check for BigEndian
erroneously evaluate to true and breaking the struct definitions in MSVC
compiled builds correspondingly. The fix adds an additional check for
whether __BYTE_ORDER__ is defined by the compiler to fix these.
---------
Co-authored-by: Vadim Paretsky <b-vadipa@microsoft.com>
(cherry picked from commit
110141b37813dc48af33de5e1407231e56acdfc5)
Fangrui Song [Mon, 11 Mar 2024 20:40:01 +0000 (13:40 -0700)]
ReleaseNotes for LLVM binary utilities (#83751)
Nikita Popov [Wed, 6 Mar 2024 08:33:51 +0000 (09:33 +0100)]
[InstCombine] Fix infinite loop in select equivalence fold (#84036)
When replacing with a non-constant, it's possible that the result of the
simplification is actually more complicated than the original, and may
result in an infinite combine loop.
Mitigate the issue by requiring that either the replacement or
simplification result is constant, which should ensure that it's
simpler. While this check is crude, it does not appear to cause
optimization regressions in real-world code in practice.
Fixes https://github.com/llvm/llvm-project/issues/83127.
(cherry picked from commit
9f45c5e1a65a1abf4920b617d36ed05e73c04bea)
Quentin Dian [Tue, 5 Mar 2024 22:16:28 +0000 (06:16 +0800)]
[InstCombine] Fix shift calculation in InstCombineCasts (#84027)
Fixes #84025.
(cherry picked from commit
e96c0c1d5e0a9916098b1a31acb006ea6c1108fb)
Fangrui Song [Wed, 6 Mar 2024 21:17:43 +0000 (13:17 -0800)]
[test] Make two sanitize-coverage tests pass with glibc 2.39+
glibc 2.39 added `nonnull` attribute to most libio functions accepting a
`FILE*` parameter, including fprintf[1]. The -fsanitize=undefined mode
checks the argument to fprintf and has extra counters, not expected by
two tests. Specify -fno-sanitize=nonnull-attribute to make the two tests
pass.
Fix #82883
[1]: https://sourceware.org/git/?p=glibc.git;a=commit;h=
64b1a44183a3094672ed304532bedb9acc707554
Pull Request: https://github.com/llvm/llvm-project/pull/84231
(cherry picked from commit
c3acbf6bb06f9039f9850e18e0ae2f2adef63905)
Florian Hahn [Sat, 2 Mar 2024 12:34:36 +0000 (12:34 +0000)]
[DSE] Delay deleting non-memory-defs until end of DSE. (#83411)
DSE uses BatchAA, which caches queries using pairs of MemoryLocations.
At the moment, DSE may remove instructions that are used as pointers in
cached MemoryLocations. If a new instruction used by a new MemoryLoation
and this instruction gets allocated at the same address as a previosuly
cached and then removed instruction, we may access an incorrect entry in
the cache.
To avoid this delay removing all instructions except MemoryDefs until
the end of DSE. This should avoid removing any values used in BatchAA's
cache.
Test case by @vporpo from
https://github.com/llvm/llvm-project/pull/83181.
(Test not precommitted because the results are non-determinstic - memset
only sometimes gets removed)
PR: https://github.com/llvm/llvm-project/pull/83411
(cherry picked from commit
10f5e983a9e3162a569cbebeb32168716e391340)
Paul Kirth [Thu, 29 Feb 2024 03:11:55 +0000 (19:11 -0800)]
[clang][fat-lto-objects] Make module flags match non-FatLTO pipelines (#83159)
In addition to being rather hard to follow, there isn't a good reason
why FatLTO shouldn't just share the same code for setting module flags
for (Thin)LTO. This patch simplifies the logic and makes sure we use set
these flags in a consistent way, independent of FatLTO.
Additionally, we now test that output in the .llvm.lto section actually
matches the output from Full and Thin LTO compilation.
(cherry picked from commit
7d8b50aaab8e0f935e3cb1f3f397e98b9e3ee241)
Jon Roelofs [Wed, 28 Feb 2024 21:03:35 +0000 (13:03 -0800)]
Allow .alt_entry symbols to pass the .cfi nesting check (#82268)
A symbol with an `N_ALT_ENTRY` attribute may be defined in the middle of
a subsection, so it is reasonable to opt them out of the
`.cfi_{start,end}proc` nesting check.
Fixes: https://github.com/llvm/llvm-project/issues/82261
(cherry picked from commit
5b91647e3f82c9747c42c3239b7d7f3ade4542a7)
YunQiang Su [Mon, 26 Feb 2024 21:08:58 +0000 (05:08 +0800)]
MIPS: fix emitDirectiveCpsetup on N32 (#80534)
In gas, .cpsetup may expand to one of two code sequences (one is related to `__gnu_local_gp`), depending on -mno-shared and -msym32.
Since Clang doesn't support -mno-shared or -msym32, .cpsetup expands to one code sequence.
The N32 condition incorrectly leads to the incorrect `__gnu_local_gp` code sequence.
```
00000000 <t1>:
0:
ffbc0008 sd gp,8(sp)
4:
3c1c0000 lui gp,0x0
4: R_MIPS_HI16 __gnu_local_gp
8:
279c0000 addiu gp,gp,0
8: R_MIPS_LO16 __gnu_local_gp
```
Fixes: #52785
(cherry picked from commit
860b6edfa9b344fbf8c500c17158c8212ea87d1c)
Mark de Wever [Tue, 27 Feb 2024 17:10:53 +0000 (18:10 +0100)]
[libc++][modules] Fixes naming inconsistency. (#83036)
The modules used is-standard-library and is-std-library. The latter is
the name used in the SG15 proposal,
Fixes: https://github.com/llvm/llvm-project/issues/82879
(cherry picked from commit
b50bcc7ffb6ad6caa4c141a22915ab59f725b7ae)
Tom Stellard [Mon, 11 Mar 2024 14:31:28 +0000 (07:31 -0700)]
Bump version to 18.1.2 (#84655)