[libc][sys/shm] Implement shmdt syscall wrapper on Linux. (#239785)
`shmdt` is a POSIX function (see
[docs](https://pubs.opengroup.org/onlinepubs/9799919799/functions/shmdt.html#))
that detaches the shared memory segment from the address space of a
calling process.
On Linux, it can be implemented as a simple wrapper around SYS_shmdt
syscall.
Provide the implementation, and add a simple test case verifying it only
works correctly on addresses returned by `shmat` call.
[RISCV] Report errors for user reserving argument/return registers with Zhinx/Zfinx. (#239384)
Zhinx/Zfinx can use X10_H-X17_H or X10_W-X10_H subregisters. These were
not tracked in the bitvector in RISCVSubtarget.
The subtarget now contains a 32 element bitset for just the X registers.
The full bitset has moved to RISCVRegisterInfo where it is populated
with the aliases in the constructor.
RISCVRegisterInfo::getReservedRegs now uses the 32 element bitset. This
required moving the constant registers out of the loop and reserving
them explicitly. Alternatively, we could use the full bitset here, but
since we use markSuperRegs, we'd end up visiting registers multiple
times.
I've kept an accessor for the full bitset in RISCVSubtarget to avoid
touching all callers.
Assisted-by: Claude
AMDGPU: Remove clearKillFlags calls
Kill flags on physical registers here are either never set by the
time this code runs or are on reserved or constant registers where
they carry no information. Remove the clearKillFlags calls.
SIPeepholeSDWA was adding a kill flag on the virtual register it ties
to the preserved destination and relying on the clear to remove it.
Stop adding it.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
MachineSink: Remove clearKillFlags calls
Kill flags on physical registers here are either never set by the
time this code runs or are on reserved or constant registers where
they carry no information. Remove the clearKillFlags calls.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
LoongArch: Remove clearKillFlags calls on virtual registers
Kill flags are no longer permitted on virtual registers, so clearing
them is a no-op. Remove the calls where the register can only be
virtual.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
PowerPC: Remove clearKillFlags calls on virtual registers
Kill flags are no longer permitted on virtual registers, so clearing
them is a no-op. Remove the calls where the register can only be
virtual.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
iSCSI: Fast and per-session timeouts
Support per-session configurable ping (SCSI NOP) and login timeouts
similar to what is supported in the Linux iSCSI initiator configuration file.
Reduce iscsi timer granularity to 0.1 sec.
For backwards compatibility, when all timers are selected on integer numbers,
all status messages are unchanged. If the higher granularity is used, the
log messages include sub-second granularity.
The sysctl(3) interface has changed from pure int to string, in order to
support fractional seconds in a human-readable, dotted notation.
Reviewed By: #netapp, #manpages, jhb, pauamma_chezdork.com, siderop1_netapp.com
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D32540
X86: Remove clearKillFlags calls on virtual registers
Kill flags are no longer permitted on virtual registers, so clearing
them is a no-op. Remove the calls where the register can only be
virtual.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RISCV: Remove clearKillFlags calls on virtual registers
Kill flags are no longer permitted on virtual registers, so clearing
them is a no-op. Remove the calls where the register can only be
virtual.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[RISCV] Drop MachineDominatorTreeWrapperPass in Zilsd optimizer (#239783)
The last use of MachineDominatorTreeWrapperPass in
RISCVZilsdOptimizer.cpp was removed on November 6, 2026 in commit
d8ce3e5f727698eacfc46687562e5c53ab7c7241.
This patch removes the unused MachineDominatorTreeWrapperPass dependency
and MachineDominators.h include from RISCVZilsdOptimizer.cpp. Dropping
this dependency defers MachineDominator Tree Construction in the legacy
RISC-V -O3 pipeline until right before Slot index numbering.
Assisted-by: Antigravity
X86: Remove dead kill flag maintenance in X86AvoidStoreForwardingBlocks (#239777)
This pass runs before register allocation, and the verifier now
rejects kill flags on virtual registers.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[ConstraintElim] Split signed min/max across their operands when checking a compare
The existing constraint systems only record the bounds that hold for both
operands of a min/max (smax(a, b) >= a and >= b, smin(a, b) <= a and <= b). The
other direction is a disjunction, which cannot be recorded as a fact. When a
compare of signed decompositions involves a min/max result, split it into its
operands: the decomposition is monotonic in that result, so it is the max or min
of its values on each side, and the relation holds for all or for either side
respectively.
https://alive2.llvm.org/ce/z/zsGkJ-
[ConstraintElim] A signed sum of operands with opposite signs cannot wrap
If one operand is known non-negative and the other non-positive, the signed
sum is between them, so it cannot overflow.
https://alive2.llvm.org/ce/z/ZF5Yqr
[ConstraintElim] Prove sadd/ssub.with.overflow cannot overflow from the exact sum
Decompose the operands and show that the sum lies in the range of the type. This
handles patterns like A + (B - A), as well as sums involving signed min/max
results, which are split across their respective operands using monotonicity
(for example start + smax(end - start - 1, 0) <= end).
https://alive2.llvm.org/ce/z/ze8LCk
AMDGPU: Remove clearKillFlags calls on virtual registers (#239780)
Kill flags are no longer permitted on virtual registers, so clearing
them is a no-op. Remove the calls where the register can only be
virtual.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Merge tag 'iommu-fixes-v7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux
Pull iommu fixes from Joerg Roedel:
"AMD IOMMU:
- Move PerfOpt management into the IOMMU domain attachment paths,
enabling it automatically for supported integrated GPUs in identity
mode and clearing it before switching to translated or blocked
domains
- Fix a boot panic in the GPU identity-mapping quirk when a GPU has
no upstream PCI bridge
- Clear the IOMMU SNP enable flag when RMP table initialization
fails, preventing subsequent initialization from assuming SNP setup
succeeded
- Check IVRS subtable types before parsing memory definitions,
avoiding bogus PCI segments caused by misinterpreting IVHD entries
[11 lines not shown]
Hexagon: Remove clearKillFlags calls on virtual registers (#239781)
Kill flags are no longer permitted on virtual registers, so clearing
them is a no-op. Remove the calls where the register can only be
virtual.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[libc] Don't match the byte after the range in vector find_first_character (#235288)
The vectorized `find_first_character` implementations (`clang_vector`
and the x86_64 `arch_vector`) returned the position of a match that was
the first byte after the searched range. For example, `memchr("ab", 'b',
1)` returned a pointer to the `'b'` instead of `nullptr`.
The new test covers all implementations, since no configuration selects
the vectorized ones by default. On aarch64 Linux, it fails without the
fix and passes with it. The x86_64 changes were only compiled, not run.
Assisted-by: Claude Code (Claude Opus 5.5)
__mcount() relies on a standard m68k stack frame and the frame pointer for
two things:
1- return address in __mcount()'s frame is used to get selfpc (i.e. the
function being instrumented).
2- __mcount() uses the saved-%fp in its own frame to get the frame pointer
of the instrumented function, which is then used to get return address
in that frame in order to get frompc.
Ensure __mcount()'s stack frame is always set up correctly by decorating
wiht __attribute__((__optimize__("no-omit-frame-pointer"))).
[libc] Don't read memory in vector find_first_character if n is 0 (#235289)
The vectorized `find_first_character` implementations (`clang_vector`
and the x86_64 `arch_vector`) loaded the aligned block containing the
start pointer before checking the length. With a length of zero, the
pointer doesn't have to be dereferenceable, so `memchr(p, c, 0)` and
`strnlen(p, 0)` crashed if `p` was the start of an inaccessible page.
The new test covers all implementations, since no configuration selects
the vectorized ones by default. On aarch64 Linux, it segfaults without
the fix and passes with it. The x86_64 changes were only compiled, not
run.
Assisted-by: Claude Code (Claude Opus 5.5)
[DAG] Fold fp_to_int(ftrunc(x)) -> fp_to_int(x) (#231060)
fp_to_[su]int already rounds toward zero, so an ftrunc in front of it
does nothing and can be dropped. fp_to_[su]int_sat is the same since it
truncates before it clamps.
x86 hits this through LowerFROUND which expands round into a copysign
add plus an ftrunc so (long)roundf(x) keeps a vroundss that the convert
makes pointless.
The AArch64 test changes are shapes its isel patterns don't cover,
mostly f16 and bf16.
On RISC-V llvm.trunc on some test cases turns into an fabs, a compare,
an fcvt round trip and an fsgnj, or a call to trunc, and all of it goes
away.
AMDGPU runs integer division through a float reciprocal. The i32 cases
each lose a v_trunc_f32. The i64 files only change register numbering
[7 lines not shown]