525562 Commits

Author SHA1 Message Date
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
David Green
b23297a7f1 [GlobalISel] Do not run verifier after ResetMachineFunctionPass (#124799)
After we fall back from GlobalISel to SDAG, the verifier gets called,
which calls getReservedRegs which uses SIMachineFunctionInfo::usesAGPRs
which caches the result of UsesAGPRs. Because we have just fallen-back
the function is empty and it incorrectly gets cached to false. This
patch makes sure we don't try to run the verifier whilst the function is
empty.

(cherry picked from commit 66e0498dafbfa7f8fd7deaa88ae62bdf38a12113)
2025-01-31 16:38:42 -08:00
Tom Stellard
78b5d67e71
workflows/premerge: Enable macos builds (#125176)
We still have buildkite for testing Linux and Windows, so we don't need
to enable those builds yet.
2025-01-31 15:43:43 -08:00
Tom Stellard
f2e1acdcda workflows/premerge: Fix condition for macos job (#125237)
(cherry picked from commit 95c0c784ac9a91a8e12331ad9574ac6ad75318b1)
2025-01-31 21:50:53 +00:00
Tom Stellard
0e240b08c6 workflows/premerge: Add macOS testing for release branch (#124303)
Also, remove the old pre-merge tests since Linux and Windows are tested on buildkite now.

(cherry picked from commit b89617d02d1c8a2701c1d3290d2ff45cd858ccde)
2025-01-30 22:27:16 -08:00
Tom Stellard
66a50e246d workflows/release-binaries: Stop using ccache (#124415)
Using ccache relies on the GitHub Actions Cache, which may be
susceptible to cache poisoning. See
https://adnanthekhan.com/2024/05/06/the-monsters-in-your-build-cache-github-actions-cache-poisoning/

Even though these attacks may be difficult, it's better to err on the
side of caution and ensure that the build environment for our releases
is as isolated as possible. Additionally, ccache was only being used for
the stage1 build, which is a small part of the overall build, so the
speed up from using it was not that large.

(cherry picked from commit b32e55df246e26f3ea8edc65e92e4c19d2658f0c)
2025-01-30 20:14:00 -08:00
Nikita Popov
fa12df5e22 [SCEV] Check correct value for UB (#124302)
This is a followup to #117152. That patch introduced a check for
UB/poison on BEValue. However, the SCEV we're actually going to use is
Shifted. In some cases, it's possible for Shifted to contain UB, while
BEValue doesn't.

In the test case the values are:

BEValue: (-1 * (zext i8 (-83 + ((-83 /u {1,+,1}<%loop>) *
{-1,+,-1}<%loop>)) to i32))<nuw><nsw>
Shifted: (-173 + (-1 * (zext i8 ((-83 /u {0,+,1}<%loop>) *
{0,+,-1}<%loop>) to i32))<nuw><nsw>)<nuw><nsw>

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

(cherry picked from commit 07efe2c18a63423943a4f9d9daeada23601f84c8)
2025-01-30 14:05:10 -08:00
Tom Stellard
a97eed928f
Bump version to 20.1.0git (#125067) 2025-01-30 13:54:53 -08:00
Matheus Izvekov
8c2574832e
Reland: [clang] improve print / dump of anonymous declarations (#124858) 2025-01-29 00:31:53 -03:00
Thurston Dang
fdadef9be3
[msan] Handle x86_avx512_(min|max)_p[sd]_512 intrinsics (#124421)
The AVX/SSE variants are already handled heuristically (maybeHandleSimpleNomemIntrinsic via handleUnknownIntrinsic), but the AVX512 variants contain an additional parameter (the rounding method) which fails to match heuristically. This patch generalizes maybeHandleSimpleNomemIntrinsic to allow additional flags (ignored by MSan) and explicitly call it to handle AVX512 min/max ps/pd intrinsics.

It also updates the test added in https://github.com/llvm/llvm-project/pull/123980
2025-01-28 19:12:44 -08:00
Luke Lau
ff271d04a2
[RISCV][VLOPT] Fix assertion failure across blocks (#124734)
Whilst adding a cross-block test, I encountered an assertion failure in
the second pass where we check the instruction popped off the worklist
is a candidate.

The leaf instruction %c in this case will be added to the worklist when
its VL is VLMAX, but during the first pass it will have its VL reduced
to 1.

Then in the second pass when its processed via the worklist, isCandidate
will no longer be true due to its VL == 1.

This fixes it by moving the VL == 1 check to tryReduceVL, keeping it
alongside the other VL check for bailing out early as an optimisation.
2025-01-29 11:00:50 +08:00
Akira Hatanaka
60927405f5
Don't use CLANG_VERSION_MAJOR to check that the value passed to -fclang-abi-compat= is valid (#123998)
Use LLVM_VERSION_MAJOR instead as the maximum allowed value. This change
is needed to fix regression tests that fail when vendors set
CLANG_VERSION_MAJOR to a value that is lower than LLVM_VERSION_MAJOR
when building the compiler.

For example, clang/test/CodeGenCXX/mangle-concept.cpp fails with the
following error if -DCLANG_VERSION_MAJOR=17 is passed to cmake:

invalid value '19' in '-fclang-abi-compat=19'
2025-01-28 18:59:05 -08:00
Lang Hames
d0052ebbe2 [ORC][LLJIT] Install eh-frame registration plugin during platform setup.
Attempt to install the EHFrameRegistrationPlugin during GenericLLVMIRPlatform
setup, rather than object linking layer creation time.

Platform classes are responsible for exception handling: installing the plugin
unconditionally during linking-layer construction could result in frames being
registered more than once when native platform classes are used.

This is a precursor to re-landing compact unwind support (4f0325873fa).
2025-01-29 02:28:49 +00:00
vporpo
79cbad188a
[SandboxVec] Clear Context's state within runOnFunction() (#124842)
`sandboxir::Context` is defined at a pass-level scope with the
`SandboxVectorizerPass` class because the function pass manager `FPM`
object depends on it, and that is in pass-level scope to avoid
recreating the pass pipeline every single time `runOnFunction()` is
called.

This means that the Context's state lives on across function passes. The
problem is twofold:
(i) the LLVM IR to Sandbox IR map can grow very large including objects
from different functions, which is of no use to the vectorizer, as it's
a function-level pass.
(ii) this can result in stale data in the LLVM IR to Sandbox IR object
map, as other passes may delete LLVM IR objects.

To fix both issues this patch introduces a `Context::clear()` function
that clears the `LLVMValueToValueMap`.
2025-01-28 18:28:08 -08:00
andrewjcg
6b654a09c2
[sanitizer] Support "alloc_dealloc_mismatch" suppressions (#124197)
This adds a stack-based suppression for alloc-dealloc-mismatch
violations, using the function name to match.
2025-01-28 18:04:12 -08:00
Veera
98d6dd3988
[LLVM][LangRef][noalias] Remove Redundant Line and Improve Wording (#124685)
Removes a redundant line and improves punctuation and wording in the
paragraph describing the `noalias` attribute.
2025-01-28 20:21:22 -05:00
Sam Clegg
617278e7b0
[lld][WebAssembly] Fix for shared library symbols WRT replacing lazy symbols (#124619)
The rule here, which I'm copying from the ELF linker, is that shared
library symbols should take presence, unless the symbol has already be
extracted from the archive. e.g:

```
$ wasm-ld foo.a foo.so ref.o  // .so wins
$ wasm-ld foo.a ref.o foo.so  // .a wins
```

In the first case the shared library takes precedence because the lazy
symbol is replaced by the .so symbol before it is extracted from the
archive. In the second example the ref.o file causes the archive to be
exracted before the .so file is processed, so in that case the archive
file wins.

Fixes: https://github.com/emscripten-core/emscripten/issues/23501
2025-01-28 16:06:01 -08:00
Fabian Tschopp
28507ac629
[MLIR] Fix thread safety of the deleter in PyDenseResourceElementsAttribute (#124832)
In general, `PyDenseResourceElementsAttribute` can get deleted at any
time and any thread, where unlike the `getFromBuffer` call, the Python
interpreter may not be initialized and the GIL may not be held.

This PR fixes segfaults caused by `PyBuffer_Release` when the GIL is not
being held by the thread calling the deleter.
2025-01-28 18:56:00 -05:00
Thurston Dang
b8cdc5ea27
Reapply "[msan] Add avx512-intrinsics.ll and avx512-intrinsics-upgrade.ll test case (#123980)" (#124500)
This reverts commit b2647ffbf797dd5a457b6b19faab06956934d067 i.e.,
relands 980e86f130.

I had reverted the original patch because of buildbot failures (e.g., https://lab.llvm.org/buildbot/#/builders/13/builds/4938/steps/5/logs/FAIL__LLVM__avx512-intrinsics-upgrade_ll). This reland addresses the likely root cause; namely, that the target datalayout had not been specified.

Additionally, this reland improves the test case by replacing undef with extra parameters.
2025-01-28 15:29:21 -08:00
yonghong-song
8aae191cb6
[BPF] Remove 'may_goto 0' instructions (#123482)
Emil Tsalapatis from Meta reported such a case where 'may_goto 0' insn
is generated by clang compiler. But 'may_goto 0' insn is actually a
no-op so it makes sense to remove that in llvm. The patch is also able
to handle the following code pattern
```
   ...
   may_goto 2
   may_goto 1
   may_goto 0
   ...
```
where three may_goto insns can all be removed.

---------

Co-authored-by: Yonghong Song <yonghong.song@linux.dev>
2025-01-28 15:19:05 -08:00
Prabhuk
e7f02241ad
[nfc][llvm] Clean up isUEFI checks (#124845)
The check for `isOSWindows() || isUEFI()` is used in several places
across the codebase. Introducing `isOSWindowsOrUEFI()` in Triple.h
to simplify these checks.
2025-01-28 15:18:10 -08:00
Raphael Kubo da Costa
437040fe3d
[CMake] Use shm_open, not clock_gettime, to detect librt (#120727)
On systems with glibc, clock_gettime() was moved from librt to libc in
version 2.17, in which case the current librt detection attempt would
always fail.

Look for shm_open instead, like other parts of the tree also do when
looking for librt.

Co-authored-by: Raphael Kubo da Costa <kubo@igalia.com>
2025-01-28 15:17:45 -08:00
gulfemsavrun
38902153fe
[PassBuilder] Add RelLookupTableConverterPass to LTO (#124053)
[PassBuilder] Add RelLookupTableConverterPass to LTO

This patch adds RelLookupTableConverterPass into the LTO
post-link optimization pass pipeline. This optimization
converts lookup tables to relative lookup tables to make
them PIC-friendly, which is already included in the non-LTO
pass pipeline. This patch adds this optimization to the
post-link optimization pipeline to discover more
opportunities in the LTO context.
2025-01-28 15:08:03 -08:00
nerix
381218950e
[clang-cl]: generate debug info when novtable is specified (#124643)
When no vtable is emitted in the debug info because a record was marked
`__declspec(novtable)`, only a forward declaration of that type will be
emitted. This PR fixes that by not omitting the definition for the
`RecordDecl` in this case.

Fixes #124638.
2025-01-28 15:02:33 -08:00
Thurston Dang
4a426079d6
[msan] Use horizontal add to compute shadow for horizontal sub (#124835)
This improves the horizontal sub handling (from
https://github.com/llvm/llvm-project/pull/124159), by always using
horizontal add for the shadow, as recommended by Vitaly.

Fixes https://github.com/llvm/llvm-project/issues/124662
2025-01-28 14:56:05 -08:00
Stephen Tozer
548ecde428 Add extra explicit triple to fix errors from #110102
Attempted fix for errors observed on:
https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-windows-x64/b8724466517233166081/overview

Following the previous fixes, one test that needed an explicit triple
was missed; this commit adds that triple.
2025-01-28 22:51:30 +00:00
Jorge Gorbe Moya
3a1e157454 [bazel] More fixes for 35df525fd00c2037ef144189ee818b7d612241ff
I missed a couple spots in my previous attempt to fix the build
(4eb7c349a616827a3ec9bea57718516409103caa).
2025-01-28 14:49:24 -08:00
Matheus Izvekov
6bb6c30575
[clang] NFC: cleanup check template argument (#124668) 2025-01-28 19:39:08 -03:00
Jorge Gorbe Moya
4eb7c349a6 [bazel] Fix build after 35df525fd00c2037ef144189ee818b7d612241ff 2025-01-28 14:33:07 -08:00
Alex Langford
1f7eb6f403
[lldb] Make SBProgress move-only (#124843)
I wanted to clarify the semantics around SBProgress. Given the nature of
Progress events, copying seems like the wrong idea. Making SBProgress
move-only (like SBStream) seems like the better choice here.
2025-01-28 14:03:17 -08:00
goldsteinn
c2fba02347
[ValueTracking] Fix bug of using wrong condition for deducing KnownBits (#124481)
- **[ValueTracking] Add test for issue 124275**
- **[ValueTracking] Fix bug of using wrong condition for deducing
KnownBits**

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

Bug was introduced by https://github.com/llvm/llvm-project/pull/114689

Now that computeKnownBits supports breaking out of recursive Phi
nodes, `IncValue` can be an operand of a different Phi than `P`. This
breaks the previous assumptions we had when using the possibly
condition at `CxtI` to constrain `IncValue`.
2025-01-28 15:54:00 -06:00
Diego Caballero
35df525fd0
[mlir][Vector] Add support for poison indices to Extract/IndexOp (#123488)
Following up on #122188, this PR adds support for poison indices to
`ExtractOp` and `InsertOp`. It also includes canonicalization patterns
to turn extract/insert ops with poison indices into `ub.poison`.
2025-01-28 13:51:50 -08:00
Louis Dionne
a06c893876
[libc++abi] Make once_flag constinit in cxa_exception_storage (#124627)
This makes it clearer that initialization of this global variable is
taking place at compile-time, reducing the likelihood of static
initialization order fiasco.
2025-01-28 16:44:57 -05:00