525794 Commits

Author SHA1 Message Date
David Green
3351e1b142 [AArch64] Enable AvoidLDAPUR for cpu=generic between armv8.4 and armv9.3. (#125261)
As added in #124274, CPUs in this range can suffer from performance
issues with ldapur. As the gain from ldar->ldapr is expected to be
greater than the minor gain from ldapr->ldapur, this opts to avoid the
instruction under the default -mcpu=generic when the -march is less that
armv8.8 / armv9.3.

I renamed AArch64Subtarget::Others to AArch64Subtarget::Generic to be
clearer what it means.

(cherry picked from commit 6424abcd6c9c6aa8171c79d0fe0369d3a10da3d5)
2025-02-07 16:27:47 -08:00
CarolineConcatto
de5dcad3a2 [AArch64] Update feature dep. for Armv9.6 extensions (#125874)
These features FEAT_FAMINMAX, FEAT_LUT and FEAT_FP8 depends on
FEAT_NEON.

Update dependency from FEAT_FP8DOT4 and FEAT_FP8DOT2. Now depends
indirectly on FEAT_NEON through FEAT_FP8
2025-02-07 16:16:11 -08:00
Peter Smith
4d3d4445c6 [LLD][ELF][AArch64] Discard .ARM.attributes sections (#125838)
LLVM has started to emit AArch64 build attributes sections called
.ARM.attributes. LLD does not yet have support for these so they are
accumulating in the ELF output. As the first part of that support
discard all the .ARM.attributes sections. This can be built upon by the
full implementation in LLD.

The build attributes specification only defines build attributes for
relocatable objects. The intention for LLD is that files of type ET_EXEC
and ET_SHARED will not have a build attributes in the output. A
relocatable link with -r will need a merged build attributes, but until
the merge is implemented it is better to discard.

(cherry picked from commit ba476d0b83dc8a4bbf066dc02a0f73ded27114f0)
2025-02-07 16:13:24 -08:00
Joseph Huber
dbb2699d2e [Offload] Stop the RPC server faiilng with more than one GPU (#125982)
Summary:
Pretty dumb mistake of me, forgot that this is run per-device and
per-plugin, which fell through the cracks with my testing because I have
two GPUs that use different plugins.

(cherry picked from commit 7a8779422dad058f11cd473d409f42e32859788d)
2025-02-07 16:11:21 -08:00
kadir çetinkaya
e40790864b [clang] Parse warning-suppression-mapping after setting up diagengine (#125714)
We can emit diagnostics while parsing warning-suppression-mapping, make
sure command line flags take affect when emitting those.

(cherry picked from commit ecb016a87d89aed36b8f5d8102e15d8eb0e57108)
2025-02-07 15:59:30 -08:00
Phoebe Wang
454d7c10f1 [X86] Do not combine LRINT and TRUNC (#125848)
Per to discussions in #125324, most participants are opposed to this
optimization. So remove the combination to address the concerns.

Fixes #125324

(cherry picked from commit 8c222c122f1a8edb1be96e482511ad547f7db7b3)
2025-02-07 15:14:36 -08:00
Tom Stellard
3c011c65f6 workflows/premerge: Move concurrency definition to workflow level (#126308)
Prior workflow runs were not being cancelled when the pull request was
closed, and I think this was why. Also, there is no advantage to having
the definitions at the job level.

(cherry picked from commit 6e5988863177e1d53e7a7abb7a3db2b85376f0f5)
2025-02-07 14:52:06 -08:00
Nikita Popov
e2426cd9e9 [libclc] Allow default path when looking for llvm-spirv (#126071)
This is an external tool, so I don't think there is an expectation that
it has to be in the LLVM tools bindir. It may also be in the default
system bindir (which is not necessarily the same).

(cherry picked from commit 26ecddb05d13c101ccd840a6710eb5f8b82de841)
2025-02-07 14:50:35 -08:00
David Sherwood
b5f41cc50c [LoopVectorize] Fix build error (#126218)
Fixes issue caused by 1930524bbde3cd26ff527bbdb5e1f937f484edd6

Unused variable UsesMask in LoopVectorize.cpp

(cherry picked from commit 3872e55758a5de035c032a975f244302c3ddacc3)
2025-02-07 13:28:37 -08:00
David Sherwood
3542150f05 [LoopVectorize] Fix cost model assert when vectorising calls (#125716)
The legacy and vplan cost models did not agree because
VPWidenCallRecipe::computeCost only calculates the cost of the
call instruction, whereas
LoopVectorizationCostModel::setVectorizedCallDecision in some
cases adds on the cost of a synthesised mask argument. However,
this mask is always 'splat(i1 true)' which should be hoisted out
of the loop during codegen. In order to synchronise the two cost
models I have two options:

1) Also add the cost of the splat to the vplan model, or
2) Remove the cost of the splat from the legacy model.

I chose 2) because I feel this more closely represents what the
final code will look like. There is an argument that we should
take account of such broadcast costs in the preheader when
deciding if it's profitable to vectorise a loop, however there
isn't currently a mechanism to do this. We currently only take
account of the runtime checks when assessing profitability and
what the minimum trip count should be. However, I don't believe
this work needs doing as part of this PR.

(cherry picked from commit 1930524bbde3cd26ff527bbdb5e1f937f484edd6)
2025-02-07 13:28:37 -08:00
Brad Smith
7bcfaa1c4d [flang][Driver] When linking with the Fortran runtime also link with libexecinfo (#125998)
Also link with libexecinfo on FreeBSD, NetBSD, OpenBSD and DragonFly
for the backtrace functions.

(cherry picked from commit d1de75acea0da55316cd7827563e064105868f0f)
2025-02-07 13:08:01 -08:00
kadir çetinkaya
4cde428de0 [clang] Stop parsing warning suppression mappings in driver (#125722)
This gets rid of some extra IO from driver startup, and possiblity of
emitting warnings twice.

(cherry picked from commit df22bbe2beb57687c76402bc0cfdf7901a31cf29)
2025-02-07 12:49:40 -08:00
Nikita Popov
4d04a406a5 [TableGen] Don't use inline storage for ReferenceLocs (NFC) (#125231)
The ReferenceLocs are not enabled by default (they are used by the
tablegen lsp server), and as such always empty, but still allocate
inline storage for the SmallVector. Disabling it saves about 200MB on
RISCVGenGlobalISel.inc.

(The equivalent field in Record already disables inline storage.)

(cherry picked from commit c640f97ccf723e64ff24af225cb995c905538406)
2025-02-07 12:03:05 -08:00
Nikita Popov
14c5784ee4 [TableGen] Reduce size of MatchTableRecord (NFC) (#125221)
MatchTableRecord stores a 64-bit RawValue. However, this field is only
needed by a small part of the code (jump table generation).

Create a separate RecordAndValue structure that is used in just the
necessary places.

Based on massif, this reduces memory usage on RISCVGenGlobalISel.inc by
about 100MB (to 2.15GB).

(cherry picked from commit e2301d674976b84ba505065a9702f3376e05bc43)
2025-02-07 12:03:05 -08:00
s.vgys
3a3a3230d1 fix: removes invalid token from LLVM_VERSION_SUFFIX in LIBC namespace (#126193)
Resolves #125831

(cherry picked from commit 51759ffc4408e9eb5c2d40c9489ce3b98de233d5)
2025-02-07 18:27:18 +00:00
Mark de Wever
71ee354bab [libc++][TZDB] Fixes %z escaping. (#125399)
The previous tested TZDB did not contain %z for the rule letters. The
usage of %z in TZDB 2024b revealed a bug in the implementation. The
patch fixes it and has been locally tested with TZDB 2024b.

Fixes #108957

(cherry picked from commit a27f3b2bb137001735949549354aff89dbf227f4)
2025-02-06 22:53:04 -08:00
Pavel Labath
04209c2a2b
Add info about the gdb x packet into the release notes (#125680)
See also #125653.
2025-02-06 22:52:23 -08:00
Pavel Labath
4d16551293 [lldb] Add support for gdb-style 'x' packet (#124733)
See also
https://discourse.llvm.org/t/rfc-fixing-incompatibilties-of-the-x-packet-w-r-t-gdb/84288
and https://sourceware.org/pipermail/gdb/2025-January/051705.html

(cherry picked from commit 13d0318a9848ec322ceea4f37fb6b421d70407b0)
2025-02-06 17:11:02 -08:00
Jonas Devlieghere
7fa1a3a398 [CMake] Fix typo in docstring: telemtry -> telemetry (NFC)
Thanks Nikita for spotting it.

(cherry picked from commit 13ded6829bf7ca793795c50d47dd2b95482e5cfa)
2025-02-06 17:05:33 -08:00
Jonas Devlieghere
0892dddc23 [llvm] Add CMake flag to compile out the telemetry framework (#124850)
Add a CMake flag (LLVM_BUILD_TELEMETRY) to disable building the
telemetry framework. The flag being enabled does *not* mean that
telemetry is being collected, it merely means we're building the generic
telemetry framework. Hence the flag is enabled by default.

Motivated by this Discourse thread:
https://discourse.llvm.org/t/how-to-disable-building-llvm-clang-telemetry/84305

(cherry picked from commit bac62ee5b473e70981a6bd9759ec316315fca07d)
2025-02-06 17:05:33 -08:00
Yingwei Zheng
857d8d767a [InstCombine] Fix FMF propagation in foldSelectWithFCmpToFabs (#121580)
Consider the following pattern:
```
%cmp = fcmp <pred> double %x, 0.000000e+00
%negX = fneg <fmf> double %x
%sel = select i1 %cmp, double %x, double %negX
```
We cannot propagate ninf from fneg to select since `%negX` may not be
chosen. Similarly, we cannot propagate nnan unless `%negX` is guaranteed
to be selected when `%x` is NaN.
This patch also propagates nnan/ninf from fcmp to avoid regression in
`PhaseOrdering/generate-fabs.ll`.

Alive2: https://alive2.llvm.org/ce/z/t6U-tA
Closes https://github.com/llvm/llvm-project/issues/121430 and
https://github.com/llvm/llvm-project/issues/113989.

(cherry picked from commit 3ec6a6b85aed838b7d56bd6843cad52e822b9111)
2025-02-06 16:59:38 -08:00
Phoebe Wang
99f3ed7375
[X86][AVX10] Disable m[no-]avx10.1 and switch m[no-]avx10.2 to alias of 512 bit options (#124511) (#125057)
Per the feedback we got, we’d like to switch m[no-]avx10.2 to alias of
512 bit options and disable m[no-]avx10.1 due to they were alias of 256
bit options.

We also change -mno-avx10.[1,2]-512 to alias of 256 bit options to
disable both 256 and 512 instructions.

Cherry-pick from
9ebfee9d68
2025-02-06 16:56:13 -08:00
Craig Topper
c08c9f97f9 [RISCV] Use getSignedConstant for negative values. (#125903)
The APInt constructor asserts if bits are set past the size of the APInt
unless it is signed. This currently fails on RV32 because more than XLen
bits are set.

(cherry picked from commit 0d7ee520d3a9b8997adf8eaaa22b33db9659d94e)
2025-02-05 20:59:24 -08:00
Tom Stellard
49a8fb2bef
workflows/premerge: Re-enable tests (#125978)
These were accidentally disabled in
0cca13f758a8bda75eab45ad4bf896bb83921ec9.
2025-02-05 19:42:06 -08:00
Alexandros Lamprineas
78729e5ae2
[FMV][AArch64] Release notes for LLVM20. (#125525) 2025-02-05 17:27:35 -08:00
Benjamin Maxwell
d8cec6dfe6 [clang] Support member function poiners in Decl::getFunctionType() (#125077)
This seems consistent with the documentation, which claims it:

```
/// Looks through the Decl's underlying type to extract a FunctionType
/// when possible. Will return null if the type underlying the Decl does not
/// have a FunctionType.
const FunctionType *getFunctionType(bool BlocksToo = true) const;
```
Note: This patch rewords this doc comment to clarify it includes various
function pointer types.

Without this, attaching attributes (which use `HasFunctionProto`) to
member function pointers errors with:

```
error: '<attr>' only applies to non-K&R-style functions
```

...which does not really make sense, since member functions are not K&C
functions.

With this change the Arm SME TypeAttrs work correctly on member function
pointers.

Note, however, that not all attributes work correctly when applied to
function pointers or member function pointers. For example,
`alloc_align` crashes when applied to a function pointer (on truck):
https://godbolt.org/z/YvMhnhKfx (as it only expects a `FunctionDecl` not
a `ParmVarDecl`). The same crash applies to member function pointers
(for the same reason).

(cherry picked from commit 692c9b210728323ac499a402ee6eb901f35856f2)
2025-02-05 23:13:28 +00:00
Brad Smith
8fe8a86920 [flang][runtime] Make sure to link libexecinfo if it exists (#125344)
Fixes building the backtrace support on FreeBSD/NetBSD/OpenBSD/DragonFly and musl
libc with libexecinfo.

(cherry picked from commit cb2598dda1aae5096a77bc8a9f6679ca1b350e5e)
2025-02-05 13:44:03 -08:00
Tom Stellard
412360878d workflows/release-binaries: Enable PGO (#124442)
Co-authored-by: Carlo Cabrera <github@carlo.cab>
(cherry picked from commit 0572580dd040a81dc69b798e202550d51d17204a)
2025-02-05 13:40:32 -08:00
Florian Hahn
de1e3e9874 [VPlan] Only use SCEV for live-ins in tryToWiden. (#125436)
Replacing a recipe with a live-in may not be correct in all cases,
e.g. when replacing recipes involving header-phi recipes, like
reductions.

For now, only use SCEV to simplify live-ins.

More powerful input simplification can be built in top of
https://github.com/llvm/llvm-project/pull/124432 in the future.

Fixes https://github.com/llvm/llvm-project/issues/119173.
Fixes https://github.com/llvm/llvm-project/issues/125374.

PR: https://github.com/llvm/llvm-project/pull/125436
(cherry picked from commit 30f3752e54fa7cd595a434a985efbe9a7abe9b65)
2025-02-05 13:37:30 -08:00
Ben Langmuir
2b09e5936a [asan][test] Disable suppressions-alloc-dealloc-mismatch.cpp on Darwin
The suppressions mechanism doesn't work reliably in optimized builds,
which turns out to be a known issue (see b87543c704724 / svn r308908).
Disable this test, as it is also testing a feature (alloc/dealloc
mismatch) that is disabled by default on Darwin anyway.

rdar://143830493
(cherry picked from commit 4985804c0608a83f6ab017137c3d3d4f02827774)
2025-02-05 13:35:58 -08:00
Vitaly Buka
2d1f7e0082 [asan][android] XFAIL suppressions-alloc-dealloc-mismatch
Android is missing suppression file on device.

Follow up to #124197.

(cherry picked from commit 751ae26b959c931efb6db84a27bf2a0444120094)
2025-02-05 13:35:58 -08:00
Ben Langmuir
5a406bde97 [asan][test] Attempt to fix suppressions-alloc-dealloc-mismatch.cpp on Darwin (#124987)
Add %env_asan_opts=alloc_dealloc_mismatch=1 since it is disabled by
default.

rdar://143830493
(cherry picked from commit f0d05b099dafda89df4c971b64b2051c33db5da1)
2025-02-05 13:35:58 -08:00
Michał Górny
28e563c238 [offload] [test] Use test compiler ID rather than host (#124408)
Use the test compiler ID to verify whether tests can be run rather than
the host compiler. This makes it possible to run tests (with Clang)
while the library itself was built with GCC.

(cherry picked from commit 689ef5fda0ab07dfc452cb16d3646d53e612cb75)
2025-02-05 13:32:40 -08:00
Michał Górny
091c11f29e [offload] gnu::format with variadic template functions is Clang-only (#124406)
Use `gnu::format` attribute only when compiling with Clang, as using it
against variadic template functions is a Clang extension and is not
supported by GCC.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77958

Fixes #119069

(cherry picked from commit 359a9131704277bce0f806de31ac887e68a66902)
2025-02-05 13:32:40 -08:00
Sam Tebbs
8be3fc0f5c [AArch64] Disallow vscale x 1 partial reductions (#125252)
We don't want to allow partial reductions resulting in a vscale x 1 type
as we can't lower it in the backend.

(cherry picked from commit c7995a6905f2320f280013454676f992a8c6f89f)
2025-02-05 14:37:39 +00:00
David Green
d185bd94ff [AArch64] Enable vscale_range with +sme (#124466)
If we have +sme but not +sve, we would not set vscale_range on
functions. It should be valid to apply it with the same range with just
+sme, which can help mitigate some performance regressions in cases such
as scalable vector bitcasts (https://godbolt.org/z/exhe4jd8d).

(cherry picked from commit 9f1c825fb62319b94ac9604f733afd59e9eb461b)
2025-02-03 17:32:53 -08:00
Tom Stellard
dc50bb0b14 workflows/release-tasks: Re-use release-binaries-all workflow (#125378)
This way we don't need to duplicate the list of supported targets in the
release-tasks workflow.

(cherry picked from commit d194c6b9a7fdda7a61abcd6bfe39ab465bf0cc87)
2025-02-03 17:16:36 -08:00
Tom Stellard
0cca13f758
workflows/premerge: Cancel in progress jobs when a PR is merged (#125329) (#125588)
(cherry picked from commit 2deba08e09b9412c9f4e5888237e28173dee085b)
2025-02-03 16:28:24 -08:00
Tom Stellard
af7f483a9d
Set version to 20.1.0-rc1 (#125367) llvmorg-20.1.0-rc1 2025-02-01 18:04:34 -08:00
Hubert Tong
1eb7f4e6b4
release/20.x: [Clang][ReleaseNotes] Document -fclang-abi-compat=19 re: #110503 (#125368)
#110503 updates the scope of `-fclang-abi-compat` but did not make that
clear in the release notes. This PR addresses that problem.
2025-02-01 17:04:18 -08:00
Martin Storsjö
d777df5cbd [libcxx] Use _ftelli64/_fseeki64 on Windows (#123128)
This allows using the full 64 bit range for file offsets.

This should fix the issue reported downstream at
https://github.com/mstorsjo/llvm-mingw/issues/462.

(cherry picked from commit 86e20b00c313e96db3b69d440bfb2ca9063f08f0)
2025-02-01 13:32:39 -08:00
Benjamin Maxwell
2c142b23ae [clang][SME] Account for C++ lambdas in SME builtin diagnostics (#124750)
A C++ lambda does not inherit attributes from the parent function. So
the SME builtin diagnostics should look at the lambda's attributes, not
the parent function's.

The fix is very simple and just adds the missing "AllowLambda" flag to
the function decl lookups.

(cherry picked from commit 2b7509e9885c9a5656bb3c201421e146a21fb88e)
2025-01-31 20:57:27 -08:00
Aaron Ballman
fe005eb069
Allow 'inline' on some declarations in MS compatibility mode (#125250) (#125275)
Microsoft allows the 'inline' specifier on a typedef of a function type
in C modes. This is used by a system header (ufxclient.h), so instead of
giving a hard error, we diagnose with a warning. C++ mode and non-
Microsoft compatibility modes are not impacted.

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

(cherry picked from commit ef91caec2cf313624829114802cff92ae682e550)
2025-01-31 18:00:52 -08:00
Oliver Stannard
184d1783db [AArch64] PAUTH_PROLOGUE should not be duplicated with PAuthLR (#124775)
When using PAuthLR, the PAUTH_PROLOGUE expands into a sequence of
instructions which takes the address of one of those instructions, and
uses that address to compute the return address signature. If this is
duplicated, there will be two different addresses used in calculating
the signature, so the epilogue will only be correct for (at most) one of
them.

This change also restricts code generation when using v8.3-A return
address signing, without PAuthLR. This isn't strictly needed, as
duplicating the prologue there would be valid. We could fix this by
having two copies of PAUTH_PROLOGUE, with and without isNotDuplicable,
but I don't think it's worth adding the extra complexity to a security
feature for that.

(cherry picked from commit 36b3c43524c8ca86a5050496b8773f07c5ccddff)
2025-01-31 17:55:58 -08:00
higher-performance
a00b0f9923 Fix false negative when value initializing a field annotated with [[clang::require_field_initialization]] (#124329)
It turns out we weren't handling one case: the value-initialization of a
field inside a struct.

I'm not sure why this falls under `IK_Direct` rather than `IK_Value` in
Clang, but it seems to work.

(cherry picked from commit 20fd7df0b847bb46aac2f0b5b71d242220027cbc)
2025-01-31 17:51:10 -08:00
Yingwei Zheng
40ca089d99 [CodeGenPrepare] Replace deleted ext instr with the promoted value. (#71058)
This PR replaces the deleted ext with the promoted value in `AddrMode`.
Fixes #70938.

(cherry picked from commit 3c6aa04cf4dee65113e2a780b9f90b36bb4c4e04)
2025-01-31 17:49:18 -08:00
Momchil Velikov
97becb3205 [AArch64] Add MSVC mangling for the __mfp8 type (#124968)
Fixes #124907

(cherry picked from commit 7939ce6295e7fc0214cd307f97dfccc0cabde381)
2025-01-31 17:43:51 -08:00
Balazs Benics
1c660caad1
[analyzer][docs] CSA release notes for clang-20 (#124798)
The commits were gathered using:
```sh
git log --reverse --oneline llvmorg-20-init..llvm/main \
  clang/{lib/StaticAnalyzer,include/clang/StaticAnalyzer} | grep -v NFC | grep -v OpenACC | grep -v -i revert
```

After this I categorized the changes and dropped the less user-facing
commits.

FYI, I also ignored Webkit changes because I assue it's fairly specific
for them, and they likely already know what they ship xD.

I used the `LLVM_ENABLE_SPHINX=ON` and `LLVM_ENABLE_DOXYGEN=ON` cmake
options to enable the `docs-clang-html` build target, which generates
the html into `build/tools/clang/docs/html/ReleaseNotes.html` of which I
attach the screenshots to let you judge if it looks all good or not.

I also used Grammarly this time to check for blatant typos.

---------

Co-authored-by: Donát Nagy <donat.nagy@ericsson.com>
2025-01-31 17:35:07 -08:00
Brad Smith
c560d6f2c7 [flang] Fix building on aarch64 *BSD and musl libc after 9d8dc45d17088300e9e2086594ca581b119193c8 (#125183)
The fpu_control.h header appears to be GLIBC specific.

(cherry picked from commit e31c6c97b795e57a7b1ee31ad37eced40c6305ed)
2025-01-31 17:30:29 -08:00
vdonaldson
d5333f265b [flang] Build fix (#125087)
Reinstate a preprocessor define for a nonstandard exception.

[124978](https://github.com/llvm/llvm-project/issues/124978#event-16113621403)

(cherry picked from commit 7fa1257c35581268deb5f0fc2faa3ae46358f958)
2025-01-31 17:17:12 -08:00