[lldb][Windows] Support AF_UNIX domain sockets (#205618)
Enable the Windows `AF_UNIX` domain-socket support added in #205864 by
flipping the `#if LLDB_ENABLE_POSIX` guards to `#if LLDB_ENABLE_POSIX ||
defined(_WIN32)`.
Also updates `SocketTest.cpp` to exercise `ProtocolUnixDomain` on
Windows (while still excluding ProtocolUnixAbstract, which has no
Windows equivalent).
This is part of a longer set of patches to fix tests on
`LLDB_USE_LLDB_SERVER=1`.
[libc++abi][NFC] Return const void* from __dynamic_cast (#223737)
`__dynamic_cast` is only called magically by the compiler, so it really
doesn't matter what the exact protoype is as long as it's ABI
compatible. Making the return type a `const void*` simplifies the
implementation a bit though.
CodeGen: Remove PointerLikeRegClass
Remove PointerLikeRegClass and the related getPointerRegClass
TargetRegisterInfo hook. This is obsoleted by RegClassByHwMode.
Previously targets would have to map ptr_rc to an assumed pointer
register class by implementing this method, but this is now auto-resolvable
per instruction using RegClassByHwMode.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
Remove getRegClassByHwMode
[clangd] Include the operator name in documentHighlight (#220518)
## Summary
- Placing the cursor on an overloaded operator's declaration (e.g.
`operator new`, `operator[]`) and requesting
`textDocument/documentHighlight` only highlighted the `operator` keyword
itself, not the name or symbol that follows it (`new`, `[]`, etc.), even
though that name is what's actually significant to the user.
- `ReferenceFinder` already splits some references into several spelled
tokens (used for Objective-C's split selector syntax); this reuses that
mechanism for the operator name too, extracting the tokens spelled in
the operator name's source range. This only applies to the declaration's
own occurrence.
## Test plan
- [x] `ninja check-clangd` passes
- [x] New cases added to `HighlightsTest.All` in
`clang-tools-extra/clangd/unittests/XRefsTests.cpp` covering `operator
new`, `operator delete` (clicking on either the keyword or the name),
and a multi-token operator (`operator()`)
[mlir][tosa] Add support for MXFP in SLICE (#220557)
Adds support to profile compliance for MXFP variants of SLICE
Change-Id: I184fbd49ef667d8d4e0ee09a2e65a72095d61daa
---------
Signed-off-by: Philip Wilkinson <philip.wilkinson at arm.com>
[InterleavedLoadCombine] Do not widen loads past a may-not-return instr (#223954)
The combined load reads the whole span at once and is inserted at the
first load, so it effectively hoists the later loads up to that point.
If an instruction between them may not transfer control to its successor
-- a call that might not return, or might throw -- then a load the
original program reached only conditionally would run unconditionally.
All combined loads are in one block, so bail unless the span from the
first to the last load is guaranteed to transfer execution to its
successor.
This gap predates the offset-index change; the old findPattern() did not
check for it either.
Assisted by AI tools.
[VPlan] Fix find last reductions not using frozen condition in select
A find last reduction is something like:
(select c[n], x[n], (select c[n-1], x[n-1], (select ...)))
So even if previous iterations had poison for c[x], the top-level select blocks it.
MaskSelect uses the non-frozen Cond, and that in turn is fed into VPInstruction::ExtractLastActive, which in turn gets expanded to vector.reduce.umax, which returns poison if any of the lanes were poison.
So in the case e.g. c[n] = 1, c[n-1] = poison and VF=2, the scalar loop returns x[n] whilst vector loop returns poison.
We're also introducing multiple uses of Cond, so for these reasons we need to use the frozen Cond.
[AArch64] Remove unreachable DUPLANE lowering. NFC (#222418)
`LowerBUILD_VECTOR` handles non-constant `BUILD_VECTOR` splats by
emitting
`AArch64ISD::DUP`.
The following `DUPLANE` path checks `Value.getValueType()` against `VT`.
`Value` is a scalar `BUILD_VECTOR` operand while `VT` is the vector
result
type, so this condition cannot be false and the `DUPLANE` path is
unreachable.
Remove the dead path. `DUP`s of `EXTRACT_VECTOR_ELT` are already
converted
to `DUPLANE` by `performDUPCombine()` after legalization.
No codegen changes intended.
Fixes #222138
CodeGen: Add getInlineAsmMemoryOperandRegClass
Replace the use of getPointerRegClass to determine the register
class from an asm memory constraint, working to delete it. When
there are multiple pointer types there can't be just a single
answer.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
[AMDGPU] Skip volatile atomics in the atomic optimizer (#223927)
Folding a wavefront into one atomic changes the number of volatile
operations, which is not allowed
Speed up common template argument checks
Avoid setting up pack and constraint machinery for ordinary unconstrained
template argument lists. Reuse canonical type work, keep common converted
argument lists inline, and skip default-substitution comparisons when the
parameter has no default.
CTMark O0 (3 samples, CPU 6): 29.439800 s -> 29.315900 s (-0.421%).
Impact on significant TUs in MLIR build time:
- `mlir/lib/RegisterAllDialects.cpp`: 0.7009% fewer retired
instructions.
- `mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp`: 0.6378% fewer retired
instructions.
Assisted-by: Codex
Cache the most recent diagnostic source file
Avoid repeated ordered-map lookups while diagnostics remain in the same
source file. Clear the cached map node whenever the map is reset.
CTMark O0 (3 samples, CPU 6): 29.439800 s -> 29.312967 s (-0.431%).
Impact on significant TUs in MLIR build time:
- `mlir/lib/RegisterAllDialects.cpp`: 1.0930% fewer retired
instructions.
- `mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp`: 0.5034% fewer retired
instructions.
Assisted-by: Codex
[GlobalISel] Add saturating G_TRUNC support for computeKnownBits (#223929)
Port the saturating-truncate KnownBits handling to the GlobalISel. Look
through G_TRUNC_SSAT_S, G_TRUNC_SSAT_U and G_TRUNC_USAT_U by recursing
into the source operand and applying KnownBits::truncSSat, truncSSatU
and truncUSat respectively.
[lldb] Look up register set children by their own name too (#223857)
On Windows x86_64, LLDB's register tables only list the full width
registers, so the ABI adds the sub-registers itself and puts them in a
separate "supplementary registers" set. That set contains `sp`, but
looking up `sp` in it failed: the lookup first turns `sp` into `rsp`,
and `rsp` is in the general purpose set, not this one. Linux doesn't hit
this because its tables already define the sub-registers next to `rsp`.
Now the lookup falls back to matching the name as written against the
registers of that set, so a register you can reach with
`GetChildAtIndex` can also be found by name. Lookups that already worked
are unchanged.
Fixes https://ci-external.swift.org/job/lldb-windows/job/main/3879/
[ADT] Add make_isa_range to filter and downcast a range by type (NFC) (#223414)
Add a range adaptor that keeps only the elements of a range that isa<T>
holds for, casting each of them to T.
This replaces the common idiom of filtering by type in the loop body
```
for (Instruction &I : *BB) {
auto *PN = dyn_cast<PHINode>(&I);
if (!PN)
continue;
... use PN ...
}
```
with
```
[10 lines not shown]
[libc] Implement pthread_attr_[gs]etinheritsched (#223322)
This patch implements pthread_attr_setinheritsched and
pthread_attr_getinheritsched.
Like the previous scheduler attribute patches, this commit only operates
on the pthread_attr_t object and does not attempt to install scheduling
parameters when creating a new thread.
Unlike schedpolicy and schedparam, where the validity of arguments is
checked by the kernel, inheritsched is purely a userspace pthread
concept. Therefore, we validate the inheritsched argument and reject
unsupported values with EINVAL.
While in there:
- update the file headers in pthread_attr_init to the modern llvm format
- use proxy headers instead of direct pthread.h inclusion
Assisted-by: Gemini
[libc] Store ThreadAttributes in the TCB (#220921)
This patch replaces the `thread_local self` object with the
ThreadAttributes pointer stored in the TCB. current_thread() now
fetches this pointer directly via get_current_thread_attrib().
Since every thread now needs a TCB, init_tls can no longer bail out
when app.tls.size == 0 (this was actually dead code before this patch
since every binary contained at least one thread-local variable
(`self)`). I've removed that check and updated do_start to always set up
a TCB (defaulting to alignment 1 if there is no TLS segment).
The motivation for this change is to make the pthread_self function
async-signal-safe (as required by POSIX), including in the cases where
the function is invoked from a signal hander on the newly created thread
-- before pthread_create returns. This requires making sure that the
thread attribute pointer is initialized from the very first instruction
of the new thread -- something which is hard to do when the attributes
are stored in a TLS variable. This also aligns us with how other C
[11 lines not shown]
[flang] Attribute the generated entry point to the main program's start (#223742)
The `main` entry point that lowering generates for a Fortran main
program is attributed to the end-stmt of the last function-like unit
that was lowered. e.g.
```fortran
subroutine foo(x)
real :: x
x = x + 1.0
end subroutine foo
program demo
real :: a
a = 1.0
call foo(a)
print *, a
end program demo
```
[9 lines not shown]
[CIR] Fix address space of dest cleanup slot (#222628)
Make sure that flatten cfg creates new allocas for dest cleanup slot in
correct address space. This is important for address-space aware targets
like amdgpu.
[lldb][cmake] Accept config-mode packages in add_optional_dependency (#222976)
`add_optional_dependency` copies the caller-supplied `<found>` variable
after `find_package`, and callers name the Find module's result
variable, which is usually all-caps (`LIBXML2_FOUND`, `CURSES_FOUND`). A
package located in config mode only sets `<PackageName>_FOUND`
(`LibXml2_FOUND`), so the copy comes back empty and the dependency is
reported as missing and silently disabled even though `find_package`
succeeded.
Set the result variable to TRUE when either `${found}` or
`${package}_FOUND` is set, FALSE otherwise.
Behavior for module-mode finds is unchanged; only the config-mode case,
which previously always evaluated to false, is affected.
[IVDescriptors] Rename MonotonicDescriptor ConditionalInductionDescriptor (NFC) (#223707)
Rename `MonotonicDescriptor` to `ConditionalInductionDescriptor` to
acknowledge that the phi may wrap, so is not strictly monotonic.
Assisted-by: Codex
[libc] Fix fxdivi tests on 32-bit targets (#223675)
Guard saturation operands against overflow and correct boundary
expectations for the range and precision of 32-bit long.
Fixes issue introduced in a969579a9129891bccb63fcc69e76d74b299f322.
Assisted-by: Codex. Entirely done by the AI and reviewed by me.
[VPlan] Use frozen combined condition in early exit first-active-lane
Combined is used both to compute if an early exit was taken via VPInstruction::AnyOf, as well as the index of the early-exited lane in VPInstruction::FirstActiveLane.
Combined can have poison lanes past the exited lane, so the AnyOf uses freeze to prevent branching on poison. However FirstActiveLane on a vector with a poison lane is poison, so we need to also use the frozen version of Combined to prevent poison there.