[SandboxVec][LoadStoreVec] Fix pass return value (#245693)
Failed attempts at vectorization may still modify the IR even if no
vector instructions were emitted, because of scheduling. So in that case
we are currently returning false even though the IR did get modified.
This gets caught with EXPENSIVE_CHECKS.
This patch adds a top-level IR save and restore that will restore the IR
when no vectorization has taken place to make sure the IR is back in its
original state, therefore making sure that the returned value is
correct.
[lldb] [NFC] Remove the text test before `print`'s expression path (#245576)
`dwim-print` tries an expression-path step before the expression
evaluator,
and skips it for any expression whose text holds `->`, `*`, `&`, `[` or
`]`.
The reason of the test belongs to the pre-DIL expression-path code,
`StackFrame::LegacyGetValueForVariableExpressionPath`, which split the
string itself and had no notion of an operator. #243651 removed that
code.
`GetValueForVariableExpressionPath` now always lexes and parses the
expression with DIL. `dwim-print` passes `lldb::eDILModeSimple`, whose
lexer accepts only `identifier`, `period` and `eof`. Each character the
text test looks for lexes to a token that mode rejects, so the
expressions
this now admits to DIL fail there and fall through to the expression
evaluator, which is where the text test sent them before.
[CodeGen] Fix isDef() assert on metadata operands in hasImplicitDef (#239703)
The MachineVerifier allows metadata and MC-symbol operands after an
instruction's explicit operands in
`MachineOperand::isValidExcessOperand()`. These operands appear in
`implicit_operands()`, but `MachineInstr::hasImplicitDef()` assumes
every operand in that range is a register and calls `isDef()` on each
one. An instruction that the verifier accepts can therefore trip the
"Wrong MachineOperand accessor" assertion when a pass asks whether it
has an implicit def.
This PR checks that an operand is a register before querying whether
it's a def, matching the neighbouring `MachineInstr` helpers such as
`allImplicitDefsAreDead()`. It also adds the same check in
`TargetInstrInfo::commuteInstructionImpl()`. Without it, an instruction
with both a metadata operand and an implicit register def would reach an
unchecked `getReg()` call in the loop that updates implicit defs.
powerpc: fix an off-by-one when widening 32-bit syscall arguments
cpu_fetch_syscall_args() widens the arguments a 32-bit syscall passes on
the stack. The loop started at narg instead of narg - 1 and wrote
td_sa.args[narg], one past the end of the eight entry array, which is
td_sigblock_ptr in struct thread. NARGREG is 8, so a plain syscall never
enters the loop, but syscall(2) and __syscall(2) lower the register count
to 7 and 6, and an eight argument syscall made that way, like
freebsd32_sendfile with its two slot off_t, corrupted the pointer.
A 32-bit program calling sendfile through syscall(2) changed its own
td_sigblock_ptr (watched with DTrace on cpu_fetch_syscall_args); it
leaves it alone now.
Reviewed by: jhibbits
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D61884
cpu_switch(): Move 'sw1wait' inside the function block
This code block is unrelated to the resumectx() procedure it was after,
and is referenced only by cpu_switch(), so move it between
ENTRY(cpu_switch) and END(cpu_switch). This, in particular, puts it
inside a .cfi_startproc/.cfi_endproc block, giving clearer debugging
information should a problem arise there.
Keep it at the end so that jumping to it is initially predicted not
taken.
Reviewed by: kib
Fixes: 73dd84a7a54d ("amd64: clean up cpu_switch.S")
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61713
[LLDB] Add data formatter for Rust vectors. (#239745)
Set up the basic framework for adding Rust data formatters, and add a
data formatter for Rust vector types.
libsysdecode: Avoid non-portable \> word end boundary in mktables
Whilst we bootstrap our own sed when building on non-FreeBSD, it uses
the system regex(3) implementation, and so inherits its extensions, not
our own. Our implementation and glibc's both include this extension to
POSIX, but macOS's does not, and so even with our bootstrap sed we
cannot use the \> extension when built and run on macOS.
Unfortunately, there is no alternative form we can use; whilst macOS
implements [[:>:]] as an extension that provides this same feature, and
so do we, the regex(3) implementation in glibc does not, and the only
alternative glibc offers is \b, which neither us nor macOS implement.
We could make the form used conditional on the OS, but that starts to
get messy once other Linux libcs enter the picture, which in theory we
somewhat support.
Rewrite both uses to avoid the need for \>. For gen_table, use a pattern
to match the identifier that is precisely the (non-extended) C99
[25 lines not shown]
[AMDGPU][NFC] Clean up HasUses in SIFixSGPRCopies::processPHINode
Use !MRI->use_empty(PHIRes) instead.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
drm: return a positive errno when drm_ioctl_permit() fails
Since 908aca8817 drm_ioctl() hands drm_ioctl_permit()'s Linux-style
negative error code to userland unchanged, so a refused ioctl sets
errno to -13 (-EACCES) instead of 13. The handler results below are
already negated (retcode = -func(...)). The same commit also changed
"return ENODEV" to "return -ENODEV" for an unplugged device; restore the
positive value (nothing reaches it today, drm_dev_unplug() is only
called from code that is not built).
drmAuthMagic() returns -errno, i.e. +13, which never equals -EACCES,
so libdrm's drmIsMaster() reports non-master fds as master. wlroots
then calls drmDropMaster() on a cloned non-master fd, logs "Failed to
drop master", closes the fd, and the DRM lease manager skips the card.
Negate the value, as is done for the handlers.
Tested on 6.5-DEVELOPMENT (i915): AUTH_MAGIC on a non-master fd now
fails with errno 13 instead of -13, sway no longer logs "Failed to drop
master" or skips the card for leasing, and X starts.
drm: return a positive errno or zero from drm_read()
drm_read() is the d_read method of drm_cdevsw, which returns zero or a
positive errno; the amount read is in uio_resid. It returned the
Linux-style negative values instead: -EAGAIN for an O_NONBLOCK read
without events, -EFAULT, -EINTR from mutex_lock_interruptible() and
-ERESTARTSYS from wait_event_interruptible(). It also returned the
number of bytes read when the next event did not fit in the buffer;
read(2) then failed with that number as the errno and the events
already copied were lost.
Negate the errno values, map -ERESTARTSYS to EINTR as drm_ioctl() does,
and return zero when data was read.
Tested on 6.5-DEVELOPMENT (i915): an O_NONBLOCK read without events now
fails with errno 35 (EAGAIN) instead of -35, a read interrupted by a
signal with errno 4 (EINTR) instead of -512, and read(2) of 40 bytes
with three 32-byte vblank events queued returns 32 instead of failing
with errno 32 (EPIPE) and losing the event.
drm: return a positive errno from drm_open()
drm_open() is the d_open method of drm_cdevsw, which returns a
positive errno, but its failure paths return the Linux-style negative
values: -ENODEV from drm_minor_acquire(), -EBUSY for O_EXCL and the
negative errors of drm_open_helper() and drm_setup(). A failed open()
therefore hands a negative errno to userland, as drm_ioctl() did.
Negate the value on both error returns.
Tested on 6.5-DEVELOPMENT (i915): open(2) of /dev/dri/card0 with O_EXCL
now fails with errno 16 (EBUSY) instead of -16.
drm: remove debug kprintf()s from drm_auth.c
drm_setmaster_ioctl() and drm_dropmaster_ioctl() print unconditional
kprintf()s: every DRM_IOCTL_DROP_MASTER, and every SET_MASTER that does
not return early, leaves a line in dmesg (seen at the end of every sway
session started through seatd). They were added as debugging aids in
4ec80808ee. Remove them; the setmaster workaround itself is unchanged.
[SPARC] Print the full trap number (#245511)
The instruction printer masked the trap number of Tcc with 0x7f. That
came from 52adb575e617, which also added a custom decoder that read
only 7 bits of the trap number. 099001979fe8 removed that decoder, so
the disassembler now decodes the 8-bit field that Tcc encodes, and the
mask cut off bit 7: ta 0x80 printed as ta 0 and ta 0xff as ta 127.
Drop the special case and print the trap number like any other
immediate.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[libc] Fix unsigned underflow in string_to_float.h. (#245745)
`pos_len` is an `int32_t`, but is computed using the difference of
`uint32_t`s. Cast to signed before doing the arithmetic so that clamping
`pos_len` on the following lines works.
Assisted-by: Automated tooling, human reviewed.
[Transforms] Remove write-only and unused members (NFC) (#245544)
ModuleAddressSanitizer::Recover: Added on November 11, 2015 in commit
d7731988ef44c9417a79bd4db042183a60900f14 without any readers. This
patch also removes its initializer and the now-unused Recover
constructor parameter.
ModuleMemProfiler::Mapping: Added on August 13, 2020 in commit
7ed8124d46f94601d5f1364becee9cee8538265e without any readers. This
patch also removes its initializer.
ModuleSanitizerCoverage::FunctionPCsArray: The last readers were removed
on September 13, 2018 in commit
3bea25e5543606758ab10d395b1e7283255be75b. This patch also removes its
assignments and drops the now-unused return value of CreatePCArray.
SCCPInstVisitor::Ctx: The last reader was removed on June 19, 2023 in
commit 664b7a4cd51d9273888e79688f64cc8bbcbdbe25. This patch also
removes its initializer and the now-unused Ctx constructor parameter.
[5 lines not shown]
[ARM] Remove write-only private member variables (NFC) (#245543)
ARMFastISel::TM: The last readers were removed on August 20, 2026 in
commit 239b30e2f5bd11df57e7c4a054bf3a9b7b0bd714. This patch also
removes its initializer.
ARMLowOverheadLoops::MRI: The last reader was removed on September 17,
2019 in commit 36c922278e6e7fb2083dc29dda950dfac73a194c. This patch
also removes its assignment.
Assisted-by: Antigravity
Bitstream: Decode single-chunk VBR fields inline
Share one decoder between ReadVBR and ReadVBR64, decode the first chunk
inline from a word load, and only call out of line for the remaining
chunks. The inline part is always_inline because GCC otherwise clones
ReadVBR out of line, which made bitcode reading slower.
Instructions in parseIRFile with opt -passes=verify:
clang 23 GCC 15
k.bc -6.17% -0.14%
cnf.bc -5.93% +0.74%
sqlite3 -5.02% -0.38%
z08.bc -4.54% -0.56%
Whole opt -O3 runs: -0.14% to -0.47% with clang, within 0.02% with GCC.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[SPIR-V] Use one helper for temp registers in the selector (#241373)
Some temp registers in the selector were made with
createVirtualRegister, which sets the full LLT. For wide vectors this
LLT is larger than the register class, so builds with assertions fail with
"VReg's low-level type and register class have different sizes",
for example on uitofp <8 x i1> to <8 x float>.
Add createTempVReg, which sets only the register class and the SPIR-V
type. Use it instead of createVirtualRegister, and in the places that did the
same steps by hand.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>