[X86] Enable SlotIndexes compaction by default
Compacting SlotIndexes before greedy allocation drops the entries of
erased instructions, so live range sizes and instruction distances
reflect the code being allocated rather than how much was erased
before it. AMDGPU has done this since #235806; do the same for X86.
Codegen changes only through allocation: no new crashes, verifier
errors or allocation failures in the lit suites, including
EXPENSIVE_CHECKS, and a stage-2 build of LLVM, clang and lld with
-verify-machineinstrs passes its own tests. On llvm-test-suite at -O3,
spills drop 0.3% and .text 0.06%, with compile time unchanged.
Most test updates are regenerated checks. misched-matmul now inserts
20 spills instead of 24. live-debug-vars-stale-slotindexes.mir gets
one more use of %27 so that accumulate_fit still reaches the stale
index path it was written for. reloc-opt.ll gets an NF add that keeps
its source live, because compaction compresses the existing one to the
legacy form. inline-spiller-hoist-folded-copy.ll gets four empty asm
[2 lines not shown]
[AMDGPU][GlobalISel] Recognize canonical update.dpp results (#247744)
Teach GlobalISel to recognize canonical `llvm.amdgcn.update.dpp` results
so the post-legalizer combiner can remove redundant `G_FCANONICALIZE`
instructions.
The source must be canonical. If either mask is partial or zero fill is
disabled, the old value must also be canonical because some lanes can
retain it.
Merge tag 'uml-fixes-7.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux
Pull uml fixes from Johannes Berg:
- vector network driver (NAPI, hardening)
- rust module loading
- FD initialization in time-travel messages
* tag 'uml-fixes-7.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux:
um: time-travel: don't use uninitialized fds from START ACK
um: vector: Don't clean up NAPI that was never set up
um: vector: Possible underflow and races fixes
rust: arch/um: Fix loading Rust modules
[AMDGPU] Scalarize packed FP math with fabs sources and update cost model (#236584)
Packed math instructions (v_pk_add, v_pk_mul, v_pk_fma, v_pk_min_num and
v_pk_max_num) have no abs source modifier, so an fabs feeding one must
be materialized as a real and per element. Scalarizing the packed operation
instead lets the abs fold back into a source modifier, trading the packed
instruction plus N ands for N scalar instructions.
Update the TTI cost model to match: fabs stays free, and a packed
f32/f64 fadd/fsub/fmul, fma/fmuladd or f64 minimumnum/maximumnum with a
single-use fabs source (looking through fneg) is priced as one scalar instruction
per element instead of a packed instruction. When queried by the SLP vectorizer, the
operands of the scalar instruction representing the lanes are checked.
Fixes: LCOMPILER-2919
---------
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
powerpc: fix single stepping across signal delivery and fork
PT_STEP sets MSR[SE] and trap() clears it again when the trace trap
comes in, but the rest of the kernel treated it as a bit a thread can't
change, which broke stepping in three places.
sendsig() kept it set for the signal handler, so the debugger got a
SIGTRAP on the handler's first instruction. This is what
ptrace__PT_STEP_with_signal in ptrace_test trips over. Clear it for the
handler, like amd64 does with PSL_T.
The context saved for the handler still has it, but set_mcontext()
refused a context whose MSR[SE] no longer matched the frame, so
sigreturn(2) failed and the process exited as soon as the handler
returned. Let a context carry MSR[SE].
cpu_fork() copied it into the child, which nobody traces, so a fork(2)
done while stepping killed the child with SIGTRAP. Clear it there.
[3 lines not shown]
[lldb] Escape non-printable characters in thread and queue names (#248151)
The inferior sets thread and queue names and can put any bytes in them.
The thread.name and thread.queue format entities printed them verbatim,
so a name could send control sequences to the terminal.
Escape both with StringPrinter, as string summaries already do.
Printable UTF-8 is unchanged, while double quotes and backslashes are
escaped too.
rdar://187191695
Assisted-by: Claude
[Attributor] Fold lookupAAForImpl into lookupAAFor
Also use isAllowed in checkAndQueryIRAttr.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
ZTS: mmp_on_off must not leave a suspended pool behind
mmp_on_off runs with zfs_multihost_interval=100 and the default ten
fail intervals, so MMP suspends the pool when no MMP write has
succeeded for one second. In CI one MMP write took 1.25 s:
WARNING: MMP writes to pool 'testpool' have not succeeded in
over 1109 ms; suspending pool
A pool suspended by MMP can't be cleared on its own host (#19033), so
cleanup failed ("pool is imported on a different host") and left it
imported. The tests after it failed on their zpool create, and
mmp_on_zdb's cleanup destroyed it: zpool destroy -f unmounts the root
dataset, and the unmount waits in zil_commit() for the suspended pool
forever, so the CI job ran into its 300 minute timeout.
mmp_clear_suspended() should have stopped that destroy, but it asks
zpool for the pool's health, and once a cleanup has removed the
hostid, zpool reports the hostid mismatch (ONLINE), not the
[12 lines not shown]
[bazel] Enable include scanning (#248169)
This scans source files to determine what headers need to be inputs to
their compilation actions. This massively reduces network traffic when
using remote execution. In my testing a full build without remote
execution transfers ~12gb of source files, and with include scanning it
transfers ~1gb
This is only enabled for first party code. If a file isn't included
because of its include not being regexable, for example if it's
included via a define:
```
#define FOO "bar.h"
#include FOO
```
It can be added to `additional_compiler_inputs` in order to get scanned.
If there's a larger problem individual targets can set `features =
["-cc_include_scanning"]`
[WPD] Don't treat a call that passes a vtable slot as a virtual call (#245870)
findCallsAtConstantOffset recorded every call or invoke that used the
function pointer loaded from a vtable slot, including one that only
passes it as an argument. Devirtualizing such a call hit the
"devirtualizing direct call?" assertion in applySingleImplDevirt or,
without assertions, rewrote the callee or folded the result of an
unrelated direct call.
This happens when hot/cold splitting outlines the indirect call into a
function that takes the loaded slot as an argument; the WPD run for
-fdevirtualize-speculatively comes after it.
Record only calls whose callee is the slot pointer, and treat any other
call use as a non-call use.
Assisted-by: Claude Code
[flang-rt][cuda] Add reduce.cpp to the supported files (#248183)
Add `reduce.cpp` to the list of supported files for the CUDA build so we
can support `reduce` in compute region.
```
!$acc parallel loop copyin(a) copyout(r)
do i = 1, 8
r(i) = reduce(a(:, i), iadd)
end do
```
NAS-145419 / 28.0.0-BETA.1 / Update `/etc/hosts` on hostname change (#20303)
Fixing https://github.com/truenas/middleware/pull/20180 exposed this
latent bug.
While I am here, increase tests coverage.
NAS-145549 / 28.0.0-BETA.1 / Fix infinite loop in path_in_ctldir() on paths starting with // (#20354)
`path_in_ctldir()` can enter an infinite loop when a path starts with
exactly two slashes, such as `//mnt/tank/share`. This can happen when a
user accidentally enters an extra leading slash in an SMB share path or
supplies such a path through the API. Linux treats `//` like `/`,
allowing the path to pass the earlier existence checks.
The loop assumes that the root is always `/`, but `pathlib` preserves
exactly two leading slashes. Since the parent of `//` is itself,
terminate the loop when `path == path.parent` instead of comparing
against `/`.
Added a regression test, reproduced the hang against master and verified
the fix on a TrueNAS VM.
[clang][deps] Add dependency scanning support for #embed
Teach the dependency directive lexer to scan #embed like we do for #include,
and the dependency scanner to record the dependencies from #embed and
__has_embed. Modules work by virtue of the embedded files being input files to
the scanner pcms. Incidentally fix the strict context hash to include embed
directories.
Claude Opuse helped with the tests.
[mlir][mem2reg][NFCI] Only scan blocks that interact with the promoted slot (#244298)
`promoteInBlock` walks every operation of every block in the slot's
region, once per promoted slot, so promotion cost grows with slots times
operations even when each slot is used in a few blocks.
Only blocks holding a blocking use or a region to promote can read or
redefine the slot. `promoteSlot` now collects those blocks, and
`promoteInBlock` forwards the reaching definition through any other
block without visiting its operations. The interface docs now state two
properties every in-tree implementation already has and this relies on:
`storesTo` implies a blocking use, and `setupPromotion` does not move
operations across blocks.
`mlir-opt --mem2reg`, one function with 6,000 allocas over 3,000
diamonds (9,001 blocks), median of 5 runs, byte-identical output:
| Input | Before | After |
|--------------|---------|--------|
[4 lines not shown]
[clang] Rebuild implicit modules when #embed files change
Files embedded are intentionally not sloc entries, so explicitly track the
embedded files and add them to the AST's input files in ASTWriter. This
ensures implicit modules are rebuilt correctly when they change.
Claude Opus helped with the tests.
[lldb][Windows] Invalidate the ARM64 register cache when a thread runs (#248084)
Since #197385, `NativeRegisterContextWindows_arm64` caches the thread's
`CONTEXT`.
Stops and register writes drop the cache but not resumes. Therefore,
exception handlers in `NativeProcessWindows` that read registers before
calling `StopThread()` get stale values.
This patch drops the cache when a thread resumes, and when a debug
exception arrives for it.
This fixes the flakes in `TestMultipleBreakpoints`.
NAS-145549 / 28.0.0-BETA.1 / Fix infinite loop in path_in_ctldir() on paths starting with // (#20354)
### Motivation
`path_in_ctldir()` can enter an infinite loop when a path starts with
exactly two slashes, such as `//mnt/tank/share`. This can happen when a
user accidentally enters an extra leading slash in an SMB share path or
supplies such a path through the API. Linux treats `//` like `/`,
allowing the path to pass the earlier existence checks.
### Description
The loop assumes that the root is always `/`, but `pathlib` preserves
exactly two leading slashes. Since the parent of `//` is itself,
terminate the loop when `path == path.parent` instead of comparing
against `/`.
### Testing
Added a regression test, reproduced the hang against master and verified
the fix on a TrueNAS VM.
um: time-travel: don't use uninitialized fds from START ACK
When the kernel connects to an external time-travel controller, it
expects the ACK of its UM_TIMETRAVEL_START message to carry two file
descriptors: the shared memory area and a log file. It reads them with
os_rcv_fd_msg() into an uninitialized on-stack array, and then uses
both array elements whenever the message itself was received in full.
os_rcv_fd_msg() leaves the array untouched if the message came without
an SCM_RIGHTS control message. That is what any controller that does
not implement the shared memory extension sends, which the protocol
allows: such controllers are why the kernel falls back to message
based scheduling. In that case the kernel passes stack garbage to
mmap() and then close()s both values.
With CONFIG_INIT_STACK_ALL_ZERO, the default where the compiler
supports it, the garbage is 0, so the kernel closes its own stdin. The
next file descriptor it opens, the epoll instance used for IRQs, then
becomes fd 0:
[19 lines not shown]
um: vector: Don't clean up NAPI that was never set up
vector_net_open() calls vector_net_close() on any failure once
vp->fds is set, and vector_net_close() then runs napi_disable() and
netif_napi_del() unconditionally. But the NAPI context is only added
and enabled after build_transport_data() and the header buffer
allocations, so a failure in any of those disables a NAPI context that
was never added. napi_disable() locks n->dev, which is still NULL:
ip link set vec0 up (vec0:transport=gre,...,rx_key=1, no tx_key)
Kernel panic - not syncing: Kernel mode fault at addr 0x910
napi_disable+0x4e/0x9e
vector_net_close+0x2b9/0x87d
vector_net_open+0x105d/0x106f
__dev_open+0x244/0x334
Record in vp->napi_enabled whether vector_net_open() got as far as
enabling NAPI, and only disable and delete it in vector_net_close()
when it did. NAPI is still enabled only after the queues and buffers
[10 lines not shown]