525932 Commits

Author SHA1 Message Date
Karol Herbst
47addd4540 [libclc] Include isnan implementation for SPIR-V targets
The fma software emulation requires it.

Similar to https://github.com/llvm/llvm-project/pull/124614
llvmorg-20.1.6
2025-05-27 15:33:46 -07:00
Owen Pan
4b6e5a2866 [clang-format] Handle Java text blocks (#141334)
Fix #61954

(cherry picked from commit b7f5950bb3b97eac979925a3bbf015530c26962e)
2025-05-27 15:29:17 -07:00
Rainer Orth
0e1ef696f1 [Driver] Fix _XOPEN_SOURCE definition on Solaris (#137141)
Since commit 613a077b05b8352a48695be295037306f5fca151, `flang` doesn't
build any longer on Solaris/amd64:
```
flang/lib/Evaluate/intrinsics-library.cpp:225:26:
error: address of overloaded function 'acos' does not match required type '__float128 (__float128)'
  225 |       FolderFactory<F, F{std::acos}>::Create("acos"),
      |                          ^~~~~~~~~
```
That patch led to the version of `quadmath.h` deep inside `/usr/gcc/<N>`
to be found, thus `HAS_QUADMATHLIB` is defined. However, the `struct
HostRuntimeLibrary<__float128, LibraryVersion::Libm>` template is
guarded by `_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600`, while
`clang` only predefines `_XOPEN_SOURCE=500`.

This code dates back to commit 0c1941cb055fcf008e17faa6605969673211bea3
back in 2012. Currently, this is long obsolete and `gcc` prefefines
`_XOPEN_SOURCE=600` instead since GCC 4.6 back in 2011.

This patch follows that.

Tested on `amd64-pc-solaris2.11` and `sparcv9-sun-solaris2.11`.

(cherry picked from commit e71c8ea3cc73c8f7b0382468f355a254166d3a72)
2025-05-27 15:27:43 -07:00
Nikita Popov
5d99a97583 [MachO] Improve bounds check (#141083)
The current check may fail if the addition overflows. I've observed
failures of macho-invalid.test on 32-bit due to this.

Instead, compare against the remaining bytes until the end of the
object.

(cherry picked from commit 3f29acb51739a3e6bfb8cc623eb37cb734c98a63)
2025-05-26 10:44:39 +00:00
Tom Stellard
aa804fd3e6 [sanitizer_common] Remove interceptors for deprecated struct termio (#137403)
This struct will be removed from glibc-2.42 and has been deprecated for
a very long time.

Fixes #137321

(cherry picked from commit 59978b21ad9c65276ee8e14f26759691b8a65763)
2025-05-25 03:13:33 -07:00
hev
53393e26d5 [LoongArch] Prevent R0/R1 allocation for rj operand of [G]CSRXCHG (#140862)
The `[G]CSRXCHG` instruction must not use R0 or R1 as the `rj` operand,
as encoding `rj` as 0 or 1 will be interpreted as `[G]CSRRD` OR
`[G]CSRWR`, respectively, rather than `[G]CSRXCHG`.

This patch introduces a new register class `GPRNoR0R1` and updates the
`[G]CSRXCHG` instruction definition to use it for the `rj` operand,
ensuring the register allocator avoids assigning R0 or R1.

Fixes #140842

(cherry picked from commit bd8578c3574d77bc1231f047bced4a0053a1b000)
2025-05-23 21:11:35 -07:00
hev
6fcb1c127b [LoongArch] Fix assertion failure for annotate tablejump (#140907)
Fix a use-after-free issue related to annotateTableJump in the LoongArch
target.

Previously, `LoongArchPreRAExpandPseudo::annotateTableJump()` recorded a
reference to a MachineOperand representing a jump table index. However,
later optimizations such as the `BranchFolder` pass may delete the
instruction containing this operand, leaving a dangling reference.

This led to an assertion failure in
`LoongArchAsmPrinter::emitJumpTableInfo()` when trying to access a freed
MachineOperand via `getIndex()`.

The fix avoids holding a reference to the MachineOperand. Instead, we
extract and store the jump table index at the time of annotation. During
`emitJumpTableInfo()`, we verify whether the recorded index still exists
in the MachineFunction's jump table. If not, we skip emission for that
entry.

Fixes #140904

(cherry picked from commit 4e186f20e2f2be2fbf95d9713341a0b6507e707d)
2025-05-23 21:10:26 -07:00
Owen Pan
15ec590e38 release/20.x: [clang-format] Fix the indent of StartOfName after AttributeMacro (#140361)
Backport 0cac25bcf5a246eb8a1f02d5041731ae9a6f00e0
2025-05-23 21:07:59 -07:00
Owen Pan
802f4f7537 [clang-format] Handle raw string literals containing JSON code (#140666)
Fix #65400

(cherry picked from commit 0dfdf7efbfe347517eb4c7f544043a71af4e4a25)
2025-05-23 21:06:10 -07:00
Benjamin Maxwell
9b0832508e [SDAG] Ensure load is included in output chain of sincos expansion (#140525)
The load not being included in the chain meant that it could materialize
after a `@llvm.lifetime.end` annotation on the pointer. This could
result in miscompiles if the stack slot is reused for another value.

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

(cherry picked from commit c9d62491981fe720c1b3255fa2f9ddf744590c65)
2025-05-23 21:04:44 -07:00
Fangyi Zhou
8a36b8e3ab [clang][analyzer] Handle CXXParenInitListExpr alongside InitListExpr
As reported in #135665, C++20 parenthesis initializer list expressions
are not handled correctly and were causing crashes. This commit attempts
to fix the issue by handing parenthesis initializer lists along side
existing initializer lists.

(cherry picked from commit 5dc9d55eb04d94c01dba0364b51a509f975e542a)
2025-05-23 21:03:00 -07:00
cor3ntin
070cf62530 [Clang] Demote mixed enumeration arithmetic error to a warning (#131811)
In C++, defaulted to an error.

C++ removed these features but the removal negatively impacts users.

Fixes #92340
2025-05-23 20:59:40 -07:00
Daniel Kiss
a169f5ca4e Correct position of CFI Instruction for Pointer Authentication"
This a partial of reverts commit 0b73b5af60f2c544892b9dd68b4fa43eeff52fc1.
Fixes #137802
2025-05-23 18:16:24 -07:00
Shafik Yaghmour
5befd1fb3c [Clang][AST] Fix HandleLValueBase to deal with references (#140105)
Since P2280R4 Unknown references and pointers was implemented,
HandleLValueBase now has to deal with referneces:

D.MostDerivedType->getAsCXXRecordDecl()

will return a nullptr if D.MostDerivedType is a ReferenceType. The fix
is to use getNonReferenceType() to obtain the Pointee Type if we have a
reference.

Fixes: https://github.com/llvm/llvm-project/issues/139452
(cherry picked from commit 136f2ba2a7bca015ef831c91fb0db5e5e31b7632)

# Conflicts:
#	clang/docs/ReleaseNotes.rst
2025-05-16 16:54:12 -07:00
Jacek Caban
e3d2c00cce [LLD][COFF] Allow -arm64xsameaddress in ARM64EC directives (#139631)
Make it a no-op for now, which is sufficient for non-hybrid images.

Fixes #131712.

(cherry picked from commit d5da557782dd47395fb41e03d7663df6319d7ea6)
2025-05-16 16:47:32 -07:00
tangaac
85e06a7614 [LoongArch] Fix fp_to_uint/fp_to_sint conversion errors for lasx (#137129)
Prvious `fp_to_uint/fp_to_sint` patterns for `v4f64 -> v4i32` are wrong.
Conversion error was triggered after pr
https://github.com/llvm/llvm-project/pull/126456.

(cherry picked from commit b5c7724f82b6afe98761d0a1c5b6ee7cd2330ada)
2025-05-16 16:43:08 -07:00
Douglas Yung
ff2e8f93f6 Fix test pfalse-v4i1.ll added in #138712 to require asserts.
Should fix build bot failure: https://lab.llvm.org/buildbot/#/builders/202/builds/1102

(cherry picked from commit 194a4a333a95f9e001d2c8abe82c3d4cf8894acf)
2025-05-16 16:35:56 -07:00
Tom Stellard
1e4d39e077 Bump version to 20.1.6 2025-05-14 11:14:42 -07:00
Donát Nagy
7b09d7b446 [analyzer] Workaround for slowdown spikes (unintended scope increase) (#136720)
Recently some users reported that they observed large increases of
runtime (up to +600% on some translation units) when they upgraded to a
more recent (slightly patched, internal) clang version. Bisection
revealed that the bulk of this increase was probably caused by my
earlier commit bb27d5e5c6b194a1440b8ac4e5ace68d0ee2a849 ("Don't assume
third iteration in loops").

As I evaluated that earlier commit on several open source project, it
turns out that on average it's runtime-neutral (or slightly helpful: it
reduced the total analysis time by 1.5%) but it can cause runtime spikes
on some code: in particular it more than doubled the time to analyze
`tmux` (one of the smaller test projects).

Further profiling and investigation proved that these spikes were caused
by an _increase of analysis scope_ because there was an heuristic that
placed functions on a "don't inline this" blacklist if they reached the
`-analyzer-max-loop` limit (anywhere, on any one execution path) --
which became significantly rarer when my commit ensured the analyzer no
longer "just assumes" four iterations. (With more inlining significantly
more entry points use up their allocated budgets, which leads to the
increased runtime.)

I feel that this heuristic for the "don't inline" blacklist is
unjustified and arbitrary, because reaching the "retry without inlining"
limit on one path does not imply that inlining the function won't be
valuable on other paths -- so I hope that we can eventually replace it
with more "natural" limits of the analysis scope.

However, the runtime increases are annoying for the users whose project
is affected, so I created this quick workaround commit that approximates
the "don't inline" blacklist effects of ambiguous loops (where the
analyzer doesn't understand the loop condition) without fully reverting
the "Don't assume third iteration" commit (to avoid reintroducing the
false positives that were eliminated by it).

Investigating this issue was a team effort: I'm grateful to Endre Fülöp
(gamesh411) who did the bisection and shared his time measurement setup,
and Gábor Tóthvári (tigbr) who helped me in profiling.

(cherry picked from commit 9600a12f0de233324b559f60997b9c2db153fede)
llvmorg-20.1.5
2025-05-13 15:18:22 -07:00
Pengcheng Wang
a708fb737a [RISCV] Allow Zicsr/Zifencei to duplicate with g (#136842)
This matches GCC and we supported it in LLVM 17/18.

Fixes #136803

(cherry picked from commit 6c3373534305a2ce23dd939344dd0a387a09fe88)
2025-05-13 15:02:44 -07:00
Balazs Benics
1c0368417f [clang][analysis] Fix flaky clang/test/Analysis/live-stmts.cpp test (2nd attempt) (#127406)
In my previous attempt (#126913) of fixing the flaky case was on a good
track when I used the begin locations as a stable ordering. However, I
forgot to consider the case when the begin locations are the same among
the Exprs.

In an `EXPENSIVE_CHECKS` build, arrays are randomly shuffled prior to
sorting them. This exposed the flaky behavior much more often basically
breaking the "stability" of the vector - as it should.
Because of this, I had to revert the previous fix attempt in #127034.

To fix this, I use this time `Expr::getID` for a stable ID for an Expr.

Hopefully fixes #126619
Hopefully fixes #126804

(cherry picked from commit f378e52ed3c6f8da4973f97f1ef043c2eb0da721)
2025-05-13 14:37:12 -07:00
cor3ntin
0439d1d363 [Clang] Fix handling of reference types in tryEvaluateBuiltinObjectSize (#138247)
The order of operation was slightly incorrect, as we were checking for
incomplete types *before* handling reference types.

Fixes #129397

---------

Co-authored-by: Erich Keane <ekeane@nvidia.com>
2025-05-13 14:35:50 -07:00
mojyack
74ed1ac611 [sanitizer_common] Fix build on ppc64+musl (#120036)
In powerpc64-unknown-linux-musl, signal.h does not include asm/ptrace.h,
which causes "member access into incomplete type 'struct pt_regs'"
errors. Include the header explicitly to fix this.

Also in sanitizer_linux_libcdep.cpp, there is a usage of TlsPreTcbSize
which is not defined in such a platform. Guard the branch with macro.

(cherry picked from commit 801b519dfd01e21da0be17aa8f8dc2ceb0eb9e77)
2025-05-13 14:32:08 -07:00
Owen Pan
2d079b96a5 release/20.x: [clang-format] Fix a crash on formatting missing r_paren/r_brace (#138230)
Backport 79210feb2993ff9a79ef11f8a7016a527d4fcf22
2025-05-13 14:28:28 -07:00
Yingwei Zheng
2cacf46f35 [X86][TargetLowering] Avoid deleting temporary nodes in getNegatedExpression (#139029)
In the original case, the third call to `getCheaperNegatedExpression`
deletes the SDNode returned by the first call.
Similar to 74e6030bcbcc8e628f9a99a424342a0c656456f9, this patch uses
`HandleSDNodes` to prevent nodes from being deleted by subsequent calls.
Closes https://github.com/llvm/llvm-project/issues/138944.

(cherry picked from commit 143cce72b1f50bc37363315793b80ae92d2b0ae3)
2025-05-13 14:26:52 -07:00
Yuta Mukai
f233430d97 [AArch64] Fix feature list for FUJITSU-MONAKA processor (#139212)
FEAT_FP8DOT4 and FEAT_FP8FMA are supported by FUJITSU-MONAKA. These were
previously enabled due to dependencies, but now require explicit
activation due to modifications in the dependencies.

(cherry picked from commit 9d5a5424f0356bd6ee01c751dd6957299783b41b)
2025-05-13 13:21:12 -07:00
Reid Kleckner
41c36d9408 [clang] Fix unused variable warning in MS mangler from constant matrix patch
(cherry picked from commit ccdd55c518277d749eff878ffcb5ca3de55c2a60)
2025-05-10 13:05:55 -07:00
Losy001
72ad9be1e3 [Clang][MicrosoftMangle] Implement mangling for ConstantMatrixType (#134930)
This pull request implements mangling for ConstantMatrixType, allowing
matrices to be used on Windows.

Related issues: #53158, #127127

This example code:
```cpp
#include <typeinfo>
#include <stdio.h>

typedef float Matrix4 __attribute__((matrix_type(4, 4)));

int main()
{
  printf("%s\n", typeid(Matrix4).name());
}
```
Outputs this:
```
struct __clang::__matrix<float,4,4>
```

(cherry picked from commit f5a30f111dc4ad6422863722eb708059a68a9d5c)
2025-05-10 13:05:55 -07:00
Anutosh Bhat
0019b7d0ae [wasm-ld] Refactor WasmSym from static globals to per-link context (#134970)
Towards

This change moves WasmSym from a static global struct to an instance
owned by Ctx, allowing it to be reset cleanly between linker runs. This
enables safe support for multiple invocations of wasm-ld within the same
process

Changes done

- Converted WasmSym from a static struct to a regular struct with
instance members.

- Added a std::unique_ptr<WasmSym> wasmSym field inside Ctx.

- Reset wasmSym in Ctx::reset() to clear state between links.

- Replaced all WasmSym:: references with ctx.wasmSym->.

- Removed global symbol definitions from Symbols.cpp that are no longer
needed.

Clearing wasmSym in ctx.reset() ensures a clean slate for each link
invocation, preventing symbol leakage across runs—critical when using
wasm-ld/lld as a reentrant library where global state can cause subtle,
hard-to-debug errors.

---------

Co-authored-by: Vassil Vassilev <v.g.vassilev@gmail.com>
(cherry picked from commit 9cbbb74d370c09e13b8412f21dccb7d2c4afc6a4)
2025-05-10 11:12:53 -07:00
thetruestblue
b7b834e2a2 [RTSan][Darwin] Adjust OSSpinLock/_os_nospin_lock interceptor and tests (#132867)
These changes align with these lock types and allows builds and tests to
pass with various SDKS.

rdar://147067322
(cherry picked from commit 7cc4472037b43971bd3ee373fe75b5043f5abca9)
2025-05-10 11:01:54 -07:00
davidtrevelyan
f811c7df0a [rtsan][Apple] Add interceptor for _os_nospin_lock_lock (#131034)
Follows the discussion here:
https://github.com/llvm/llvm-project/pull/129309

Recently, the test
`TestRtsan.AccessingALargeAtomicVariableDiesWhenRealtime` has been
failing on newer MacOS versions, because the internal locking mechanism
in `std::atomic<T>::load` (for types `T` that are larger than the
hardware lock-free limit), has changed to a function that wasn't being
intercepted by rtsan.

This PR introduces an interceptor for `_os_nospin_lock_lock`, which is
the new internal locking mechanism.

_Note: we'd probably do well to introduce interceptors for
`_os_nospin_lock_unlock` (and `os_unfair_lock_unlock`) too, which also
appear to have blocking implementations. This can follow in a separate
PR._

(cherry picked from commit 481a55a3d9645a6bc1540d326319b78ad8ed8db1)
2025-05-10 11:01:54 -07:00
Jonas Hahnfeld
4370072022 [clang] Forward TPL of NestedNameSpecifier
This avoids type suffixes for integer constants when the type can be
inferred from the template parameter, such as the unsigned parameter
of A<1> and A<2> in the added test.
2025-05-10 10:09:45 -07:00
Ulrich Weigand
d34d529609 Support z17 processor name and scheduler description
The recently announced IBM z17 processor implements the architecture
already supported as "arch15" in LLVM. This patch adds support for "z17"
as an alternate architecture name for arch15.

This patch also add the scheduler description for the z17 processor,
provided by Jonas Paulsson.

Manual backport of https://github.com/llvm/llvm-project/pull/135254
2025-05-10 10:05:48 -07:00
Owen Pan
a7166c3739 release/20.x: [clang-format] RemoveParentheses shouldn't remove empty parentheses (#138229)
Backport d3506ee573a2aa1403817642ef45f8c0305bb572
2025-05-09 13:45:23 -07:00
Raul Tambre
5429418cb0 [clang] Add support for Debian 14 Forky and Debian 15 Duke (#138460)
Futureproofs our single Debian-specific special case for roughly the next 6 years.

See: https://lists.debian.org/debian-devel-announce/2025/01/msg00004.html
(cherry picked from commit 58e6883c8b6e571d6bd774645ee2b6348cfed6ba)
2025-05-09 13:43:32 -07:00
Louis Dionne
be087ab359 [libc++] Re-introduce _LIBCPP_DISABLE_AVAILABILITY (#134158)
The `_LIBCPP_DISABLE_AVAILABILITY` macro was removed in afae1a5f32bb as an
intended no-op. It turns out that some projects are making use of that
macro to work around a Clang bug with availability annotations that
still exists: https://github.com/llvm/llvm-project/issues/134151.

Since that Clang bug still hasn't been fixed, I feel that we must sill
honor that unfortunate macro until we've figured out how to get rid of
it without breaking code.

(cherry picked from commit 25fc52e655fb4bfd3bb89948d5cbfe011e1b8984)
2025-05-09 13:41:52 -07:00
Anutosh Bhat
2b34040173 [clang-repl] Fix destructor for interpreter for the cuda negation case (#138091)
Check this error for more context
(https://github.com/compiler-research/CppInterOp/actions/runs/14749797085/job/41407625681?pr=491#step:10:531)

This fails with
```
* thread #1, name = 'CppInterOpTests', stop reason = signal SIGSEGV: address not mapped to object (fault address: 0x55500356d6d3)
  * frame #0: 0x00007fffee41cfe3 libclangCppInterOp.so.21.0gitclang::PragmaNamespace::~PragmaNamespace() + 99
    frame #1: 0x00007fffee435666 libclangCppInterOp.so.21.0gitclang::Preprocessor::~Preprocessor() + 3830
    frame #2: 0x00007fffee20917a libclangCppInterOp.so.21.0gitstd::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() + 58
    frame #3: 0x00007fffee224796 libclangCppInterOp.so.21.0gitclang::CompilerInstance::~CompilerInstance() + 838
    frame #4: 0x00007fffee22494d libclangCppInterOp.so.21.0gitclang::CompilerInstance::~CompilerInstance() + 13
    frame #5: 0x00007fffed95ec62 libclangCppInterOp.so.21.0gitclang::IncrementalCUDADeviceParser::~IncrementalCUDADeviceParser() + 98
    frame #6: 0x00007fffed9551b6 libclangCppInterOp.so.21.0gitclang::Interpreter::~Interpreter() + 102
    frame #7: 0x00007fffed95598d libclangCppInterOp.so.21.0gitclang::Interpreter::~Interpreter() + 13
    frame #8: 0x00007fffed9181e7 libclangCppInterOp.so.21.0gitcompat::createClangInterpreter(std::vector<char const*, std::allocator<char const*>>&) + 2919
```

Problem :

1) The destructor currently handles no clearance for the DeviceParser
and the DeviceAct. We currently only have this

9764938224/clang/lib/Interpreter/Interpreter.cpp (L416-L419)

2) The ownership for DeviceCI currently is present in
IncrementalCudaDeviceParser. But this should be similar to how the
combination for hostCI, hostAction and hostParser are managed by the
Interpreter. As on master the DeviceAct and DeviceParser are managed by
the Interpreter but not DeviceCI. This is problematic because :
IncrementalParser holds a Sema& which points into the DeviceCI. On
master, DeviceCI is destroyed before the base class ~IncrementalParser()
runs, causing Parser::reset() to access a dangling Sema (and as Sema
holds a reference to Preprocessor which owns PragmaNamespace) we see
this
```
  * frame #0: 0x00007fffee41cfe3 libclangCppInterOp.so.21.0gitclang::PragmaNamespace::~PragmaNamespace() + 99
    frame #1: 0x00007fffee435666 libclangCppInterOp.so.21.0gitclang::Preprocessor::~Preprocessor() + 3830

```

(cherry picked from commit 529b6fcb00aabbed17365e5fb3abbc2ae127c967)
2025-05-09 13:40:39 -07:00
Ikhlas Ajbar
ae97a56d36 [Hexagon] Add missing patterns to select PFALSE and PTRUE (#138712)
Fixes #134659

(cherry picked from commit 57e88993fee30f4441e87df4df061393600b2ada)
2025-05-09 13:39:43 -07:00
Nikita Popov
2386c377db [BasicAA] Gracefully handle large LocationSize (#138528)
If the LocationSize is larger than the index space of the pointer type,
bail out instead of triggering an APInt assertion.

Fixes the issue reported at
https://github.com/llvm/llvm-project/pull/119365#issuecomment-2849874894.

(cherry picked from commit 027b2038140f309467585298f9cb10d6b37411e7)
2025-05-09 13:37:40 -07:00
Joseph Huber
961ce35e29 [OpenMP] Add pre sm_70 load hack back in (#138589)
Summary:
Different ordering modes aren't supported for an atomic load, so we just
do an add of zero as the same thing. It's less efficient, but it works.

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

(cherry picked from commit dfcb8cb2a92c9f72ddde5ea08dadf2f640197d32)
2025-05-09 13:35:58 -07:00
Alexandre Ganea
009f3c10d1 [LLD][COFF] Don't dllimport from static libraries (#134443)
This reverts commit 6a1bdd9 and re-instate behavior that matches what
MSVC link.exe does, that is, error out when trying to dllimport a symbol
from a static library.

A hint is now displayed in stdout, mentioning that we should rather dllimport the symbol
from a import library.

Fixes https://github.com/llvm/llvm-project/issues/131807
2025-05-09 13:33:47 -07:00
Ricardo Jesus
70eed33971 [InstCombine] Do not combine shuffle+bitcast if the bitcast is eliminable. (#135769)
If we are attempting to combine shuffle+bitcast but the bitcast is
pairable with a subsequent bitcast, we should not fold the shuffle as
doing so can block further simplifications.

The motivation for this is a long-standing regression affecting SIMDe on
AArch64, introduced indirectly by the AlwaysInliner (1a2e77cf). Some
reproducers:
* https://godbolt.org/z/53qx18s6M
* https://godbolt.org/z/o5e43h5M7

(cherry picked from commit c91c3f930cfc75eb4e8b623ecd59c807863aa6c0)
2025-05-09 13:31:07 -07:00
Carlos Galvez
6ddf2e5d10 [clang-tidy] Do not pass any file when listing checks in run_clang_ti… (#137286)
…dy.py

Currently, run_clang_tidy.py does not correctly display the list of
checks picked up from the top-level .clang-tidy file. The reason for
that is that we are passing an empty string as input file.

However, that's not how we are supposed to use clang-tidy to list
checks. Per
65eccb463d,
we simply should not pass any file at all - the internal code of
clang-tidy will pass a "dummy" file if that's the case and get the
.clang-tidy file from the current working directory.

Fixes #136659

Co-authored-by: Carlos Gálvez <carlos.galvez@zenseact.com>
(cherry picked from commit 014ab736dc741f24c007f9861e24b31faba0e1e7)
2025-05-09 13:26:17 -07:00
Peter Klausler
8272e45161 [flang] Exempt construct entities from SAVE check for PURE (#131383)
A PURE subprogram can't have a local variable with the SAVE attribute.
An ASSOCIATE or SELECT TYPE construct entity whose selector is a
variable will return true from IsSave(); exclude them from the local
variable check.

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

(cherry picked from commit b99dab25879449cb89c1ebd7b4088163543918e3)
2025-05-09 13:22:30 -07:00
Benjamin Maxwell
069ef671e0 [AArch64][SME] Allow spills of ZT0 around SME ABI routines again (#136726)
In #132722 spills of ZT0 were disabled around all SME ABI routines to
avoid a case where ZT0 is spilled before ZA is enabled (resulting in a
crash).

It turns out that the ABI does not promise that routines will preserve
ZT0 (however in practice they do), so generally disabling ZT0 spills for
ABI routines is not correct.

The case where a crash was possible was "aarch64_new_zt0" functions with
ZA disabled on entry and a ZT0 spill around __arm_tpidr2_save. In this
case, ZT0 will be undefined at the call to __arm_tpidr2_save, so this
patch avoids the ZT0 spill by marking the callsite with
"aarch64_zt0_undef". This attribute only applies to callsites and marks
that at the point the call is made ZT0 is not defined, so does not need
preserving.
2025-05-09 13:17:57 -07:00
Benjamin Maxwell
a38e1ae204 [AArch64][SME2] Don't preserve ZT0 around SME ABI routines (#132722)
This caused ZT0 to be preserved around `__arm_tpidr2_save` in functions
with "aarch64_new_zt0". The block in which `__arm_tpidr2_save` is called
is added by the SMEABIPass and may be reachable in cases where ZA has
not been enabled* (so using `str zt0` is invalid).

* (when za_save_buffer is null and num_za_save_slices is zero)
2025-05-09 13:17:56 -07:00
3405691582
be4097b6ee Fix crash lowering stack guard on OpenBSD/aarch64. (#125416)
TargetLoweringBase::getIRStackGuard refers to a platform-specific guard
variable. Before this change, TargetLoweringBase::getSDagStackGuard only
referred to a different variable.

This means that SelectionDAGBuilder's getLoadStackGuard does not get
memory operands. However, AArch64InstrInfo::expandPostRAPseudo assumes
that the passed MachineInstr has nonzero memoperands, causing a
segfault.

We have two possible options here: either disabling the LOAD_STACK_GUARD
node entirely in AArch64TargetLowering::useLoadStackGuardNode or just
making the platform-specific values match across TargetLoweringBase.
Here, we try the latter.

(cherry picked from commit c180e249d0013474d502cd779ec65b33cf7e9468)
2025-05-09 13:11:20 -07:00
Younan Zhang
aecbb2364a [Clang] Fix the trailing comma regression (#136273)
925e195 introduced a regression since which we started to accept invalid
trailing commas in many expression lists where they're not allowed by
the grammar. The issue came from the fact that an additional invalid
state - previously handled by ParseExpressionList - was overlooked in
that patch.

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

No release entry because I want to backport it.

(cherry picked from commit c7daab259c3281cf8f649583993bad2536febc02)
2025-05-09 13:00:44 -07:00
Tom Stellard
ebfae55af4 Bump version to 20.1.5 2025-04-29 17:24:51 -07:00
Martin Storsjö
ec28b8f9cc [libcxx] [test] Extend mingw workarounds for armv7/aarch64 too (#136419)
This would be more convenient, if ADDITIONAL_COMPILE_FLAGS(target=...)
could be set with a regular expression, just like within e.g. XFAIL
lines.

(cherry picked from commit d6622df115c0de92bf8fc10f8787345ff96b26cc)
llvmorg-20.1.4
2025-04-29 16:05:17 -07:00