[libc] Use linux_syscalls::open instead of manual SYS_open ifdefs (#201089)
I needed to clean up a few types in file.cpp in order to match the
wrapper prototype.
Assisted by Gemini.
[AMDGPU] Do not propagate vgpr count in dVGPR mode (#187078)
When dVGPR mode is enabled chain functions should not propagate VGPR
counts from other chain callees. VGPRs are allocated before chaining to
a chain functions. We only propagate counts from non-chain callees.
[libc] Define _POSIX_THREADS and support _SC_THREADS in sysconf (#201091)
Defined the _POSIX_THREADS macro to 202405L in unistd-macros.h for Linux
to signal POSIX thread support.
Also implemented runtime support for _SC_THREADS in sysconf, returning
_POSIX_THREADS, and added _SC_THREADS and _POSIX_THREADS to the public
unistd.yaml specification.
Added compile-time and runtime tests to verify _POSIX_THREADS definition
and sysconf(_SC_THREADS) behavior. Standardized header comments in
unistd-macros.h to conform to LLVM style.
Assisted-by: Automated tooling, human reviewed.
---------
Co-authored-by: Pavel Labath <pavel at labath.sk>
[clang-tidy] Fix crash in readability-non-const-parameter with redecls (#200178)
The check matches `VarDecls` with `hasInitializer()`, which uses
`getAnyInitializer()` and may therefore match a redeclaration whose
initializer is attached to another declaration. So calling
`IgnoreParenCasts()` on `VD->getInit()` directly would crash when that
redeclaration had no initializer of its own.
This commit fixes the problem by using a new matcher that only matches
VarDecls with an initializer on the current declaration.
Closes https://github.com/llvm/llvm-project/issues/199197
[lldb][Windows] Support OutputDebugString (#196395)
This picks https://reviews.llvm.org/D128541 back up. It implements
support for `OutputDebugStringA/W` on Windows. It's used by some logging
systems.
The main changes since the original patch:
- Use `WaitForDebugEventEx` for getting debug events over
`WaitForDebugEvent`. According to the
[docs](https://learn.microsoft.com/en-us/windows/win32/api/debugapi/nf-debugapi-waitfordebugeventex),
the only difference is that the -Ex version correctly outputs Unicode
strings.
- Support strings longer than 64 KiB. I set an arbitrary limit of 1 MiB
for the strings we read. The debugger interface only tells us the length
modulo 64 KiB which is a bit awkward. Libraries like Qt already chunk
calls to `OutputDebugString`, so strings shouldn't be too big in
practice.
- Output to stdout instead of a log channel, so the output is always
enabled. I don't know if this should go to stdout or stderr.
[8 lines not shown]
[LLVM][SandboxVec][LoadStoreVec] Add support for vector ConstantInt/FP. (#200437)
The current implementation treats all ConstantInt/FP values as scalar,
leading to the wrong number of elements being used when combining them.
Reapply "[PDB][llvm-pdbutil] Add DXContainer support for `pdb2yaml` and `yaml2pdb`" (#201092)
This reapplies #198351 with 2 issues fixed:
- `-Wchanges-meaning` causing an error in `PdbYaml.h`
- UB when parsing DXContainer header from a null buffer, fixed in
#200865
Original patch description:
This patch enables the following:
1. Attempting to parse a `DXContainer` from stream 5 (generated by
DirectX tools) of a PDB file, to be used later in `llvm-pdbutil`.
2. Outputting a PDB file with a built in DXContainer as YAML. Existing
DirectX tools form a PDB container with empty DBI, TPI and IPI streams,
so this patch also allows them to be empty when dumping a PDB file as
YAML.
3. Creating a PDB file from YAML with an built in DXContainer. When
creating a PDB with a DXContainer, streams DBI, TPI and IPI can be
completely empty, so this patch also includes adjustments to allow
forming such a PDB file. This is done to maintain compatibility with
other DirectX tools.
[libc] Define SSIZE_MAX in limits-macros.h (#201087)
Defined SSIZE_MAX in limits-macros.h to support POSIX compliance.
Applications compiling against LLVM libc require SSIZE_MAX to be defined
in limits.h.
SSIZE_MAX is defined strictly in terms of __PTRDIFF_MAX__, matching
ssize_t defined as __PTRDIFF_TYPE__, ensuring they are always
structurally aligned and compile-time safe.
Added Doxygen comments for SSIZE_MAX.
Added SSIZE_MAX to limits.yaml and added a unit test in limits_test.cpp
to verify the definition.
Assisted-by: Automated tooling, human reviewed.
[flang][OpenMP] Store DECLARE_TARGET information in WithOmpDeclarative
This will be used to emit DECLARE_TARGET directives into module files.
When a symbol apperars in DECLARE_TARGET (explicitly or explicitly), the
OmpDeclareTarget flag will be set on it. The set of accompanying clauses
will be stored in the associated details, in the WithOmpDeclarative mixin.
The mixin was added to ObjectEntityDetails, ProcEntityDetails, and
CommonBlockDetails.
The design goal was to be able to reconstruct the appropriate DECLARE_
TARGET directive for individual symbols for the purpose of emitting it
in a module file. Simply storing and then unparsing the AST node may
include symbols that should not be emitted.
Additionally, refactor the WithOmpDeclarative printing code for reuse in
symbol dumping for debugging, and for printing clause sets.
[llvm] Remove unused DenseMapInfo::getTombstoneKey (#200957)
#200595 changed DenseMap to no longer create tombstone buckets, so
DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead
definitions and dead tombstone branches.
[IR][Analysis] Remove unused DenseMapInfo::getTombstoneKey (#200958)
#200595 changed DenseMap to no longer create tombstone buckets, so
DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead
definitions and dead tombstone branches.
[CodeGen][Transforms] Remove unused DenseMapInfo::getTombstoneKey (#200956)
#200595 changed DenseMap to no longer create tombstone buckets, so
DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead
definitions and dead tombstone branches.
[Target] Remove unused DenseMapInfo::getTombstoneKey (#200955)
#200595 changed DenseMap to no longer create tombstone buckets, so
DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead
definitions and dead tombstone branches.
[flang][HLFIR] Add SeparateAllocatableAssign pass (#197814)
Example:
```fortran
!$acc kernels
B = A ! A, B allocatable
!$acc end kernels
```
In this code, `B = A` lowers to `hlfir.assign ... realloc`, which
becomes a `_FortranAAssign` runtime call inside the compute region — the
allocation can't be separated from the copy, and it crashes when `B` is
unallocated.
Fix: add `SeparateAllocatableAssign`, which splits the realloc assign
into an explicit conditional [re-]allocation followed by a plain
`hlfir.assign`, exposing the allocation as plain FIR. For variable RHS
it skips aliasing cases (`a = a(:n)`) by loading the LHS `fir.box` and
querying `fir::AliasAnalysis` on the data. For `hlfir.expr` RHS it
[2 lines not shown]
Revert "[clang] fix getTemplateInstantiationArgs" (#201093)
This caused bootstrap builds on macOS to fail with
error: definition with same mangled name ... as another definition
in JSONGenerator.cpp. See comments on the original PR.
Reverts llvm/llvm-project#199528
[LLVM][Verifier] Reject "splat (...)" as an invalid value for an immarg operand. (#200445)
This makes the behaviour consistent with ConstantDataVector based
values.
[Offload] Forward LIBOMPTARGET_ cmake options to offload (#199906)
Add LIBOMPTARGET for offload so LIBOMPTARGET_* options are forwarded.
Note that the LIBOMPTARGET_* prefix was inherited from OpenMP's CMake
setup.
[AArch64] Add intrinsic support for Fdot instr. (#189987)
This patch adds intrinsics for new NEON Fdot instruction variants. The
implementation is based on the
[proposal](https://github.com/ARM-software/acle/pull/428) and adds these
ACLE builtins:
```
float32x2_t vdot_f32_f16(float32x2_t r, float16x4_t a, float16x4_t b);
float32x4_t vdotq_f32_f16(float32x4_t r, float16x8_t a, float16x8_t b);
float32x2_t vdot_lane_f32_f16(float32x2_t r, float16x4_t a, float16x4_t b, const int lane);
float32x4_t vdotq_laneq_f32_f16(float32x4_t r, float16x8_t a, float16x8_t b, const int lane);
float32x2_t vdot_laneq_f32_f16(float32x2_t r, float16x4_t a, float16x8_t b, const int lane);
float32x4_t vdotq_lane_f32_f16(float32x4_t r, float16x8_t a, float16x4_t b, const int lane);
```