[mlir][X86] Fix operand order in MaskScaleFOp lowering (#248360)
Reorder the operands to (a, b, src, k, rounding) when lowering
`x86.avx512.mask.scalef` to LLVM intrinsics so masked-off lanes take
their values from src.
Add regression coverage for the f32 and f64 variants using distinct SSA
values for the three vector operands.
Fixes: #247612
[libc++][ci] Build the libstdc++ benchmarks with TBB and enable PSTL in this config (#243119)
This PR adds the include and the library paths to TBB when building
benchmarks against `libstdc++`, such that its PSTL implementation can
run in parallel.
[libc++][pstl] Add benchmarks for parallel std::transform_inclusive_scan (#241312)
This PR adds a few benchmarks for the parallel scanning operations, in
this case particularly `std::transform_inclusive_scan()`.
[libc++][pstl] Add a parallel implementation of std::unique_copy (#247149)
This PR refactors the existing parallel implementation of `copy_if` into
a more generic `__parallel_flagged_copy`.
The refactored implementation takes an abstract "flagger" that populates
the bit set, instead of explicitly requiring a unary predicate.
With this change, the algorithm can accommodate both `copy_if` and
`unique_copy`, such that these functions basically differ only in the
flagger they pass into `__parallel_flagged_copy`.
[libc++][pstl] Support platforms that have threads but no lock-free types (#248081)
Previously the code in PSTL demanded lock-free properties from some
atomics as a defensive measure, but after some discussions it was
decided that we don't want to make this decision for the user.
As a drive-by this patch reduces the number of preprocessor branches in
`statpart.cpp` and removes the dummy serial implementation of
`__apply()` from it, since this function shouldn't be called when the
platform has no support for threading.
[lldb] Don't skip a frame after an interrupted frame fetch (#248090)
`StackFrameList::FetchFramesUpTo()` increments
`m_concrete_frames_fetched` after taking the index to be fetched. If the
fetch is interrupted, the idx is not restored, so the frame is never
added.
`TestInterruptBacktrace` is flaky on ARM64 Windows because of this.
This patch restores the index.
[AMDGPU] Implement builtin and intrinsic for s_wait_idle (#244238)
`s_wait_idle` is available since gfx10, but has so far not been exposed
in intrinsics. It waits for all dependency and memory counters to reach
0, similar to `s_waitcnt 0` on older architectures.
This can be useful for microbenchmarks, to ensure that only intended
operations are included in time measurements. **It should not be used
for attempts to circumvent the memory model.** There are alternatives
for "synchronization without cache invalidate/writeback" patterns that
are designed for this purpose.
Disclaimer: The implementation was mostly done by AI; I've reviewed it
and checked that it matches existing examples for similar builtins and
intrinsics.
Fixes: LCOMPILER-3256
Assisted-by: AI Coding Agent
[analyzer] Fix crashes on unusual macros in tryExpandAsInteger (#248108)
tryExpandAsInteger crashed on empty macro definitions because of an
unchecked .back() call, and an assertion fired when the value of a macro
did not fit into int64_t. Values wider than an int that still fit into
int64_t were silently truncated. Return std::nullopt in these cases.
Values above INT_MAX that fit into the bits of the target's int are
still converted to it, because DragonFly BSD defines AT_FDCWD as
0xFFFAFDCD.
Fixes #246164.
Assisted-by: Claude Code
[MLIR][CMake] Remove aggregate generated-header ordering
Remove implicit mlir-headers ordering and redundant per-library edges.
Use generator links for header-only includes and connect generators
whose public wrappers include other generated declarations. Link Func
from MLProgram transforms because its public pass header includes
FuncOps.h.
Keep both aggregate targets available for downstream compatibility. The
full LLVM and MLIR Ninja build passes with no missing dependencies
across 9,742 audited nodes.
Assisted-by: Codex
[MLIR][CMake] Stop depending on mlir-generic-headers by default
Remove implicit generic-header prerequisites from library and example
helpers. Keep the aggregate and its registrations for downstream users.
Declare generic interface requirements through owning libraries or exact
generator links. Retain generators owned by IR and OpenMP and the shared
conversion-pass declarations used by standalone conversion libraries.
The complete LLVM and MLIR build and check-mlir pass. Ninja reports no
missing generated-file dependencies across all and check-mlir targets.
Assisted-by: Codex
[MLIR][docs] Document the CMake infrastructure
Describe TableGen, library helpers, aggregation, exports, and
validation. Explain generated-header propagation through the CMake link
graph and header-only generator links with ordinary visibility.
Assisted-by: Codex
[CMake] Propagate generated-header prerequisites through link dependencies
Use linkable TableGen targets and transitive compile properties to
follow actual header requirements. Bridge the evaluated logical-library
closure to object compilation without building provider objects or
archives.
Republish embedded component headers from shared and aggregate
libraries. Keep generators out of ordinary exports and imported MLIR
aggregation metadata. Let post-creation MLIR links use the same header
closure.
Validate clean consumer builds and exports with CMake 3.31.10 and
4.3.0-rc2 on Ninja and Unix Makefiles, including failing provider
sources.
Assisted-by: Codex
[LoongArch] Lower splat of variable-index extract to [x]vreplve (#244542)
Lower a splat of a variable-index extract_vector_elt to [x]vreplve. For
256-bit vectors, each 128-bit lane must splat the element at the same
position within the lane, which is the per-lane semantics of xvreplve.
Also, [x]vreplve only uses the low bits of the index, so drop redundant
masking of it.
Assisted-By: LLM
[LoongArch][NFC] Add tests for splat of variable-index extract (#244541)
Add tests for splatting a vector element selected by a variable index,
for splatting such elements within each 128-bit lane, and for [x]vreplve
intrinsics with a masked index.
Assisted-By: LLM
[VPlan] Replace reassociateHeaderMask with a combine (#247946)
At the time reassociateHeaderMask was added, header masks weren't region
values and combineRecipes didn't have a worklist. Now that we have both
we can avoid the separate pass and move it into combineRecipes.
This also improves codegen on RISC-V because we now reassociate on every
call to combineRecipes, and after other combines have been applied.
[AMDGPU] Skip 32-bit addresses in SADDR fallback
Since #245220, SelectGlobalSAddr also accepts 32-bit (AS6) addresses.
The out-of-range offset fallback walked such an address before it was
extended, so a divergent AS6 load with a large constant failed with
"illegal VGPR to SGPR copy", and a wrapping 32-bit add could have been
split. Skip 32-bit addresses there and add a test.
Rename isUniformInVGPRs to isProducedInVGPRs: it asks where a uniform
value lives, not whether it is uniform. Update the async LDS tests for
the new s_wait_xcnt and the multicast mask clamp.
[LoongArch] Remove redundant divisor guards from vector div/rem (#244485)
The Rust portable implementations of the [x]vdiv/[x]vmod intrinsics
guard the divisor against zero and signed overflow, e.g.
```
%bz = icmp eq %b, 0
%guard = or %bz, (and (icmp eq %a, MIN), (icmp eq %b, -1))
%d = select %guard, splat (1), %b
%q = sdiv %a, %d
%r = select %bz, splat (0), %q
```
The hardware already returns 0 for x / 0 and x % 0, MIN for MIN / -1 and
0 for MIN % -1, so the guards are redundant. Fold them into new
VDIV/VDIV_U/VMOD/VMOD_U nodes to emit a single [x]vdiv/[x]vmod.
Assisted-by: LLM
[LoongArch][NFC] Add tests for vector div/rem with guarded divisors (#244483)
Add tests for vector div/rem whose divisor is guarded against zero and
signed overflow, as produced by portable implementations of the
[x]vdiv/[x]vmod intrinsics.
Assisted-by: LLM
[libc++][docs] Add WG21 issues and papers voted in 2026-11 Buzios (#247586)
Notably, there are some papers addressing C++26 NB ballot comments, so
presumably they should be treated as C++26 papers. Remaining papers and
LWG issues are considered belonging to C++29.
For LWG4612 which is not yet adopted, GH issue is created and then
closed for the convention.
[cmake][lldb] Use Python3_SABI_LIBRARY_DIRS (#246347)
CMake now requires 3.31.
Clarified the comment to mention where the pragma comes from since it's now in the LLVM codebase.
Restructured the code slightly to make the dynamic plugin path use the correct library directory variable. Ditto for the other.
[AArch64][MachineOutliner] Handle async CFI for outlined calls
When calling outlined functions from a function that needs asynchronous
unwind information, we need to add extra CFI instructions at the call
site in some cases, depending on how LR is saved in the caller. We have
the following cases:
1. LR doesn't need saving at the call site. In this case we don't need
any extra CFI instructions.
2. LR is saved in a free register. In this case we need to add
`.cfi_register w30, wN` and `.cfi_restore w30` around the function
call. This will make sure that an unwinder can recover the correct LR
value.
3. LR is saved to the stack. Since this case modifies the value of SP,
and thus potentially the CFA, we disallow it entirely with
asynchronous unwind info. We could probably allow some special cases,
e.g. when the function doesn't use FP, but then we would have to
reimplement complex functionality from `AArch64FrameLowering`.
[AArch64][MachineOutliner] Emit async CFI in outlined functions
When requesting asynchronous unwind info, CFI instructions are now added
to the epilogue of outlined functions. The prologue CFI is also modified
to make it compatible with asynchronous unwinding.