487685 Commits

Author SHA1 Message Date
Tom Stellard
4cc7a75aa6 [llvm-shlib] Change libLLVM-$MAJOR.so symlink to point to versioned SO (#82660)
This symlink was added in 91a384621e5b762d9c173ffd247cfeadd5f436a2 to
maintain backwards compatibility, but it needs to point to
libLLVM.so.$MAJOR.$MINOR rather than libLLVM.so. This works better for
distros that ship libLLVM.so and libLLVM.so.$MAJOR.$MINOR in separate
packages and also prevents mistakes like
libLLVM-19.so -> libLLVM.so -> libLLVM.so.18.1

Fixes #82647

(cherry picked from commit 10c48a772742b7afe665a815b7eba2047f17dc4b)
2024-02-26 16:57:21 -08:00
Dani
d1a1d7afb1
[llvm][AArch64] Do not inline a function with different signing scheme. (#80642) (#82743)
f the signing scheme is different that maybe the functions assumes
different behaviours and dangerous to inline them without analysing
them. This should be a rare case.
2024-02-26 15:13:43 -08:00
Wentao Zhang
9274829eb6 [clang][CodeGen] Keep processing the rest of AST after encountering unsupported MC/DC expressions (#82464)
Currently, upon seeing unsupported decisions (more than 6 conditions, or
split nesting), the post-visitor hook dataTraverseStmtPost() returns a
false. As a result, in the rest of tree even supported decisions will
be skipped as well. Like in the below code:

{ // CompoundStmt
  a && b;           // 1: BinaryOperator (supported)
  a && foo(b && c); // 2: BinaryOperator (not yet supported due to split
                    //                    nesting)
  a && b;           // 3: BinaryOperator (supported)
}

Decision 3 will not be processed at all. And only one "Decision" region
will be emitted. Compiler explorer example:
https://godbolt.org/z/Px61sesoo

We hope to process such cases and emit two "Decision" regions (1 and 3)
in the above example.

(cherry picked from commit d4bfca3b2e673789f7c278d46a199ae8910ddd37)
2024-02-26 15:09:20 -08:00
Daniel Martinez
c8b11e9300 Fix build on musl by including stdint.h (#81434)
openmp fails to build on musl since it lacks the defines for int32_t

Co-authored-by: Daniel Martinez <danielmartinez@cock.li>
(cherry picked from commit 45fe67dd61a6ac7df84d3a586e41c36a4767757f)
2024-02-26 13:55:13 -08:00
Yingwei Zheng
a5b2e43ff0 [FlattenCFG] Fix the miscompilation where phi nodes exist in the merge point (#81987)
When there are phi nodes in the merge point of the if-region, we cannot
do the merge.
Alive2: https://alive2.llvm.org/ce/z/DbgEan
Fixes #70900.

(cherry picked from commit f920b746ea818f1d21f317116cbb105e3e85979a)
2024-02-26 13:47:48 -08:00
Yingwei Zheng
3aea3d2fd3 [GVN] Drop nsw/nuw flags when replacing the result of a with.overflow intrinsic with a overflowing binary operator (#82935)
Alive2: https://alive2.llvm.org/ce/z/gyL7mn
Fixes https://github.com/llvm/llvm-project/issues/82884.

(cherry picked from commit 892b4beeac50920e630f10905b2916295e2eb6d8)
2024-02-26 13:43:35 -08:00
Jonas Paulsson
9d51bd1c24 [SystemZ] Use VT (not ArgVT) for SlotVT in LowerCall(). (#82475)
When an integer argument is promoted and *not* split (like i72 -> i128 on
a new machine with vector support), the SlotVT should be i128, which is
stored in VT - not ArgVT.

Fixes #81417

(cherry picked from commit 9c0e45d7f0e2202e16dbd9a7b9f462e2bcb741ae)
2024-02-26 13:36:40 -08:00
Jonas Paulsson
5393a050f0 [SystemZ] Require D12 for i128 accesses in isLegalAddressingMode() (#79221)
Machines with vector support handle i128 in vector registers and
therefore only have the small displacement available for memory
accesses. Update isLegalAddressingMode() to reflect this.

(cherry picked from commit 84dcf3d35b6ea8d8b6c34bc9cf21135863c47b8c)
2024-02-26 15:49:43 +00:00
h-vetinari
cd2ca7f3f9
fix links on clang 18.1.0rc release page (#82739)
Looking at the [release
notes](https://prereleases.llvm.org/18.1.0/rc3/tools/clang/docs/ReleaseNotes.html)
for clang 18.1.0rc, there's some broken links, and many issue numbers
mis-formatted with an extra colon. Aside from being used inconsistently
(with/without colon), I think it should be uncontroversial that `See
(#62707).` is better than `See (#62707:).`

CC @tstellar @AaronBallman

Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
2024-02-26 15:06:56 +01:00
Wentao Zhang
95b6a7f2b3
Backport 0bf4f82 to release/18.x (#82571)
Manually cherry-pick 0bf4f82f661817c79bd538c82c99515837cf1cf8 (#80952)
and resolve conflicts

Closes #82570
2024-02-23 16:07:23 -08:00
Tacet
c65d48da92
[libc++] Add details about string annotations (#82730)
This commit adds information that only long strings are annotated, and
with all allocators by default.

To read why short string annotations are not turned on yet, read
comments in a related PR:
https://github.com/llvm/llvm-project/pull/79536

Upstreamed in: 7661ade5d1ac4fc8e1e2339b2476cb8e45c24641
Upstream PR: #80912

---------

Co-authored-by: Mark de Wever <zar-rpg@xs4all.nl>

Co-authored-by: Mark de Wever <zar-rpg@xs4all.nl>
2024-02-23 13:06:47 -08:00
Fangrui Song
4ba68ab9b4 [llvm-readobj,ELF] Support --decompress/-z (#82594)
When a section has the SHF_COMPRESSED flag, -p/-x dump the compressed
content by default. In GNU readelf, if --decompress/-z is specified,
-p/-x will dump the decompressed content. This patch implements the
option.

Close #82507

(cherry picked from commit 26d71d9ed56c4c23e6284dac7a9bdf603a5801f3)
2024-02-23 12:51:05 -08:00
Ulrich Weigand
7103145024 [docs][llvm-objcopy] Add missing formats (#81981)
Bring list of supported formats in docs back in sync with the code.

(cherry picked from commit bf471c915d14035a24ec027fb2bb0373cefdabe1)
2024-02-23 12:48:38 -08:00
Louis Dionne
9c434b4733 [libc++] Only include <setjmp.h> from the C library if it exists (#81887)
In 2cea1babefbb, we removed the <setjmp.h> header provided by libc++. However, we did not conditionally include the underlying <setjmp.h>
header only if the C library provides one, which we otherwise do consistently (see e.g. 647ddc08f43c).

rdar://122978778
(cherry picked from commit d8278b682386f51dfba204849c624672a3df40c7)
2024-02-23 12:46:52 -08:00
Luke Lau
4195885b95 [Loads] Fix crash in isSafeToLoadUnconditionally with scalable accessed type (#82650)
This fixes #82606 by updating isSafeToLoadUnconditionally to handle
fixed sized loads from a scalable accessed type.

(cherry picked from commit b0edc1c45284586fdb12edd666f95d99f5f62b43)
2024-02-23 12:44:49 -08:00
Fangrui Song
1ea6a98142
ReleaseNotes: mention -mtls-dialect=desc (#82731) 2024-02-23 12:43:55 -08:00
Thomas Preud'homme
b9029ed005 Extend GCC workaround to GCC < 8.4 for llvm::iterator_range ctor (#82643)
GCC SFINAE error with decltype was fixed in commit
ac5e28911abdfb8d9bf6bea980223e199bbcf28d which made it into GCC 8.4.
Therefore adjust GCC version test accordingly.

(cherry picked from commit 7f71fa909a10be182b82b9dfaf0fade6eb84796c)
2024-02-22 21:08:58 +00:00
Tom Stellard
6c90f8dd54 Fix llvm-x86_64-debian-dylib buildbot
This was broken by 91a384621e5b762d9c173ffd247cfeadd5f436a2.

(cherry picked from commit ff4d6c64ee4269e4a9b67a4dae7e0b82ae1c3419)
llvmorg-18.1.0-rc3
2024-02-20 21:14:50 -08:00
Tom Stellard
235306ba1f [cmake] Add minor version to library SONAME (#79376)
We need to do this now that we are bumping the minor release number when
we create the release branch.

This also results in a slight change to the library names for LLVM. The
main library now has a more convential library name:
'libLLVM.so.$major.$minor'. The old library name: libLLVM-$major.so is
now a symlink that points to the new library. However, the symlink is
not present in the build directory. It is only present in the install
directory.

The library name was changed because it helped to keep the CMake changes
more simple.

Fixes #76273

(cherry picked from commit 91a384621e5b762d9c173ffd247cfeadd5f436a2)
2024-02-20 21:14:50 -08:00
Tom Stellard
d84c1e9474 [workflows] Fix permissions check for creating new releases (#81163)
The default GitHub token does not have read permissions on the org, so
we need to use a custom token in order to read the members of the
llvm-release-managers team.

(cherry picked from commit 2836d8edbfbcd461b25101ed58f93c862d65903a)
2024-02-20 21:10:59 -08:00
Rainer Orth
bba39443eb [Release] Don't build during test-release.sh Phase 3 install (#82001)
As described in [test-release.sh ninja install does builds in Phase
3](https://github.com/llvm/llvm-project/issues/80999), considerable
parts of Phase 3 of a `test-release.sh` build are run by `ninja
install`, ignoring both `$Verbose` and the parallelism set via `-j NUM`.

This patches fixes this by not specifying any explicit build target for
Phase 3, thus running the full build as usual.

Tested on `sparc64-unknown-linux-gnu`.

(cherry picked from commit f6ac598c104ed3c9f4bcbbe830f86500c8d1013e)
2024-02-20 17:57:11 -08:00
Nikita Popov
94dcc1d6ae [IndVarSimplify] Fix poison-safety when reusing instructions (#80458)
IndVars may replace an instruction with one of its operands, if they
have the same SCEV expression. However, such a replacement may be more
poisonous.

First, check whether the operand being poison implies that the
instruction is also poison, in which case the replacement is always
safe. If this fails, check whether SCEV can determine that reusing the
instruction is safe, using the same check as SCEVExpander.

Fixes https://github.com/llvm/llvm-project/issues/79861.

(cherry picked from commit 7d2b6f0b355bc98bbe3aa5bae83316a708da33ee)
2024-02-20 16:44:46 -08:00
Nikita Popov
dc0ed54ac5 [SCEV] Move canReuseInstruction() helper into SCEV (NFC)
To allow reusing it in IndVars.

(cherry picked from commit 43dd1e84df1ecdad872e1004af47b489e08fc228)
2024-02-20 16:44:46 -08:00
Nikita Popov
4223b2264c [SCEVExpander] Do not reuse disjoint or (#80281)
SCEV treats "or disjoint" the same as "add nsw nuw". However, when
expanding, we cannot generally replace an add SCEV node with an "or
disjoint" instruction. Just dropping the poison flag is insufficient in
this case, we would have to actually convert the or into an add.

This is a partial fix for #79861.

(cherry picked from commit 5b8e1a6ebf11b6e93bcc96a0d009febe4bb3d7bc)
2024-02-20 16:44:46 -08:00
Nikita Popov
688566b2df [IndVars] Add tests for #79861 (NFC)
(cherry picked from commit c105848fd29d3b46eeb794bb6b10dad04f903b09)
2024-02-20 16:44:46 -08:00
Chuanqi Xu
66351a501e [Serialization] Record whether the ODR is skipped (#82302)
Close https://github.com/llvm/llvm-project/issues/80570.

In

a0b6747804,
we skipped ODR checks for decls in GMF. Then it should be natural to
skip storing the ODR values in BMI.

Generally it should be fine as long as the writer and the reader keep
consistent.

However, the use of preamble in clangd shows the tricky part.

For,

```
// test.cpp
module;

// any one off these is enough to crash clangd
// #include <iostream>
// #include <string_view>
// #include <cmath>
// #include <system_error>
// #include <new>
// #include <bit>
// probably many more

// only ok with libc++, not the system provided libstdc++ 13.2.1

// these are ok

export module test;
```

clangd will store the headers as preamble to speedup the parsing and the
preamble reuses the serialization techniques. (Generally we'd call the
preamble as PCH. However it is not true strictly. I've tested the PCH
wouldn't be problematic.) However, the tricky part is that the preamble
is not modules. It literally serialiaze and deserialize things. So
before clangd parsing the above test module, clangd will serialize the
headers into the preamble. Note that there is no concept like GMF now.
So the ODR bits are stored. However, when clangd parse the file
actually, the decls from preamble are thought as in GMF literally, then
hte ODR bits are skipped. Then mismatch happens.

To solve the problem, this patch adds another bit for decls to record
whether or not the ODR bits are skipped.

(cherry picked from commit 49775b1dc0cdb3a9d18811f67f268e3b3a381669)
2024-02-20 16:41:33 -08:00
Ulrich Weigand
5ef297ab61 [llvm-objcopy] Add SystemZ support (#81841)
This is also necessary for enabling ClangBuiltLinux:
https://github.com/ClangBuiltLinux/linux/issues/1530

(cherry picked from commit 3c02cb7492fc78fb678264cebf57ff88e478e14f)
2024-02-20 16:36:39 -08:00
David CARLIER
390dcd4cbb [compiler-rt][profile] Fix InstrProfilingFile possible resource leak. (#81363)
close #79708

(cherry picked from commit 0a255fcf4a90f9e864ae9321b28e4956f7c865fb)
2024-02-20 12:59:02 -08:00
Qiu Chaofan
3b4b047642 [PowerPC] Mask constant operands in ValueBit tracking (#67653)
In IR or C code, shift amount larger than value size is undefined
behavior. But in practice, backend lowering for shift_parts produces
add/sub of shift amounts, thus constant shift amounts might be
negative or larger than value size, which depends on ISA definition.

PowerPC ISA says, the lowest 7 bits (6 bits for 32-bit instruction)
will be taken, and if the highest among them is 1, result will be
zero, otherwise the low 6 bits (or 5 on 32-bit) are used as shift
amount.

This commit emulates the behavior and avoids array overflow in bit
permutation's value bits calculator.

(cherry picked from commit 292d9e869fcfc2ece694848db4022b0b939847e3)
2024-02-20 12:54:33 -08:00
Frederic Cambus
12114d2d5a [llvm-objdump] Add support for the PT_OPENBSD_SYSCALLS segment type. (#82121)
Reference: https://github.com/openbsd/src/blob/master/sys/sys/exec_elf.h
(cherry picked from commit 1b894864862d8049e4a2567a472efdc2eda1e035)
2024-02-20 11:59:21 -08:00
Frederic Cambus
3af6881cab [llvm-readobj] Add support for the PT_OPENBSD_SYSCALLS segment type. (#82122)
Reference: https://github.com/openbsd/src/blob/master/sys/sys/exec_elf.h
(cherry picked from commit a8d7511811c7d7c689c3e8f858e8e00a56aba152)
2024-02-20 11:57:09 -08:00
Xing Xue
801a10d305 [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)
2024-02-20 11:54:09 -08:00
Nikita Popov
ebc589e44f [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)
2024-02-20 12:02:48 +00:00
Nikita Popov
c74afe6f52 [InstCombine] Add unsigned variants of gep exact div tests (NFC)
(cherry picked from commit ec2c770b9f9a0e9eca4a893383d2b27dd4c0bfe7)
2024-02-20 12:02:48 +00:00
Luke Lau
c7b0a6ecd4 [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)
2024-02-19 16:43:22 -08:00
Yingwei Zheng
b845f0662a [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)
2024-02-19 16:36:53 -08:00
Frederic Cambus
c5e1885af0 [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)
2024-02-19 16:18:19 -08:00
Xing Xue
ae27600016 [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)
2024-02-19 16:14:44 -08:00
Wael Yehia
b27f0b4fae [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)
2024-02-18 04:13:07 +00:00
Tom Stellard
82e17c1536
Use container on Linux to run llvm-project-tests workflow (#81349) (#81807)
(cherry picked from commit fe20a759fcd20e1755ea1b34c5e6447a787925dc)
2024-02-17 16:19:39 -08:00
David Green
8a3d8f0c25 [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)
2024-02-17 09:03:56 +00:00
Ulrich Weigand
347977c8b1 [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)
2024-02-16 12:24:37 -08:00
Tom Stellard
d71aae5f79 [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)
2024-02-16 12:21:13 -08:00
Mark de Wever
0756378b77 [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)
2024-02-16 11:01:06 -08:00
Alexey Bataev
b7a4ff80a4 [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)
2024-02-16 05:51:10 -08:00
Alexey Bataev
5226ae4617 [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)
2024-02-16 05:51:10 -08:00
Nikita Popov
1a69056c89
Backport [DAGCombine] Fix multi-use miscompile in load combine (#81586) (#81633)
(cherry picked from commit 25b9ed6e4964344e3710359bec4c831e5a8448b9)
2024-02-16 05:50:14 -08:00
Martin Storsjö
d01a4ab210
[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).
2024-02-16 05:48:29 -08:00
Jinyang He
60a8ec3a35 [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)
2024-02-16 05:39:14 -08:00
Zixu Wang
ddc2a5ff4e
[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)
2024-02-16 05:36:18 -08:00