[X86] Ignore debug instructions after calls in call frame optimization (#232624)
`collectCallInfo` skips debug instructions while scanning argument
setup, but checks the instruction immediately after a call for
`ADJCALLSTACKUP`. A `DBG_VALUE` at that boundary makes the pass abandon
the sequence, so adding debug information can leave stack argument
stores instead of converting them to pushes.
Use `next_nodbg(..., false)` to ignore only debug instructions when
looking for `ADJCALLSTACKUP`, without skipping pseudo probes. The MIR
test places a `DBG_VALUE` between the call and `ADJCALLSTACKUP` and
covers both pass-manager paths.
Assisted-by: OpenAI Codex 5.6 Sol, co-reviewed by Claude and Yongqiang
Tian.
[SROA] Rename and document `isSafeSelectToSpeculate` (NFC) (#232681)
`isSafeSelectToSpeculate` does much more than the name and documentation
curently suggest:
- It handles stores too, the documentation only mentions loads.
- It checks for predication and returns instructions that need to be
predicated, when we're allowed to modify the CFG.
Rename it as `isSafeSelectToSpeculateOrPredicate` to clarify that the returned
instructions may require predication.
Document what predication is, as used in this pass. Current documentation only
has a speculation example.
Documentation is also updated with a few more details.
[InstCombine] Canonicalize atomicrmw sub of a constant to add
Rewrite `atomicrmw sub ptr, C` as `atomicrmw add ptr, -C`. This
matches the canonical form InstCombine already uses for plain `sub`.
In wrapping arithmetic $old - C = old + (-C)$, so both the stored
value and the returned old value stay the same, including when C is
`INT_MIN`. Ordering, syncscope and metadata are kept.
```llvm
; before
%old = atomicrmw sub ptr %p, i32 1 syncscope("agent") monotonic
; after
%old = atomicrmw add ptr %p, i32 -1 syncscope("agent") monotonic
```
This benefits AMDGPU, for example: https://godbolt.org/z/39xsYro3o
[SeparateConstOffsetFromGEP] Drop poison-generating flags from cloned instruction in `applyCasts` (#233419)
This generalizes 2d3167f8d86ca9bdaff44cf839488c5a513f5583 by dropping
`nneg` from a cloned `zext`, while redistributing the cast over the
operands of the binary operator it was applied to.
[mlir][tosa] Fix tosa-to-linalg assertion on rescale with an output wider than 32 bits (#233508)
The rescale lowering does its math in i32 and then saturates to the
output type, so it only works for outputs up to 32 bits. That assumption
was only checked with an assert inside the linalg.generic body builder.
The op verifier accepts any integer output type, so a tosa.rescale with
an i64 (or i48) result passes verification and then crashes the pass:
```
TosaToLinalg.cpp:1952: Assertion `outBitWidth <= 32 && "Unexpected output zeropoint bitwidth"' failed.
```
Check the output element type up front, next to the other early checks
in RescaleConverter, and decline to match when it is not an integer type
of at most 32 bits. The pass then reports "failed to legalize operation
'tosa.rescale'" like it already does for the other unsupported
configurations. Inputs wider than 32 bits keep lowering as before.
Fixes #224020
[LLDB] Expose and display GDB remote register union values (#224147)
- Builds Clang union types from parsed GDB target description metadata.
- Supports nested unions, union/vector combinations, pointer-sized
members, and validated Clang type layouts.
- Exposes union members through SBValue children, expression paths, and
typed SBData.
- Adds typed register read output and member paths while preserving
explicit format overrides.
- Rejects malformed and out-of-bounds register paths.
GDB XML reference:
https://sourceware.org/gdb/download/onlinedocs/gdb.html/Target-Description-Format.html
```
(lldb) register info u0
Name: u0
Size: 16 bytes (128 bits)
In sets: General Purpose Registers (index 0)
[32 lines not shown]
[LoongArch] Compute known bits and sign bits for BSTRINS/BSTRPICK
BSTRINS and BSTRPICK are formed early by DAG combines, so the generic
known-bits and sign-bits analyses see them as opaque target nodes. When
such a value is live out of a block, its LiveOutInfo is lost and PHIs
merging it can no longer prove that the value is already sign- or
zero-extended, leaving redundant addi.w/bstrpick.d behind.
This is common in Rust code decoding UTF-8, e.g. `str::chars().rev()`,
where the multi-byte path assembles the code point with bstrins.d and is
merged with the ASCII byte loaded by ld.b before an i32 compare.
rustc-perf svg-parse-1 on LA664: instructions -2.4%, cycles -1.7%.
[RISCV][P-ext] Support Packed Multiplication with Widening Horizontal Addition intrinsics (#232612)
[RISCV] Support Packed Multiplication with Widening Horizontal Addition intrinsics
Add LLVM intrinsics and codegen support for packed multiplication with
widening horizontal addition defined in the RISC-V P extension specification:
https://github.com/riscv/riscv-p-spec/blob/master/P-ext-intrinsics.adoc#packed-multiplication-with-widening-horizontal-addition
Co-authored-by: Craig Topper <craig.topper at sifive.com>
Consolidate internal dataset checks
## Problem
Three separate checks decided whether a dataset was internal and they disagreed. `has_internal_path` matched the top-level child exactly, `is_internal_dataset_name` used a substring match and was the only one aware of `.truenas_containers`, and `internal_datasets_filters` used its own substring filters with a trailing slash that missed `ix-applications` itself. As a result user datasets like `tank/ix-apps-old` were hidden and refused, creates under `.truenas_containers` left orphans that could not be deleted, destroying such datasets skipped key cleanup and leaked encryption key rows, container datasets could be destroyed or rolled back through `zfs.resource`/`pool.snapshot`, legacy `ix-applications` could not be deleted, and filesystem permission calls and local replication targets accepted internal datasets.
## Solution
- **Single source of truth**: `has_internal_path` is now the only check. `.truenas_containers` is internal, legacy `ix-applications` is visible at the top level only so users can delete it, and the substring-based checks are removed. ZFS destroy events use the same check, which fixes the key row leak.
- **Containers**: container create, image pull, rename and migration pass `bypass` for their writes. `zfs.resource.rename` gains a private `bypass` field for this, and the image clone goes through the public `zfs.resource.snapshot.clone` so the rootfs still gets mounted.
- **Pool import**: the container dataset mountpoint repair queries the dataset by explicit path since it no longer shows up in the root listing.
- **Snapshot tasks**: existing tasks on now hidden datasets stay editable as long as the dataset is unchanged.
- **Guards**: `filesystem.setperm`, `chown`, `setacl` and `mkdir` refuse paths backed by internal datasets when called over the API, while internal callers such as app ix-volume ACLs keep working. Replication tasks refuse local targets inside internal datasets.
Use an explicit bypass option for filesystem.setacl
## Problem
The internal dataset guard on `filesystem.setacl` was skipped for any internal caller by inferring it from `app is None` via `pass_app`, which made the exemption implicit.
## Solution
Added a private `bypass` field to `FilesystemSetAclOptions` and use it to skip the guard instead. `add_to_acl` passes it for app ix-volume ACLs, and `setacl` no longer needs `pass_app`.
Merge tag 'vfs-7.4-rc1.sync_close' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull file closing updates from Christian Brauner:
"This makes closing files synchronous for close_range(), exec and exit.
Since fput() was switched to task work every final __fput() of an
exiting task is queued on task work and run from exit_task_work().
exec and close_range() do the same. For a task with a large descriptor
table that is a cmpxchg() and a TIF_NOTIFY_RESUME test-and-set per
file plus a list entry for any later task_work_cancel() to search
under pi_lock, and then a second pass over every struct file that
isn't cache hot anymore by then. Oleg and Neil have pointed this out
over the years.
close_files(), close_range() and close-on-exec now flush and put each
file inline the way close(2) does. Kernel threads aren't affected.
They share init_files which init_task pins forever so their
exit_files() never drops the last reference, and their fput() keeps
punting to a workqueue. The one place that could put a table from a
[58 lines not shown]
Merge tag 'vfs-7.4-rc1.shared.super' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull superblock updates from Christian Brauner:
"This renames vfs_get_super() to get_tree_super() and exports it so a
filesystem that needs its own superblock matching policy can reuse it
instead of open-coding sget_fc() plus fill_super().
erofs uses it to share a superblock between file-backed mounts"
* tag 'vfs-7.4-rc1.shared.super' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
fs: rename vfs_get_super() to get_tree_super() and export it
[libc][regex] Add 256-bit ByteSet and '.' wildcard (#233561)
Representing wildcards and bracket expressions as a 256-way alternation
of Literal nodes would exhaust ExprPool and blow up derivative step
time. At the same time, storing a 32-byte cpp::bitset<256> inline inside
Expr would increase every AST node from 16 bytes to 40 bytes.
Add ExprKind::ByteSet backed by a deduplicated cpp::span<ByteSet>
side-table in ExprPool, keeping sizeof(Expr) at 16 bytes. Normalise
0-bit and 1-bit sets in ExprPool::make_byte_set to EmptySet and Literal
so single-byte character classes share the same canonical AST node as
plain literals, and wire the '.' wildcard in parse_ere and derivative.
Also simplify BucketProber and the ExprPool lazy-initialisation guards.
Against the external compliance suites in REG_NOSUB mode, this passes
21/456 tests (+1) in the Henry Spencer suite and 25/202 ERE tests (+3)
in Glenn Fowler's AT&T testregex basic.dat suite.
Assisted-by: Automated tooling, human reviewed.
Use an explicit bypass option for filesystem.setacl
## Problem
The internal dataset guard on `filesystem.setacl` was skipped for any internal caller by inferring it from `app is None` via `pass_app`, which made the exemption implicit.
## Solution
Added a private `bypass` field to `FilesystemSetAclOptions` and use it to skip the guard instead. `add_to_acl` passes it for app ix-volume ACLs, and `setacl` no longer needs `pass_app`.
[AMDGPU] Add a WAR stall for DS loads in the coexec scheduler
Add a WARVdst stall cost to the coexec scheduler for DS loads on gfx1250.
For each WMMA or VALU that reads a VGPR the load writes, found through the
load's anti-dependences, the load is stalled until four times the reader's
blocking cycles after the reader.
Co-authored-by: Jeffrey Byrnes <jeffrey.byrnes at amd.com>
[clang] Make SARIF better handle diagnostic about unknown argument (#233241)
`SARIFDiagnosticPrinter::HandleDiagnostic` optimistically assumes that
its diagnostic renderer (`SARIFDiag`) is always available, but the
assumption doesn't hold when driver is parsing arguments and emits
unknown argument diagnostic. There is a FIXME to handle diagnostics in
this limited mode, but the short-circuit `return` is placed too late,
which makes assertion builds crash.
See `TextDiagnosticPrinter::handleDiagnostic` for additional context:
https://github.com/llvm/llvm-project/blob/42ac09cebaad223f14f4c3052bcd5d6d25be0f3f/clang/lib/Frontend/TextDiagnosticPrinter.cpp#L131-L150
Fixes #233228
---------
Co-authored-by: Kazu Hirata <kazu at google.com>
Co-authored-by: Corentin Jabot <corentinjabot at gmail.com>
[libc++] Mark LWG4460 as Nothing To Do (#232252)
LWG4460 only adds a missing Throws: element to the last variant
constructor. libc++ already has the correct behaviour, so no code
changes are required.
Closes #189836
Merge tag 'vfs-7.4-rc1.shared.net-next.pidfd' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull pidfd updates from Christian Brauner:
"This adds thread specific pidfds to af_unix sockets.
SO_PASSPIDFD and SO_PEERPIDFD hand out a pidfd for the thread-group
leader. A coredump server on the coredump socket can't get a handle on
the thread that took the signal and is writing the dump, and anything
doing per-thread authentication has the same problem. The sending and
the connecting thread are recorded in addition to the thread-group
leader and sk_peer_pid becomes an array indexed by pid type.
SO_PASSPIDFD_THREAD works like SO_PASSPIDFD but delivers an
SCM_PIDFD_THREAD cmsg for the sending thread. Both options are
independent so a receiver can ask for both. On SOCK_STREAM sockets
recvmsg() only stops merging data at a thread boundary when the
receiver asked for a thread pidfd. SO_PEERPIDFD_THREAD returns a pidfd
for the thread that called connect(), listen() or socketpair(). pidfs
records the coredump on the dumping thread's struct pid too so its
[14 lines not shown]
[clang][bytecode] Fix `Pointer::getLifetime()` for non-primitive array elements (#232605)
This code path is not reached for pointers to non-primitive array
elements in regular evaluation, but we do call `getLifetime()` for
random pointers in `__builtin_is_within_lifetime`.