Xing Xue [Tue, 20 Feb 2024 17:08:37 +0000 (12:08 -0500)]
[OpenMP][AIX]Add assembly file containing microtasking routines and unnamed common block definitions (#81770)
This patch adds assembly file `z_AIX_asm.S` that contains the 32- and
64-bit XCOFF version of microtasking routines and unnamed common block
definitions. This code has been run through the libomp LIT tests and a
user package successfully.
(cherry picked from commit
94100bc2fb1a39dbeb43d18a95176097c53f1324)
Nikita Popov [Tue, 20 Feb 2024 11:48:13 +0000 (12:48 +0100)]
[InstCombine] Fold gep of exact unsigned division (#82334)
Extend the transform added in
https://github.com/llvm/llvm-project/pull/76458 to also handle unsigned
division. X exact/ Y * Y == X holds independently of whether the
division is signed or unsigned.
Proofs: https://alive2.llvm.org/ce/z/wFd5Ec
(cherry picked from commit
26d4afc3de86ca5416c8e38000362c526b6808cd)
Nikita Popov [Tue, 20 Feb 2024 10:08:01 +0000 (11:08 +0100)]
[InstCombine] Add unsigned variants of gep exact div tests (NFC)
(cherry picked from commit
ec2c770b9f9a0e9eca4a893383d2b27dd4c0bfe7)
Luke Lau [Thu, 8 Feb 2024 22:51:11 +0000 (06:51 +0800)]
[RISCV] Check type is legal before combining mgather to vlse intrinsic (#81107)
Otherwise we will crash since target intrinsics don't have their types
legalized. Let the mgather get legalized first, then do the combine on
the legal type.
Fixes #81088
Co-authored-by: Craig Topper <craig.topper@sifive.com>
(cherry picked from commit
06c89bd59ca2279f76a41e851b7b2df634a6191e)
Yingwei Zheng [Sat, 17 Feb 2024 15:30:45 +0000 (23:30 +0800)]
[ValueTracking] Fix computeKnownFPClass for fpext (#81972)
This patch adds the missing `subnormal -> normal` part for `fpext` in
`computeKnownFPClass`.
Fixes the miscompilation reported by
https://github.com/llvm/llvm-project/pull/80941#issuecomment-
1947302100.
(cherry picked from commit
a5865c3c3dbbd17ae12ecc1c297fe1fc2605df52)
Frederic Cambus [Sat, 17 Feb 2024 14:38:05 +0000 (15:38 +0100)]
[Support/ELF] Add OpenBSD PT_OPENBSD_SYSCALLS constant.
Reference: https://github.com/openbsd/src/blob/master/sys/sys/exec_elf.h
(cherry picked from commit
97eff26d0ca4d187a5efb8534af484dbb68bce30)
Xing Xue [Fri, 16 Feb 2024 20:12:41 +0000 (15:12 -0500)]
[OpenMP][AIX] Set worker stack size to 2 x KMP_DEFAULT_STKSIZE if system stack size is too big (#81996)
This patch sets the stack size of worker threads to `2 x
KMP_DEFAULT_STKSIZE` (2 x 4MB) for AIX if the system stack size is too
big. Also defines maximum stack size for 32-bit AIX.
(cherry picked from commit
2de269a641e4ffbb7a44e559c4c0a91bb66df823)
Wael Yehia [Fri, 16 Feb 2024 17:55:20 +0000 (12:55 -0500)]
[AIX] Add a dummy variable in the __llvm_orderfile section (#81968)
to satisfy the __start___llvm_orderfile reference when linking with
-bexpfull and -fprofile-generate on AIX.
(cherry picked from commit
15cccc55919d27eb2e89379a65f6c7809f679fda)
Tom Stellard [Sun, 18 Feb 2024 00:19:39 +0000 (16:19 -0800)]
Use container on Linux to run llvm-project-tests workflow (#81349) (#81807)
(cherry picked from commit
fe20a759fcd20e1755ea1b34c5e6447a787925dc)
David Green [Sat, 17 Feb 2024 08:57:14 +0000 (08:57 +0000)]
[AArch64][GlobalISel] Fail legalization for unknown libcalls. (#81873)
If, like powi on windows, the libcall is unavailable we should fall back
to SDAG. Currently we try and generate a call to "".
(cherry picked from commit
47c65cf62d06add9f55a77c9d45390fa3b986fc5)
Ulrich Weigand [Wed, 14 Feb 2024 17:26:38 +0000 (18:26 +0100)]
[lld/ELF] Avoid unnecessary TPOFF relocations in GOT for -pie (#81739)
With the new SystemZ port we noticed that -pie executables generated
from files containing R_390_TLS_IEENT relocations will have unnecessary
relocations in their GOT:
9e8d8: R_390_TLS_TPOFF *ABS*+0x18
This is caused by the config->isPic conditon in addTpOffsetGotEntry:
static void addTpOffsetGotEntry(Symbol &sym) {
in.got->addEntry(sym);
uint64_t off = sym.getGotOffset();
if (!sym.isPreemptible && !config->isPic) {
in.got->addConstant({R_TPREL, target->symbolicRel, off, 0, &sym});
return;
}
It is correct that we need to retain a TPOFF relocation if the target
symbol is preemptible or if we're building a shared library. But when
building a -pie executable, those values are fixed at link time and
there's no need for any remaining dynamic relocation.
Note that the equivalent MIPS-specific code in MipsGotSection::build
checks for config->shared instead of config->isPic; we should use the
same check here. (Note also that on many other platforms we're not even
using addTpOffsetGotEntry in this case as an IE->LE relaxation is
applied before; we don't have this type of relaxation on SystemZ.)
(cherry picked from commit
6f907733e65d24edad65f763fb14402464bd578b)
Tom Stellard [Sat, 10 Feb 2024 04:57:05 +0000 (20:57 -0800)]
[lld] Fix test failures when running as root user (#81339)
This makes it easier to run the tests in a containerized environment.
(cherry picked from commit
e165bea1d4ec2de96ee0548cece79d71a75ce8f8)
Mark de Wever [Tue, 13 Feb 2024 19:04:34 +0000 (20:04 +0100)]
[libc++][modules] Re-add build dir CMakeLists.txt. (#81370)
This CMakeLists.txt is used to build modules without build system
support. This was removed in
d06ae33ec32122bb526fb35025c1f0cf979f1090.
This is used in the documentation how to use modules.
Made some minor changes to make it work with the std.compat module using
the std module.
Note the CMakeLists.txt in the build dir should be removed once build
system support is generally available.
(cherry picked from commit
fc0e9c8315564288f9079a633892abadace534cf)
Alexey Bataev [Thu, 25 Jan 2024 14:06:15 +0000 (06:06 -0800)]
[SLP]Fix PR79229: Do not erase extractelement, if it used in
multiregister node.
If the node can be span between several registers and same
extractelement instruction is used in several parts, it may be required
to keep such extractelement instruction to avoid compiler crash.
(cherry picked from commit
6fe21bc1dac883efa0dfa807f327048ae9969b81)
Alexey Bataev [Wed, 24 Jan 2024 18:57:18 +0000 (10:57 -0800)]
[SLP]Fix PR79229: Check that extractelement is used only in a single node
before erasing.
Before trying to erase the extractelement instruction, not enough to
check for single use, need to check that it is not used in several nodes
because of the preliminary nodes reordering.
(cherry picked from commit
48bbd7658710ef1699bf2a6532ff5830230aacc5)
Nikita Popov [Fri, 16 Feb 2024 13:50:14 +0000 (14:50 +0100)]
Backport [DAGCombine] Fix multi-use miscompile in load combine (#81586) (#81633)
(cherry picked from commit
25b9ed6e4964344e3710359bec4c831e5a8448b9)
Martin Storsjö [Fri, 16 Feb 2024 13:48:29 +0000 (15:48 +0200)]
[LLD] [docs] Add more release notes for COFF and MinGW (#81977)
Add review references to all items already mentioned.
Move some items to the right section (from the MinGW section to COFF, as
the implementation is in the COFF linker side, and may be relevant for
non-MinGW cases as well).
Jinyang He [Tue, 6 Feb 2024 01:09:13 +0000 (09:09 +0800)]
[lld][ELF] Support relax R_LARCH_ALIGN (#78692)
Refer to commit
6611d58f5bbc ("Relax R_RISCV_ALIGN"), we can relax
R_LARCH_ALIGN by same way. Reuse `SymbolAnchor`, `RISCVRelaxAux` and
`initSymbolAnchors` to simplify codes. As `riscvFinalizeRelax` is an
arch-specific function, put it override on `TargetInfo::finalizeRelax`,
so that LoongArch can override it, too.
The flow of relax R_LARCH_ALIGN is almost consistent with RISCV. The
difference is that LoongArch only has 4-bytes NOP and all executable
insn is 4-bytes aligned. So LoongArch not need rewrite NOP sequence.
Alignment maxBytesEmit parameter is supported in psABI v2.30.
(cherry picked from commit
06a728f3feab876f9195738b5774e82dadc0f3a7)
Zixu Wang [Fri, 16 Feb 2024 13:36:18 +0000 (05:36 -0800)]
[18.x][Docs] Add release note about Clang-defined target OS macros (#80044)
The change is included in the 18.x release. Move the release note to the
release branch and reformat.
(cherry picked from commit
b40d5b1b08564d23d5e0769892ebbc32447b2987)
Ulrich Weigand [Tue, 13 Feb 2024 10:29:21 +0000 (11:29 +0100)]
[lld] Add target support for SystemZ (s390x) (#75643)
This patch adds full support for linking SystemZ (ELF s390x) object
files. Support should be generally complete:
- All relocation types are supported.
- Full shared library support (DYNAMIC, GOT, PLT, ifunc).
- Relaxation of TLS and GOT relocations where appropriate.
- Platform-specific test cases.
In addition to new platform code and the obvious changes, there were a
few additional changes to common code:
- Add three new RelExpr members (R_GOTPLT_OFF, R_GOTPLT_PC, and
R_PLT_GOTREL) needed to support certain s390x relocations. I chose not
to use a platform-specific name since nothing in the definition of these
relocs is actually platform-specific; it is well possible that other
platforms will need the same.
- A couple of tweaks to TLS relocation handling, as the particular
semantics of the s390x versions differ slightly. See comments in the
code.
This was tested by building and testing >1500 Fedora packages, with only
a handful of failures; as these also have issues when building with LLD
on other architectures, they seem unrelated.
Co-authored-by: Tulio Magno Quites Machado Filho <tuliom@redhat.com>
(cherry picked from commit
fe3406e349884e4ef61480dd0607f1e237102c74)
Xing Xue [Tue, 13 Feb 2024 20:11:24 +0000 (15:11 -0500)]
[OpenMP][AIX]Define struct kmp_base_tas_lock with the order of two members swapped for big-endian (#79188)
The direct lock data structure has bit `0` (the least significant bit)
of the first 32-bit word set to `1` to indicate it is a direct lock. On
the other hand, the first word (in 32-bit mode) or first two words (in
64-bit mode) of an indirect lock are the address of the entry allocated
from the indirect lock table. The runtime checks bit `0` of the first
32-bit word to tell if this is a direct or an indirect lock. This works
fine for 32-bit and 64-bit little-endian because its memory layout of a
64-bit address is (`low word`, `high word`). However, this causes
problems for big-endian where the memory layout of a 64-bit address is
(`high word`, `low word`). If an address of the indirect lock table
entry is something like `0x110035300`, i.e., (`0x1`, `0x10035300`), it
is treated as a direct lock. This patch defines `struct
kmp_base_tas_lock` with the ordering of the two 32-bit members flipped
for big-endian PPC64 so that when checking/setting tags in member
`poll`, the second word (the low word) is used. This patch also changes
places where `poll` is not already explicitly specified for
checking/setting tags.
(cherry picked from commit
ac97562c99c3ae97f063048ccaf08ebdae60ac30)
Xing Xue [Wed, 7 Feb 2024 20:24:52 +0000 (15:24 -0500)]
[OpenMP][test]Flip bit-fields in 'struct flags' for big-endian in test cases (#79895)
This patch flips bit-fields in `struct flags` for big-endian in test
cases to be consistent with the definition of the structure in libomp
`kmp.h`.
(cherry picked from commit
7a9b0e4acb3b5ee15f8eb138aad937cfa4763fb8)
Martin Storsjö [Tue, 13 Feb 2024 07:32:40 +0000 (09:32 +0200)]
[LLD] [MinGW] Implement the --lto-emit-asm and -plugin-opt=emit-llvm options (#81475)
These were implemented in the COFF linker in
3923e61b96cf90123762f0e0381504efaba2d77a and
d12b99a4313816cf99e97cb5f579e2d51ba72b0b.
This matches the corresponding options in the ELF linker.
(cherry picked from commit
d033366bd2189e33343ca93d276b40341dc39770)
yozhu [Fri, 16 Feb 2024 12:53:41 +0000 (04:53 -0800)]
[CFI][annotation] Leave alone function pointers in function annotations (#81673)
Function annotation, as part of llvm.metadata, is for the function
itself and doesn't apply to its corresponding jump table entry, so with
CFI we shouldn't replace function pointer in function annotation with
pointer to its corresponding jump table entry.
(cherry picked from commit
c7a0db1e20251f436e3d500eac03bd9be1d88b45)
Nikita Popov [Mon, 12 Feb 2024 09:00:34 +0000 (10:00 +0100)]
[AArch64] Only apply bool vector bitcast opt if result is scalar (#81256)
This optimization tries to optimize bitcasts from `<N x i1>` to iN, but
currently also triggers for `<N x i1>` to `<M x iK>` bitcasts, if custom
lowering has been requested for these for an unrelated reason. Fix this
by explicitly checking that the result type is scalar.
Fixes https://github.com/llvm/llvm-project/issues/81216.
(cherry picked from commit
92d79922051f732560acf3791b543df1e6580689)
Martin Storsjö [Thu, 8 Feb 2024 13:28:46 +0000 (15:28 +0200)]
[OpenMP] [cmake] Don't use -fno-semantic-interposition on Windows (#81113)
This was added in
4b7beab4187ab0766c3d7b272511d5751431a8da. When the
flag was added implicitly elsewhere, it was added via
llvm/cmake/modules/HandleLLVMOptions.cmake, where it wasn't added on
Windows/Cygwin targets.
This avoids one warning per object file in OpenMP.
(cherry picked from commit
72f04fa0734f8559ad515f507a4a3ce3f461f196)
Craig Topper [Fri, 16 Feb 2024 00:34:40 +0000 (16:34 -0800)]
[RISCV] Make sure ADDI replacement in optimizeCondBranch has a virtual reg destination. (#81938)
If it isn't virtual, we may extend the live range of the physical
register past were it is valid. For example, across a call.
Found while trying to enable -riscv-enable-sink-fold which enables some
copy propagation in machine sink that led to ADDIs with physical
register destinations.
(cherry picked from commit
feee627974df81e4cbf15537e4c4688aed66b12f)
Craig Topper [Thu, 15 Feb 2024 18:48:52 +0000 (10:48 -0800)]
[RISCV] Use APInt in useInversedSetcc to prevent crashes when mask is larger than UINT64_MAX. (#81888)
There are no checks that the type is legal so we need to handle any
type.
(cherry picked from commit
b57ba8ec514190b38eced26d541e8e25af66c485)
Balazs Benics [Fri, 16 Feb 2024 06:16:19 +0000 (07:16 +0100)]
[analyzer][docs] Admit that the cleanup attribute is not supported (#81834)
In fact, the cleanup attribute is only added to the CFG, but still
unhandled by CSA.
I propose dropping this false "support" statement from the docs.
YunQiang Su [Wed, 14 Feb 2024 20:48:55 +0000 (04:48 +0800)]
MipsAsmParser/O32: Don't add redundant $ to $-prefixed symbol in the la macro (#80644)
When parsing the `la` macro, we add a duplicate `$` prefix in
`getOrCreateSymbol`,
leading to `error: Undefined temporary symbol $$yy` for code like:
```
xx:
la $2,$yy
$yy:
nop
```
Remove the duplicate prefix.
In addition, recognize `.L`-prefixed symbols as local for O32.
See: #65020.
---------
Co-authored-by: Fangrui Song <i@maskray.me>
(cherry picked from commit
c007fbb19879f9b597b47ae772c53e53cdc65f29)
Maryam Moghadas [Fri, 16 Feb 2024 06:01:26 +0000 (01:01 -0500)]
[PowerPC] Update V18.1.0 release notes (#81631)
Adding PowerPC updates for clang and llvm into the V18.1.0 release
notes.
---------
Co-authored-by: Maryam Moghadas <maryammo@ca.ibm.com>
Matthew Devereau [Fri, 2 Feb 2024 08:12:05 +0000 (08:12 +0000)]
[AArch64][SME] Implement inline-asm clobbers for za/zt0 (#79276)
This enables specifing "za" or "zt0" to the clobber list for inline asm.
This complies with the acle SME addition to the asm extension here:
https://github.com/ARM-software/acle/pull/276
(cherry picked from commit
d9c20e437fe110fb79b5ca73a52762e5b930b361)
Philip Reames [Fri, 16 Feb 2024 05:56:56 +0000 (21:56 -0800)]
Revert "[RISCV] Recurse on first operand of two operand shuffles (#79180)" (#80238)
This reverts commit
bdc41106ee48dce59c500c9a3957af947f30c8c3 on the
release/18.x branch. This change was the first in a mini-series
and while I'm not aware of any particular problem from having it on
it's own in the branch, it seems safer to ship with the previous
known good state.
Owen Pan [Tue, 13 Feb 2024 03:20:26 +0000 (19:20 -0800)]
[clang-format] Don't remove parentheses in macro definitions (#81444)
Closes #81399.
(cherry picked from commit
4af24d4ab76539706bfbceec4b3923426fb1b9e7)
Mark de Wever [Sat, 10 Feb 2024 16:09:53 +0000 (17:09 +0100)]
[libc++][print] Moves is_terminal to the dylib. (#80464)
Having the test in the header requires including unistd.h on POSIX
platforms. This header has other declarations which may conflict with
code that uses named declarations provided by this header. For example
code using "int pipe;" would conflict with the function pipe in this
header.
Moving the code to the dylib means std::print would not be available on
Apple backdeployment targets. On POSIX platforms there is no transcoding
required so a not Standard conforming implementation is still a useful
and the observable differences are minimal. This behaviour has been done
for print before https://github.com/llvm/llvm-project/pull/76293.
Note questions have been raised in LWG4044 "Confusing requirements for
std::print on POSIX platforms", whether or not the isatty check on POSIX
platforms is required. When this LWG issue is resolved the
backdeployment targets could become Standard compliant.
This patch is intended to be backported to the LLVM-18 branch.
Fixes: https://github.com/llvm/llvm-project/issues/79782
(cherry picked from commit
4fb7b3301bfbd439eb3d30d6a36c7cdb26941a0d)
Martin Storsjö [Fri, 16 Feb 2024 05:35:12 +0000 (07:35 +0200)]
[LLD] [docs] Add a release note for the SOURCE_DATE_EPOCH support (#81388)
Nikita Popov [Tue, 13 Feb 2024 08:29:56 +0000 (09:29 +0100)]
[AArch64][GISel] Don't pointlessly lower G_TRUNC (#81479)
If we have something like G_TRUNC from v2s32 to v2s16, then lowering
this to a concat of two G_TRUNC s32 to s16 followed by G_TRUNC from
v2s16 to v2s8 does not bring us any closer to legality. In fact, the
first part of that is a G_BUILD_VECTOR whose legalization will produce a
new G_TRUNC from v2s32 to v2s16, and both G_TRUNCs will then get
combined to the original, causing a legalization cycle.
Make the lowering condition more precise, by requiring that the original
vector is >128 bits, which is I believe the only case where this
specific splitting approach is useful.
Note that this doesn't actually produce a legal result (the alwaysLegal
is a lie, as before), but it will cause a proper globalisel abort
instead of an infinite legalization loop.
Fixes https://github.com/llvm/llvm-project/issues/81244.
(cherry picked from commit
070848c17c2944afa494d42d3ad42929f3379842)
Martin Storsjö [Mon, 12 Feb 2024 11:22:45 +0000 (13:22 +0200)]
[LLD] [test] Avoid printing timestamps past INT32_MAX with llvm-readobj (#81463)
If llvm-readobj is built with a 32 bit time_t, it can't print such
timestamps correctly.
(cherry picked from commit
0bf4ff29816c0eead99ba576a2df2e3c4d214b1f)
Koakuma [Sun, 11 Feb 2024 07:04:18 +0000 (14:04 +0700)]
[SPARC] Support reserving arbitrary general purpose registers (#74927)
This adds support for marking arbitrary general purpose registers -
except for those with special purpose (G0, I6-I7, O6-O7) - as reserved,
as needed by some software like the Linux kernel.
(cherry picked from commit
c2f9885a8aa3a820eefdacccf3fcc6b9d87e3284)
Kai Sasaki [Fri, 2 Feb 2024 08:07:44 +0000 (17:07 +0900)]
[mlir] Skip invalid test on big endian platform (s390x) (#80246)
The buildbot test running on s390x platform keeps failing since [this
time](https://lab.llvm.org/buildbot/#/builders/199/builds/31136). This
is because of the dependency on the endianness of the platform. It
expects the format invalid in the big endian platform (s390x). We can
simply skip it.
See: https://discourse.llvm.org/t/mlir-s390x-linux-failure/76695
(cherry picked from commit
65ac8c16e028b23b49fd6b03817faa1ab6c0229d)
Martin Storsjö [Sat, 10 Feb 2024 21:57:12 +0000 (23:57 +0200)]
[LLD] [COFF] Pick timestamps from the SOURCE_DATE_EPOCH variable (#81326)
The SOURCE_DATE_EPOCH environment variable can be set in order to get
reproducible build.
When linking PE/COFF modules with LLD, the timestamp field is set to the
current time, unless either the /timestamp: or /Brepro option is set. If
neither of them is set, check the SOURCE_DATE_EPOCH variable, before
resorting to using the actual current date and time.
See https://reproducible-builds.org/docs/source-date-epoch/ for reference
on the use of this variable.
(cherry picked from commit
0df8aed6c30f08ded526038a6bbb4daf113a31c1)
Po-yao Chang [Sat, 10 Feb 2024 14:22:16 +0000 (22:22 +0800)]
[libc++][modules] Fix disabling Unicode (#81294)
-DLIBCXX_ENABLE_UNICODE=OFF or -D_LIBCPP_HAS_NO_UNICODE doesn't build
without this change.
(cherry picked from commit
30cd1838dc334775f7a29f57b581f2bdda3f0ea1)
Quentin Dian [Fri, 9 Feb 2024 07:29:05 +0000 (15:29 +0800)]
[RegisterCoalescer] Clear instructions not recorded in `ErasedInstrs` but erased (#79820)
Fixes #79718. Fixes #71178.
The same instructions may exist in an iteration. We cannot immediately
delete instructions in `ErasedInstrs`.
(cherry picked from commit
95b14da678f4670283240ef4cf60f3a39bed97b4)
Arthur Eubanks [Wed, 7 Feb 2024 17:16:36 +0000 (10:16 -0700)]
[X86] Fix lowering TLS under darwin large code model (#80907)
OpFlag and WrapperKind should be chosen consistently with each other in
regards to PIC, otherwise we hit asserts later on.
Broken by
c04a05d8.
Fixes #80831.
(cherry picked from commit
5a83bccb35d6b0e6914b52af6db067aa01dd3efb)
Owen Pan [Tue, 6 Feb 2024 17:00:15 +0000 (09:00 -0800)]
Revert "[clang] Mark clang-format-ignore.cpp as unsupported on Windows"
This reverts commit
dc61ebb44c11d2f5d03b7dd9cb80a0644a30775e.
See https://github.com/llvm/llvm-project/pull/76733#issuecomment-
1890311152.
(cherry picked from commit
a628f68a9c4ce6f3dcd0c8bb3650db45671ed15a)
Owen Pan [Thu, 8 Feb 2024 05:35:43 +0000 (21:35 -0800)]
[clang-format] Fix a regression in dumping the config (#80628)
Commit
d813af73f70f addressed a regression introduced by commit
3791b3fca6ea
but caused `clang-format -dump-config` to "hang".
This patch reverts changes to ClangFormat.cpp by both commits and
reworks the cleanup.
Fixes #80621.
(cherry picked from commit
8f6e13e6da84510c8321717860fd506e12118514)
YunQiang Su [Thu, 8 Feb 2024 01:15:53 +0000 (09:15 +0800)]
MIPS/libunwind: Use -mfp64 if compiler is FPXX (#68521)
Libunwind supports FP64 and FP32 modes, but not FPXX. The reason is
that, FP64 and FP32 have different way to save/restore FPRs. If
libunwind is built as FPXX, we have no idea which one should we use.
It's not due to the code bug, but rather the nature of FPXX.
FPXX is an ABI which uses only a common subset of FR=1(FP64) and FR=0
(FP32).
So that FPXX binaries can link with both FP64 and FP32 ones, aka.
FPXX + FP32 -> FP32
FPXX + FP64 -> FP64
While for libunwind, we should save/restore all of FPRs. If we use FPXX,
we can only save/restore a common subset of FPRs, instead of superset.
If libunwind is built as FP64, it will interoperatable with FPXX/FP64
APPs, and if it is built as FP32, it will interoperatable with
FP32/FPXX. Currently most of O32 APPs are FPXX or FP64, while few are
FP32.
So if the compiler is FPXX, which is the default value of most
toolchain, let's switch it to FP64.
Co-authored-by: YunQiang Su <yunqiang.su@cipunited.com>
(cherry picked from commit
4520b478d2512b0f39764e0464dcb4cb961845b5)
Mariya Podchishchaeva [Tue, 6 Feb 2024 12:57:35 +0000 (15:57 +0300)]
[clang] Fix unexpected `-Wconstant-logical-operand` in C23 (#80724)
C23 has `bool`, but logical operators still return int. Check that
we're not in C to avoid false-positive -Wconstant-logical-operand.
Fixes https://github.com/llvm/llvm-project/issues/64356
(cherry picked from commit
a18e92d020b895b712175a3b13a3d021608115a7)
Fangrui Song [Tue, 30 Jan 2024 21:58:40 +0000 (13:58 -0800)]
[dfsan] Wrap glibc 2.38 __isoc23_* functions (#79958)
Fix #79283: `test/dfsan/custom.cpp` has undefined symbol linker errors
on glibc 2.38 due to lack of wrappers for `__isoc23_strtol` and
`__isoc23_scanf` family functions.
Implement these wrappers as aliases to existing wrappers, similar to
https://reviews.llvm.org/
D158943 for other sanitizers.
`strtol` in a user program, whether or not `_ISOC2X_SOURCE` is defined,
uses the C23 semantics (`strtol("0b1", 0, 0)` => 1), when
`libclang_rt.dfsan.a` is built on glibc 2.38+.
(cherry picked from commit
648560062af8deb4e6478130deb1dd8fa62929a8)
Sander de Smalen [Tue, 6 Feb 2024 10:42:44 +0000 (10:42 +0000)]
[Clang][AArch64] Fix some target guards and remove +sve from tests. (#80681)
The TargetGuard fields for 'svldr[_vnum]_za' and 'svstr[_vnum]_za' were
incorrectly set to `+sve` instead of `+sme`. This means that compiling
code that uses these intrinsics requires compiling for both `+sve` as
well as `+sme`.
This PR also fixes the target guards for the `svadd` and `svsub`
builtins that are enabled under `+sme2,+sme-i16i64` and
`+sme2,+sme-f64f64`, as it initially did the following:
```
let TargetGuard = "+sme2" in {
let TargetGuard = "+sme-i16i64" in {
// Builtins defined here will be predicated only by
// '+sme-i16i64', and not '+sme2,+sme-i16i64'.
}
}
```
This PR also removes `-target-feature +sve` from all the SME tests, to
ensure that the SME features are sufficient to build the tests.
(cherry picked from commit
3d186a77cf1aa979014a6443cb423a633c167d9f)
Shanzhi [Mon, 29 Jan 2024 11:17:13 +0000 (19:17 +0800)]
[Clang][AST] Fix a crash on attaching doc comments (#78716)
This crash is basically caused by calling
`ASTContext::getRawCommentForDeclNoCacheImp` with its input arguments
`RepresentativeLocForDecl` and `CommentsInTheFile` refering to different
files. A reduced reproducer is provided in this patch.
After the source locations for instantiations of funtion template are
corrected in the commit
256a0b298c68b89688b80350b034daf2f7785b67, the
variable `CommitsInThisFile` in the function
`ASTContext::attachCommentsToJustParsedDecls` would refer to the source
file rather than the header file for implicit function template
instantiation. Therefore, in the first loop in
`ASTContext::attachCommentsToJustParsedDecls`, `D` should also be
adjusted for relevant scenarios like the second loop.
Fixes #67979
Fixes #68524
Fixes #70550
(cherry picked from commit
5f4ee5a2dfa97fe32ee62d1d67aa1413d5a059e6)
Tom Stellard [Wed, 7 Feb 2024 16:44:52 +0000 (08:44 -0800)]
[workflows] Fix libclc CI tests (#80942)
This was broken by
1a6426067fb33a8a789978f6e229108787a041be.
(cherry picked from commit
ab92f6274b7c3a4b4445d47017bc481aa919545f)
Tom Stellard [Mon, 5 Feb 2024 17:46:19 +0000 (09:46 -0800)]
[workflows] Use /mnt as the build directory on Linux (#80583)
There is more space available on /mnt (~56G) than on / (~30G), and we
are starting to see some of the CI jobs run out of disk space on Linux.
(cherry picked from commit
1a6426067fb33a8a789978f6e229108787a041be)
Tom Stellard [Tue, 6 Feb 2024 00:44:11 +0000 (16:44 -0800)]
[workflows] Fix lldb-tests and libclc-tests (#80751)
This was broken by
d25022bb689b9bf48a24c0ae6c29c1d3c2f32823, which
caused the workflow to pass an empty string to ninja as the target. The
'all' target is probably not the right target for these tests, but this
is what the behavior was before
d25022bb689b9bf48a24c0ae6c29c1d3c2f32823.
(cherry picked from commit
792d928e15aa30c8b686eff465598ceea0b03891)
Tom Stellard [Sun, 4 Feb 2024 05:37:46 +0000 (21:37 -0800)]
[workflows] Stop using the build-test-llvm-project action (#80580)
This action is really just a wrapper around cmake and ninja. It doesn't
add any value to the builds, and I don't think we need it now that there
are reusable workflows.
(cherry picked from commit
d25022bb689b9bf48a24c0ae6c29c1d3c2f32823)
David CARLIER [Wed, 24 Jan 2024 23:07:32 +0000 (23:07 +0000)]
[compiler-rt] remove hexdump interception. (#79378)
a freebsd dev member reported a symbol conflict and intercepting this
had little value anyway.
(cherry picked from commit
16a1ef86cbc5e6c829919ec6c73325413b0cd21b)
Chuanqi Xu [Thu, 1 Feb 2024 05:44:32 +0000 (13:44 +0800)]
[C++20] [Modules] Introduce -fskip-odr-check-in-gmf (#79959)
Close https://github.com/llvm/llvm-project/issues/79240
Cite the comment from @mizvekov in
//github.com/llvm/llvm-project/issues/79240:
> There are two kinds of bugs / issues relevant here:
>
> Clang bugs that this change hides
> Here we can add a Frontend flag that disables the GMF ODR check, just
> so
> we can keep tracking, testing and fixing these issues.
> The Driver would just always pass that flag.
> We could add that flag in this current issue.
> Bugs in user code:
> I don't think it's worth adding a corresponding Driver flag for
> controlling the above Frontend flag, since we intend it's behavior to
> become default as we fix the problems, and users interested in testing
> the more strict behavior can just use the Frontend flag directly.
This patch follows the suggestion:
- Introduce the CC1 flag `-fskip-odr-check-in-gmf` which is by default
off, so that the every existing test will still be tested with checking
ODR violations.
- Passing `-fskip-odr-check-in-gmf` in the driver to keep the behavior
we intended.
- Edit the document to tell the users who are still interested in more
strict checks can use `-Xclang -fno-skip-odr-check-in-gmf` to get the
existing behavior.
Chuanqi Xu [Mon, 29 Jan 2024 06:32:29 +0000 (14:32 +0800)]
[C++20] [Modules] Remove previous workaround for odr hashing enums
Previosly we land
https://github.com/llvm/llvm-project/commit/
085eae6b863881fb9fda323e5b672b04a00ed19e
to workaround the false positive ODR violations in
https://github.com/llvm/llvm-project/issues/76638.
However, we decided to not perform ODR checks for decls from GMF in
https://github.com/llvm/llvm-project/issues/79240 and we land the
corresponding change. So we should be able to remove the workaround now.
The original tests get remained.
Chuanqi Xu [Mon, 29 Jan 2024 03:42:08 +0000 (11:42 +0800)]
[C++20] [Modules] Don't perform ODR checks in GMF
Close https://github.com/llvm/llvm-project/issues/79240.
See the linked issue for details. Given the frequency of issue reporting
about false positive ODR checks (I received private issue reports too),
I'd like to backport this to 18.x too.
Momchil Velikov [Wed, 7 Feb 2024 05:29:25 +0000 (05:29 +0000)]
[AArch64] Add some release notes items (#79983)
Owen Pan [Sat, 27 Jan 2024 02:32:03 +0000 (18:32 -0800)]
[clang-format] Fix a bug in AnnotatingParser::rParenEndsCast() (#79549)
Fixes #78965.
(cherry picked from commit
f826f55b2ab68c2515fae751dc2d6ef77f37b172)
Alexandros Lamprineas [Wed, 7 Feb 2024 01:11:39 +0000 (01:11 +0000)]
[Release Notes][FMV] Document support for rcpc3 and mops features. (#80152)
Documents support for Load-Acquire RCpc instructions v3 (rcpc3) as well
as Memory Copy and Memory Set Acceleration instructions (mops) when
targeting AArch64.
Shafik Yaghmour [Mon, 5 Feb 2024 22:40:07 +0000 (14:40 -0800)]
[Clang][Sema] Fix regression due to missing ambiguity check before attempting access check. (#80730)
Previously when fixing ambiguous lookup diagnostics in
cc1b6668c57170cd440d321037ced89d6a61a9cb The change refactored
`LookupResult` to split out diagnosing access and ambiguous lookups. The
call to `getSema().CheckLookupAccess(...)` should have guarded by a
check for isAmbiguous(). This change adds that guard.
Fixes: https://github.com/llvm/llvm-project/issues/80435
(cherry picked from commit
a7bc9cb6ffa91ff0ebabc45c0c7263c7c2c3a4de)
alexfh [Wed, 7 Feb 2024 01:02:12 +0000 (02:02 +0100)]
Revert "[SemaCXX] Implement CWG2137 (list-initialization from objects of the same type) (#77768)" in release/18.x (#79400)
- Revert "[SemaCXX] Implement CWG2137 (list-initialization from objects
of the same type) (#77768)", see
https://github.com/llvm/llvm-project/pull/77768#issuecomment-
1908946696
Eric [Wed, 7 Feb 2024 01:01:38 +0000 (19:01 -0600)]
[🍒] Unconditionally lower std::string's alignment requirement from 16 to 8 (#68925) (#79480)
This change saves memory by providing the allocator more freedom to
allocate the most
efficient size class by dropping the alignment requirements for
std::string's
pointer from 16 to 8. This changes the output of std::string::max_size,
which makes it ABI breaking.
That said, the discussion concluded that we don't care about this ABI
break. and would like this change enabled universally.
The ABI break isn't one of layout or "class size", but rather the value
of "max_size()" changes, which in turn changes whether `std::bad_alloc`
or `std::length_error` is thrown for large allocations.
This change is the child of PR #68807, which enabled the change behind
an ABI flag.
Oskar Wirga [Wed, 7 Feb 2024 01:01:01 +0000 (17:01 -0800)]
Refactor recomputeLiveIns to operate on whole CFG (#79498) (#79641)
Currently, the way that recomputeLiveIns works is that it will recompute
the livein registers for that MachineBasicBlock but it matters what
order you call recomputeLiveIn which can result in incorrect register
allocations down the line.
Now we do not recompute the entire CFG but we do ensure that the newly
added MBB do reach convergence. This fixes a register allocation bug
introduced in AArch64 stack probing.
(cherry picked from commit
ff4636a4ab00b633c15eb3942c26126ceb2662e6)
Shengchen Kan [Sun, 28 Jan 2024 01:06:27 +0000 (09:06 +0800)]
[X86][tablgen] Fix the broadcast tables (#79675)
(cherry picked from commit
7c3ee7cbe6419ea5e37ce2723cc1a1688380581f)
Graham Hunter [Fri, 26 Jan 2024 11:30:35 +0000 (11:30 +0000)]
[LV] Fix handling of interleaving linear args (#78725)
Currently when interleaving vector calls with linear arguments,
the Part is ignored and all vector calls use the initial value
from the first lane of the current iteration.
Fix this to extract from the correct part of the linear vector.
(cherry picked from commit
d4c01714239e80d21e441c3886749fc56b743f81)
Martin Storsjö [Wed, 7 Feb 2024 00:36:23 +0000 (02:36 +0200)]
[libcxx] Add a release note for Clang-cl specific features (#80010)
Martin Storsjö [Wed, 7 Feb 2024 00:20:10 +0000 (02:20 +0200)]
[docs] Add release notes for Windows specific changes in 18.x (#80011)
Younan Zhang [Wed, 7 Feb 2024 00:11:28 +0000 (08:11 +0800)]
PR for llvm/llvm-project#79568 (#80120)
Backporting https://github.com/llvm/llvm-project/pull/79568 to clang 18.
Owen Pan [Thu, 1 Feb 2024 04:20:26 +0000 (20:20 -0800)]
[clang-format] Simplify the AfterPlacementOperator option (#79796)
Change AfterPlacementOperator to a boolean and deprecate SBPO_Never,
which meant never inserting a space except when after new/delete.
Fixes #78892.
(cherry picked from commit
908fd09a13b2e89a52282478544f7f70cf0a887f)
Florian Hahn [Wed, 24 Jan 2024 14:25:54 +0000 (14:25 +0000)]
[ConstraintElim] Make sure min/max intrinsic results are not poison.
The result of umin may be poison and in that case the added constraints
are not be valid in contexts where poison doesn't cause UB. Only queue
facts for min/max intrinsics if the result is guaranteed to not be
poison.
This could be improved in the future, by only adding the fact when
solving conditions using the result value.
Fixes https://github.com/llvm/llvm-project/issues/78621.
(cherry picked from commit
3d91d9613e294b242d853039209b40a0cb7853f2)
Florian Hahn [Wed, 24 Jan 2024 11:56:02 +0000 (11:56 +0000)]
[ConstraintElim] Add tests for #78621.
Tests with umin where the result may be poison for
https://github.com/llvm/llvm-project/issues/78621.
(cherry picked from commit
c83180c1248615cf6ea8842eb4e0cebebba4ab57)
Alexandros Lamprineas [Mon, 29 Jan 2024 16:37:09 +0000 (16:37 +0000)]
[AArch64][TargetParser] Add mcpu alias for Microsoft Azure Cobalt 100. (#79614)
With
a690e86 we added -mcpu/mtune=native support to handle the Microsoft
Azure Cobalt 100 CPU as a Neoverse N2. This patch adds a CPU alias in
TargetParser to maintain compatibility with GCC.
(cherry picked from commit
ae8005ffb6cd18900de8ed5a86f60a4a16975471)
Fangrui Song [Tue, 6 Feb 2024 17:23:33 +0000 (09:23 -0800)]
[MIPS] Use generic isBlockOnlyReachableByFallthrough (#80799)
FastISel may create a redundant BGTZ terminal which fallthroughes.
```
BGTZ %2:gpr32, %bb.1, implicit-def $at
bb.1.bb1:
; predecessors: %bb.0
```
The `!I->isBarrier()` check in
MipsAsmPrinter::isBlockOnlyReachableByFallthrough
will incorrectly not print a label, leading to a `Undefined temporary
symbol `
error when we try assembling the output assembly file. See the updated
`Fast-ISel/pr40325.ll` and
https://github.com/rust-lang/rust/issues/108835
In addition, the `SwitchInst` condition is too conservative and prints
many unneeded labels (see the updated tests).
Just use the generic isBlockOnlyReachableByFallthrough, updated by
commit
1995b9fead62f2f6c0ad217bd00ce3184f741fdb for SPARC, which also
handles MIPS.
(cherry picked from commit
6b2fd7aed66d592738f26c76caa8fff95e168598)
Zahira Ammarguellat [Tue, 6 Feb 2024 14:23:22 +0000 (06:23 -0800)]
[CLANG] Fix INF/NAN warning. (#80290)
In https://github.com/llvm/llvm-project/pull/76873 a warning was added
when the macros INFINITY and NAN are used in binary expressions when
-menable-no-nans or -menable-no-infs are used. If the user uses an
option that nullifies these two options, the warning will still be
generated. This patch adds an additional information to the warning
comment to let the user know about this. It also suppresses the warning
when #ifdef INFINITY, #ifdef NAN, #ifdef NAN or #ifndef NAN are used in
the code.
(cherry picked from commit
62c352e13c145b5606ace88ecbe9164ff011b5cf)
Zequan Wu [Mon, 5 Feb 2024 20:27:34 +0000 (15:27 -0500)]
[Profile][Windows] Drop extern for __buildid. (#80700)
(cherry picked from commit
dd22140e21f2ef51cf031354966a3d41c191c6e7)
Aiden Grossman [Mon, 5 Feb 2024 05:33:30 +0000 (21:33 -0800)]
[Github] Fix triggers formatting in code format action
A recent comment modified the job to only run on the main branch, but
the formatting was slightly off, causing the job to not run. This patch
fixes the formatting so the job will run as expected.
(cherry picked from commit
4b34558f43121df9b863ff2492f74fb2e65a5af1)
Tom Stellard [Sun, 4 Feb 2024 05:42:40 +0000 (21:42 -0800)]
[workflows] Only run code formatter on the main branch (#80348)
Modifying a cherry-picked patch to fix code formatting issues can be
risky, so we don't typically do this. Therefore, it's not necessary to
run this job on the release branches.
(cherry picked from commit
2193c95e2459887e7e6e4f9f4aacf9252e99858f)
Yingwei Zheng [Mon, 5 Feb 2024 17:29:38 +0000 (01:29 +0800)]
[InstCombine] Fix assertion failure in issue80597 (#80614)
The assertion in #80597 failed when we were trying to compute known bits
of a value in an unreachable BB.
https://github.com/llvm/llvm-project/blob/
859b09da08c2a47026ba0a7d2f21b7dca705864d/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp#L749-L810
In this case, `SignBits` is 30 (deduced from instr info), but `Known` is
`
10000101010111010011110101000?0?
00000000000000000000000000000000`
(deduced from dom cond). Setting high bits of `lshr Known, 1` will lead
to conflict.
This patch masks out high bits of `Known.Zero` to address this problem.
Fixes #80597.
(cherry picked from commit
cb8d83a77c25e529f58eba17bb1ec76069a04e90)
Jeremy Morse [Wed, 24 Jan 2024 17:45:43 +0000 (17:45 +0000)]
[BPI] Transfer value-handles when assign/move constructing BPI (#77774)
Background: BPI stores a collection of edge branch-probabilities, and
also a set of Callback value-handles for the blocks in the
edge-collection. When a block is deleted, BPI's eraseBlock method is
called to clear the edge-collection of references to that block, to
avoid dangling pointers.
However, when move-constructing or assigning a BPI object, the
edge-collection gets moved, but the value-handles are discarded. This
can lead to to stale entries in the edge-collection when blocks are
deleted without the callback -- not normally a problem, but if a new
block is allocated with the same address as an old block, spurious
branch probabilities will be recorded about it. The fix is to transfer
the handles from the source BPI object.
This was exposed by an unrelated debug-info change, it probably just
shifted around allocation orders to expose this. Detected as
nondeterminism and reduced by Zequan Wu:
https://github.com/llvm/llvm-project/commit/
f1b0a544514f3d343f32a41de9d6fb0b6cbb6021#commitcomment-
136737090
(No test because IMHO testing for a behaviour that varies with memory
allocators is likely futile; I can add the reproducer with a CHECK for
the relevant branch weights if it's desired though)
(cherry picked from commit
604a6c409e8473b212952b8633d92bbdb22a45c9)
Tom Stellard [Fri, 2 Feb 2024 19:35:08 +0000 (11:35 -0800)]
[CMake][PGO] Add option for using an external project to generate profile data (#78879)
The new CLANG_PGO_TRAINING_DATA_SOURCE_DIR allows users to specify a
CMake project to use for generating the profile data. For example, to
use the llvm-test-suite to generate profile data you would do:
$ cmake -G Ninja -B build -S llvm -C <path to
source>/clang/cmake/caches/PGO.cmake \
-DBOOTSTRAP_CLANG_PGO_TRAINING_DATA_SOURCE_DIR=<path to llvm-test-suite>
\
-DBOOTSTRAP_CLANG_PGO_TRAINING_DEPS=runtimes
Note that the CLANG_PERF_TRAINING_DEPS has been renamed to
CLANG_PGO_TRAINING_DEPS.
---------
Co-authored-by: Petr Hosek <phosek@google.com>
(cherry picked from commit
dd0356d741aefa25ece973d6cc4b55dcb73b84b4)
Matt Arsenault [Mon, 5 Feb 2024 13:39:38 +0000 (19:09 +0530)]
AMDGPU: Set max supported div/rem size to 64 (#80669)
This enables IR expansion for i128 divisions. The vector case is still
broken because ExpandLargeDivRem doesn't try to handle them.
Fixes: SWDEV-426193
(cherry picked from commit
a5d206df792b61a0b6c5ac44343a97696fc6071d)
Dimitry Andric [Mon, 5 Feb 2024 16:41:12 +0000 (17:41 +0100)]
[libc++] Rename __bit_reference template parameter to avoid conflict (#80661)
As of
4d20cfcf4eb08217ed37c4d4c38dc395d7a66d26, `__bit_reference`
contains a template `__fill_n` with a bool `_FillValue` parameter.
Unfortunately there is a relatively widely used piece of scientific
software called NetCDF, which exposes a (C) macro `_FillValue` in its
public headers.
When building the NetCDF C++ bindings, this quickly leads to compilation
errors when the macro interferes with the template in `__bit_reference`.
Rename the parameter to `_FillVal` to avoid the conflict.
(cherry picked from commit
1ec252298925de50b27930c557ba9de3cc397afe)
Louis Dionne [Mon, 5 Feb 2024 16:05:46 +0000 (11:05 -0500)]
[libc++] Add missing conditionals for feature-test macros (#80168)
We noticed that some feature-test macros were not conditional on
configuration flags like _LIBCPP_HAS_NO_FILESYSTEM. As a result, code
attempting to use FTMs would not work as intended.
This patch adds conditionals for a few feature-test macros, but more
issues may exist.
rdar://
122020466
(cherry picked from commit
f2c84211d2834c73ff874389c6bb47b1c76d391a)
Pierre van Houtryve [Mon, 5 Feb 2024 13:36:15 +0000 (14:36 +0100)]
[AMDGPU][PromoteAlloca] Support memsets to ptr allocas (#80678)
Fixes #80366
(cherry picked from commit
4e958abf2f44d08129eafd5b6a4ee2bd3584ed22)
Koakuma [Sun, 4 Feb 2024 04:08:00 +0000 (11:08 +0700)]
[clang] Add GCC-compatible code model names for sparc64
This adds GCC-compatible names for code model selection on 64-bit SPARC
with absolute code.
Testing with a 2-stage build then running codegen tests works okay under
all of the supported code models.
(32-bit target does not have selectable code models)
Reviewed By: @brad0, @MaskRay
(cherry picked from commit
b0f0babff22e9c0af74535b05e2c6424392bb24a)
Nikita Popov [Wed, 31 Jan 2024 14:23:53 +0000 (15:23 +0100)]
[AA][JumpThreading] Don't use DomTree for AA in JumpThreading (#79294)
JumpThreading may perform AA queries while the dominator tree is not up
to date, which may result in miscompilations.
Fix this by adding a new AAQI option to disable the use of the dominator
tree in BasicAA.
Fixes https://github.com/llvm/llvm-project/issues/79175.
(cherry picked from commit
4f32f5d5720fbef06672714a62376f236a36aef5)
Nikita Popov [Wed, 24 Jan 2024 14:03:24 +0000 (15:03 +0100)]
[JumpThreading] Add test for #79175 (NFC)
(cherry picked from commit
7143b451d71fe314730f7610d7908e3b9611815c)
Nikita Popov [Wed, 24 Jan 2024 11:33:57 +0000 (12:33 +0100)]
[Loads] Use BatchAAResults for available value APIs (NFCI)
This allows caching AA queries both within and across the calls,
and enables us to use a custom AAQI configuration.
(cherry picked from commit
89dae798cc77789a43e9a60173f647dae03a65fe)
Martin Storsjö [Sat, 3 Feb 2024 13:52:49 +0000 (14:52 +0100)]
[compiler-rt] Remove duplicate MS names for chkstk symbols (#80450)
Prior to
885d7b759b5c166c07c07f4c58c6e0ba110fb0c2, the builtins library
contained two chkstk implementations for each of i386 and x86_64, one
that was used in mingw environments, and one unused (with a symbol name
not matching anything that is used anywhere). Some of the functions
additionally had other, also unused, aliases.
After cleaning this up in
885d7b759b5c166c07c07f4c58c6e0ba110fb0c2, the
unused symbol names were removed.
At the same time, symbol aliases were added for the names as they are
used by MSVC; the functions are functionally equivalent, but have
different names between mingw and MSVC style environments.
By adding a symbol alias (so that one object file contains two different
symbols for the same function), users can run into problems with
duplicate definitions, if they themselves define one of the symbols (for
various reasons), but need to link in the other one.
This happens for Wine, which provides their own definition of
"__chkstk", but when built in mingw mode does need compiler-rt to
provide the mingw specific symbol names; see
https://github.com/mstorsjo/llvm-mingw/issues/397.
To avoid the issue, remove the extra MS style names. They weren't
entirely usable as such for MSVC style environments anyway, as
compiler-rt builtins don't build these object files at all, when built
in MSVC mode; thus, the effort to provide them for MSVC style
environments in
885d7b759b5c166c07c07f4c58c6e0ba110fb0c2 was a
half-hearted step towards that.
If we really do want to provide those functions (as an alternative to
the ones provided by MSVC itself), we should do it in a separate object
file (even if the function implementation is the same), so that users
who have a definition of one of them but need a definition of the other,
won't have conflicts.
Additionally, if we do want to provide them for MSVC, those files
actually should be built when building the builtins in MSVC mode as well
(see compiler-rt/lib/builtins/CMakeLists.txt).
If we do that, there's a risk that an MSVC style build ends up linking
in and preferring our implementation over the one provided by MSVC,
which would be suboptimal. Our implementation always probes the
requested amount of stack, while the MSVC one checks the amount of
allocated stack and only probes as much as really is needed.
In short - this reverts the situation to what it was in the 17.x release
series (except for unused functions that have been removed).
(cherry picked from commit
248aeac1ad2cf4f583490dd1312a5b448d2bb8cc)
NAKAMURA Takumi [Fri, 2 Feb 2024 11:34:12 +0000 (20:34 +0900)]
[Coverage] Let `Decision` take account of expansions (#78969)
The current implementation (
D138849) assumes `Branch`(es) would follow
after the corresponding `Decision`. It is not true if `Branch`(es) are
forwarded to expanded file ID. As a result, consecutive `Decision`(s)
would be confused with insufficient number of `Branch`(es).
`Expansion` will point `Branch`(es) in other file IDs if `Expansion` is
included in the range of `Decision`.
Fixes #77871
---------
Co-authored-by: Alan Phipps <a-phipps@ti.com>
(cherry picked from commit
d912f1f0cb49465b08f82fae89ece222404e5640)
NAKAMURA Takumi [Fri, 2 Feb 2024 09:37:10 +0000 (18:37 +0900)]
CoverageMappingWriter: Emit `Decision` before `Expansion` (#78966)
To relax scanning record, tweak order by `Decision < Expansion`, or
`Expansion` could not be distinguished whether it belonged to `Decision`
or not.
Relevant to #77871
(cherry picked from commit
438fe1db09b0c20708ea1020519d8073c37feae8)
Nikita Popov [Wed, 24 Jan 2024 09:15:42 +0000 (10:15 +0100)]
[MSSAUpdater] Handle simplified accesses when updating phis (#78272)
This is a followup to #76819. After those changes, we can still run into
an assertion failure for a slight variation of the test case: When
fixing up MemoryPhis, we map the incoming access to the access of the
cloned instruction -- which may now no longer exist.
Fix this by reusing the getNewDefiningAccessForClone() helper, which
will look upwards for a new defining access in that case.
(cherry picked from commit
a7a1b8b17e264fb0f2d2b4165cf9a7f5094b08b3)
Sander de Smalen [Fri, 2 Feb 2024 11:56:38 +0000 (11:56 +0000)]
[Clang][AArch64] Emit 'unimplemented' diagnostic for SME (#80295)
When a function F has ZA and ZT0 state, calls another function G that
only shares ZT0 state with its caller, F will have to save ZA before
the call to G, and restore it afterwards (rather than setting up a
lazy-sve).
This is not yet implemented in LLVM and does not result in a
compile-time error either. So instead of silently generating incorrect
code, it's better to emit an error saying this is not yet implemented.
(cherry picked from commit
319f4c03ba2909c7240ac157cc46216bf1518c10)
wanglei [Fri, 26 Jan 2024 02:24:07 +0000 (10:24 +0800)]
[LoongArch] Fixing the incorrect return value of LoongArchTTIImpl::getRegisterBitWidth (#79441)
When we do not enable vector features, we should return the default
value (`TargetTransformInfoImplBase::getRegisterBitWidth`) instead of
zero.
This should fix the LoongArch [buildbot
breakage](https://lab.llvm.org/staging/#/builders/5/builds/486) from
#78943.
(cherry picked from commit
1e9924c1f248bbddcb95d82a59708d617297dad3)
Andrey Ali Khan Bolshakov [Wed, 31 Jan 2024 14:28:37 +0000 (17:28 +0300)]
[clang] Represent array refs as `TemplateArgument::Declaration` (#80050)
This returns (probably temporarily) array-referring NTTP behavior to
which was prior to #78041 because ~~I'm fed up~~ have no time to fix
regressions.
(cherry picked from commit
9bf4e54ef42d907ae7550f36fa518f14fa97af6f)
Fangrui Song [Sat, 3 Feb 2024 18:48:15 +0000 (10:48 -0800)]
ReleaseNotes: add lld/ELF notes (#80393)
Fangrui Song [Fri, 2 Feb 2024 05:20:27 +0000 (21:20 -0800)]
[ELF] Fix compareSections assertion failure when OutputDescs in sectionCommands are non-contiguous
In a `--defsym y0=0 -T a.lds` link where a.lds contains only INSERT
commands, the `script->sectionCommands` layout may be:
```
orphan sections
SymbolAssignment due to --defsym
sections created by INSERT commands
```
The `OutputDesc` objects are not contiguous in sortInputSections, and
`compareSections` will be called with a SymbolAssignment argument,
leading to an assertion failure.
(cherry picked from commit
dee8786f70a3d62b639113343fa36ef55bdbad63)