[RISCV][P-ext] Recognize merge when the mask is constant. (#241110)
If the mask is a constant, we will likely have (or (and X, C), (and X,
~C)).
The isel pattern match expect to see a not operation so we will
miss this pattern.
Add a DAGCombine to detect the inverse constants and form a
RISCVISD::MERGE.
I'm a little worried we may end up adding more DAGCombines to turn MERGE
back into logical operations if we find the other operands are constants
later. I had to do this combine early to catch constants before they can
become constant pools.
Assisted-by: Claude
MachineCSE: Clear physreg kill flags locally (#240274)
Avoid using clearKillFlags which is an expensive use list
walk. Instead of clearing every kill of the implicitly defined
physical register across the function when CSEing across blocks, clear
only the kills between the kept instruction and the eliminated
one. Add a MIR test showing the kill after the eliminated instruction
is now preserved.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[lldb] Let variables of zero-size types have no location (#243284)
Currently ValueObjectVariable reports an error for a variable whose
location can't be evaluated, or whose constant data is empty, even if
objects of the variable's type occupy no memory. For example, at -O2
Clang describes a parameter of an empty struct type without a location,
and LLDB shows it as "<no location, value may have been optimized out>",
although there is no value to show.
This patch fixes this by treating such a variable as valid, with its
type but no data, when its location can't be evaluated or its constant
data is empty.
Assisted-by: Claude
[SimplifyCFG] Mark weights unknown in turnSwitchRangeIntoICmp (#243617)
In the test case, we would end up emitting a branch with no profile
information if the original switch had an unknown profile attached to
it. Propagate the unknown profile to keep profcheck happy.
Also refactor the checks slightly for the profile propagation. The
weight count being the same as the number of cases + 1 on the switch is
an IR invariant enforced by the verifier.
NAS-145306 / 27.1.0 / Tune SPL large allocations, drop default ZFS tunable (by amotin) (#20252)
Our kernels' larger `MAX_ORDER` raises `spl_kmem_alloc_max` from 1MB to
8-16MB. kmem/vmem allocations of that size then try physically
contiguous memory and wake `kswapd`, which on fragmented memory may
evict a large part of the ARC to satisfy them. Restore the usual 1MB
limit, above which SPL uses vmalloc directly.
zfs_arc_shrinker_limit=0 is the default since ZFS 2.3.
Original PR: https://github.com/truenas/middleware/pull/20251
Co-authored-by: Alexander Motin <alexander.motin at TrueNAS.com>
[libc] implement getdelim (#243660)
Add the getdelim function. Implementation was done when adding getline
in PR #242975. This PR mostly adds tests, which are somewhat based on
the getline tests. In future they should be unified or at least made
more similar.
Assisted-by: Automated tooling, human reviewed.
[SelectionDAG][LegalizeTypes] Fix f16 soft promotion flag leak in CSE and RemapValue (#239154)
Fixes #237719
Fixes a miscompilation bug in LLVM where fast-math flags (specifically
nnan) incorrectly leaked during 16-bit float (f16) soft-promotion on
architectures without native half-precision support (such as RISC-V
without Zfh).
Intersect SDNodeFlags upon node reuse in
SelectionDAG::UpdateNodeOperands and DAGTypeLegalizer::RemapValue.
NAS-145306 / 28.0.0-BETA.1 / Tune SPL large allocations, drop default ZFS tunable (#20251)
Our kernels' larger `MAX_ORDER` raises `spl_kmem_alloc_max` from 1MB to
8-16MB. kmem/vmem allocations of that size then try physically
contiguous memory and wake `kswapd`, which on fragmented memory may
evict a large part of the ARC to satisfy them. Restore the usual 1MB
limit, above which SPL uses vmalloc directly.
zfs_arc_shrinker_limit=0 is the default since ZFS 2.3.
[libc][math] Expand polyeval.h with array, loop, and Estrin evaluation.
Add array-based, non-unrolled loop, and right-heavy Estrin polynomial
evaluation helpers to fputil:
- Add array overloads with optional OFFSET template parameter for
polyeval and altpolyeval, using sub_multiply for altpolyeval and
supporting both value (<= sizeof(double)) and const-ref (> sizeof(double))
coefficient types.
- Add loop_polyeval and loop_altpolyeval with LIBC_LOOP_NOUNROLL for
code-size-sensitive evaluations.
- Add estrin_polyeval (array and variadic overloads) using a precomputed
dyadic power table and a minimum-depth right-heavy binary tree.
- Add unit tests in polyeval_test.cpp covering float, double,
DoubleDouble, DyadicFloat<128>, and Frac128 across rounding modes,
constexpr evaluation, and evaluation-order sensitivity.
[lldb] Let language runtimes fix up pointers to instances (NFC) (#243261)
Currently ValueObjectChild uses the pointer value of a parent whose
instances are pointers as the address of the instance. A language
runtime that stores extra information in the spare bits of such
pointers, or that refers to some instances indirectly (for example,
Swift does for unowned references to Objective-C objects) has no way to
correct the address.
This patch fixes this by adding LanguageRuntime::FixupPointerValue(),
which ValueObjectChild calls for parents whose type has
eTypeInstanceIsPointer. No type system in LLVM sets that flag yet.
Assisted-by: Claude