Fix bugs in slot-index-based checkInterference and use for unspill.
Rather than constructing a temporary "hull" LiveInterval and calling the
LiveInterval-based checkInterference overload -- which risks a query-cache
identity hazard when that temporary interval is stack-allocated and reused
across the AllocOrder loop (see the FIXME comment in
LiveRegMatrix::checkInterference(SlotIndex, SlotIndex, MCRegister)) -- this
patch switches the unspilling code to call the slot-index-based
checkInterference(SlotIndex, SlotIndex, MCRegister) overload directly with
the hull's [beginIndex, endIndex).
Doing so exposed a real bug in that overload: LiveRegMatrix.h documents
that returning false means "PhysReg is free at [Start, End)", but the
implementation only checked the matrix of already-assigned virtual
registers. It never checked fixed register-unit interference (e.g. PhysReg
is defined directly by some instruction in [Start, End)) or regmask
interference (e.g. PhysReg is clobbered by a call in [Start, End)) -- both
of which the LiveInterval-based overload does check. This patch adds both
checks to the slot-index-based overload, in the same priority order
[29 lines not shown]
[AMDGPU] Fix overlapping insert crash during rewrite-agpr-copy-mfma
Fixes https://github.com/llvm/llvm-project/issues/204224
Guard against a possibly wrong interference result for a discontiguous
stack slot interval by using the entire range.
A spilled stack slot can have a discontiguous live interval, e.g. a single
value live across several disjoint segments:
[a, b) [c, d) ........gap........ [e, f)
with gaps where the slot is dead. The interference check previously only
considered the covered segments, so it could pick a PhysReg that is free
within them but busy inside a gap. Unspilling replaces the slot with a vreg
whose recomputed interval is continuous over [a, f) (it fills the gaps),
so assigning that PhysReg could overlap the value live in the gap and trip
the "Overlapping insert" assertion in LiveRegMatrix::assign. Checking
interference over the whole [a, f) hull avoids this.
[2 lines not shown]
[PowerPC] Add missing vec_msum and vec_vmsumudm builtins for POWER9 (#221199)
This patch exposes `__builtin_altivec_vmsumudm` in `BuiltinsPPC.def` and
adds the missing `vec_msum` and `vec_vmsumudm` intrinsics in
`<altivec.h>` matching GCC 11+ behavior.
[libc] Template printf_core::Parser to support wchar_t. (#222988)
This is the next step in the ongoing refactor to support wide character
printf functions.
`printf_core::FormatSection` is also templated on character type as it
is required for parser_test. `FormatSection` is named in many more
places. In order to keep this PR on the smaller side, it also gets a
rename + `char` alias in the pattern of `basic_string_view` /
`string_view`.
Assisted-by: Automated tooling, human reviewed.
[DAGCombine] Do not gate a pre-legalization FADD fold on FMUL legality (#218748)
Now follows the same check as `fold (fadd A, (fneg B)) -> (fsub A, B)`
and `fold (fadd (fneg A), B) -> (fsub B, A)` a few lines above
Co-authored-by: Claude (Claude-Opus-5) <noreply at anthropic.com>
[clangd] Offer Extract to Function for single expression-statements (#219945)
The tweak refused to trigger whenever the extraction zone contained a
single statement that was an expression, e.g. a lone call like
`log("connection failed");` or an overloaded-operator statement like
`std::cout << "x";`. The former was blocked by an overly broad check in
validSingleChild(); the latter additionally required
getParentOfRootStmts() to recognize that such a statement can be its own
root statement even while marked Unselected, rather than being treated
as a container of root statements.
Fixes clangd/clangd#698
Fixes clangd/clangd#1254
Assisted-by: Claude
spl: Honour forced Linux slab cache selection
spl_kmem_cache_slab_limit controls automatic cache selection. An
explicit KMC_SLAB request should override that cutoff, but the Linux
slab branch applies it again. With a zero cutoff, this rejects the
forced znode cache. Pool creation later dereferences the NULL cache in
spl_kmem_cache_alloc().
Automatic selection has already applied the cutoff before this branch.
Remove the redundant check so KMC_SLAB retains its documented force
semantics, and clarify the automatic cutoff's scope in spl(4).
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Matthias Goergens <matthias.goergens at gmail.com>
Closes #19095
[SPIRV] Refactor implicit binding legalization (#222848)
This change rewrites the `SPIRVLegalizeImplicitBinding` pass so that
binding collection is driven by intrinsic declarations rather than a
full-module instruction walk.
Previously, the pass used an `InstVisitor` to visit every instruction in
the module and find calls to a small set of intrinsics. The new
implementation iterates over the intrinsic declarations and their users,
making the cost proportional to the number of relevant resource calls
rather than the size of the module.
There is no change to the SPIR-V emitted for existing shaders. Implicit
bindings are still assigned the same numbers.
Other improvements include:
- Order IDs are extracted once into a `SmallVector` instead of being
recomputed on each sort comparisons.
[15 lines not shown]
[SLP]Allow min-VF vectorization of seed-level reduction groups
Small reduced-value groups of single-use seed-level reductions may
vectorize at VF=2, if the values are used by the reduction operations
only and no scalar leftovers remain. For fadd this replaces the
ordered reduction fallback; for the other kinds trunk leaves such
groups scalar.
Reviewers: RKSimon, bababuck, MrSidims
Pull Request: https://github.com/llvm/llvm-project/pull/222757
Stop the TRIM and initialize threads when a vdev goes offline
vdev_fault() and vdev_offline() leave the vdev not writeable, but the
TRIM or initialize thread running on it only notices that at its next
vdev_trim_should_stop() check, and it is that thread which records the
final state of the operation: since bedbc13da vdev_trim_thread() sets
VDEV_TRIM_CANCELED for a faulted vdev on its way out, and
vdev_initialize_thread() does the same. Neither ioctl waits for that,
even though spa_vdev_state_exit() already waits for the txg to sync
exactly so the command is synchronous -- "when the command completes,
you expect no further I/O from ZFS".
So the operation is still running when the command returns: a "zpool
status -t" issued right after "zpool offline -f" reports
loop0 FAULTED 0 0 0 external device fault (31% trimmed, ...)
on a vdev that is already FAULTED, and the TRIM thread keeps issuing IO
to the device the administrator has just faulted.
[37 lines not shown]
[clang][CodeGen] Emit lifetime markers for block-scoped compound literals in C (#219045)
In C (C99/C11/C23 §6.2.4.5), block-scoped compound literals have
automatic storage duration extending to the end of the enclosing block
scope. Previously, Clang emitted alloca storage without lifetime
markers (@llvm.lifetime.start / @llvm.lifetime.end), preventing LLVM's
StackColoring pass from merging stack slots across disjoint scopes and
inflating stack frame size.
Following John McCall's guidance in #68746:
1. In Sema, record block-scoped compound literals in ExprCleanupObjects
so
the enclosing full-expression is wrapped in an ExprWithCleanups.
2. In CodeGen, emit @llvm.lifetime.start before evaluating initializers
and
schedule CallLifetimeEnd as a cleanup.
Checking a build of an x86_64 Linux kernel defconfig build, this shaves
448 bytes off the stack usage for azx_probe(), one of the larger stack
[3 lines not shown]
lib/msun: use the same algorithm for sw fmaf(3) as for fma(3)
This fixes rounding at the last bit for subnormals.
PR: 298260
Reviewed by: kib
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D59579
lib/msun: use the same algorithm for sw fmaf(3) as for fma(3)
This fixes rounding at the last bit for subnormals.
PR: 298260
Reviewed by: kib
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D59579