[lldb] Let the process compare call frame addresses (#243488)
StackID::IsYoungerThan asks Process::CompareCFAs before applying the
usual logic
Stack:
- #243487
- #243488
- #243535
[AMDGPU] Fix LDS externalization for object linking
With object linking, the backend converts LDS variables and named barriers to
external declarations, and the linker allocates them. There are two cases that
could potentially make invalid IR or cause a crash:
- LDS or a named barrier with vague linkage, for example a shared variable in an
inline function, is in a comdat. The external declaration kept the comdat, and
the verifier rejected the module: "Declaration may not be in a Comdat!".
- Alloca promotion to LDS runs after LDS lowering. The LDS variable that it
created stayed an internal definition, and the asm printer asserted: "LDS
definitions should have been externalized when object linking is enabled".
This PR fixes both of them.
This PR was assisted by AI but I reviewed all the changes.
[Mips][nanoMIPS] Add initial nanoMIPS target support (#223032)
nanoMIPS is a code-size-optimized ISA from MIPS Technologies with 16-,
32- and 48-bit instructions, its own ELF machine type (EM_NANOMIPS,
249), relocation set and ABI (P32). It is implemented as a subtarget of
the existing Mips backend, following the MIPS16 and microMIPS precedent.
This first batch adds the target triple, ELF and relocation support,
basic subtarget support, register definitions, the P32 ABI, instruction
definitions and encoding tests. Assembly/disassembly, CodeGen, clang and
LLD follow in later batches; until the AsmParser lands, instructions are
covered by .mir tests.
RFC:
https://discourse.llvm.org/t/rfc-upstreaming-nanomips-support-to-llvm/91713
Assisted-by: Claude
---------
[3 lines not shown]
[clang][CodeGen] Restore BoundsSafety SanitizerHandler value to 0x19 (#243546)
#239729 inserted ReturnAlignmentAssumption before BoundsSafety in
LIST_SANITIZER_CHECKS, shifting BoundsSafety from 0x19 to 0x1a. The
handler value is the llvm.ubsantrap kind, and 0x19 is part of the
-fbounds-safety trap ABI (`brk #0x5519` on arm64, `ud1l 0x19(%eax),
%eax` on x86_64) that debuggers decode.
Move ReturnAlignmentAssumption after BoundsSafety, add a static_assert
pinning BoundsSafety to 0x19, and note that new checks must be appended
at the end of the list. ReturnAlignmentAssumption becomes 0x1a, so
update the tests from #239729 that check its trap kind.
[DAGCombiner] Mark uint_to_fp widened through trunc nuw as nneg (#242916)
The source of a trunc nuw fits in a strictly narrower type, so it is
non-negative. Without nneg x86 lowers the widened conversion through the
unsigned i64 expansion.
Assisted-by: Claude Code Opus 5.5
[X86] Mark vXi64 int to fp undesirable without AVX512DQ (#242914)
Without avx512dq there is no vector conversion from i64 elements to f32
or f64, so widening the conversion of a source truncated with nsw or nuw
back to i64 makes it slower.
avx512fp16 converts i64 elements to f16 directly, so the widening folds
now pass the node and the check sees the result type.
Assisted-by: Claude Code Opus 5.5
Always pass through Python3_EXECUTABLE to external projects (#243267)
#227660 gated all `DEFAULT_PASSTHROUGH_VARIABLES` in
`llvm_ExternalProject_Add` on `"${ARG_TARGET_TRIPLE}" STREQUAL
"${LLVM_TARGET_TRIPLE}"` so host target libraries (such as
`ZLIB_LIBRARY`, `zstd_LIBRARY`, and `Python3_LIBRARIES`) do not leak
into cross-compiled runtime subprojects.
However, `Python3_EXECUTABLE` is a host build tool rather than a target
library. Dropping it causes cross-compiled runtime external projects
(such as baremetal `runtimes-armv6m-none-eabi` building `llvm-libc`
headers via `hdrgen`) to re-run `find_package(Python3)` from `PATH`
instead of inheriting the configured host interpreter, failing when the
`PyYAML`-equipped Python was specified via `-DPython3_EXECUTABLE` rather
than `PATH`.
Additionally, check normalized `"${target_triple}"` instead of raw
`"${ARG_TARGET_TRIPLE}"` so callers of `llvm_ExternalProject_Add` that
omit `TARGET_TRIPLE` (falling back to `${LLVM_DEFAULT_TARGET_TRIPLE}`
above) still receive the native library passthrough variables.
[libc][AArch64] Support LFI in setjmp and longjmp (#238092)
Skip saving and restoring LFI-reserved registers (x25, x27, and x28) in
AArch64 setjmp and longjmp when building for LFI (`__LFI__`).
[MachineLICM] Track peak register pressure when hoisting
The pressure check in MachineLICM only looks at the estimates saved in
BackTrace. These record pressure at block boundaries, so they can miss an
earlier peak in the current BB or an ancestor BB. If pressure falls before the
candidate, the check can allow it to move even though its def then needs to stay
live across that earlier peak. This can push pressure beyond the limit and cause
spills.
This PR adds PeakPressure alongside RegPressure and saves the previous peak with
the existing boundary estimate in BackTrace. The pressure check considers the
current BB's peak and both saved estimates. Normal hoists adjust the current and
saved peaks, and scope exit restores the previous peak. Preheader scanning skips
peak updates and seeds the starting pressure from its final estimate.
Fixes LCOMPILER-3233.
This PR was assisted by AI but I reviewed all the changes.
[CodeGen] Honor -stress-regalloc in register pressure limits
computePSetLimit falls back to the target pressure limit when the reserved
register weight is at least that limit. This avoids underflow, but loses
allocation restrictions such as -stress-regalloc.
Bound this fallback by the remaining allocatable register weight. The
allocatable count already includes the stress limit. Keep the existing
subtraction when it leaves a positive limit and the zero-allocation
fallback.
Add an AMDGPU MIR test for stress limits that block or allow hoisting.
Add an X86 MIR test to check that a stress value which clips no allocation
order preserves the normal pressure adjustment and hoisting result.
Update the affected AMDGPU stress test.
Validation: all 51 stress-regalloc tests pass with MachineLICM unchanged.
With the stacked MachineLICM change, the full LLVM suite has 80,791 passes
and no unexpected failures.
[2 lines not shown]
[lldb] Let ProcessWasm order the call frame addresses of Wasm frames
UnwindWasm now counts frames up from the outermost one, in the invalid Wasm
address space, which has no memory, and ProcessWasm::CompareCFAs orders them, so
a synthetic address can neither decrease below zero nor fall inside linear
memory.
[lldb] Let the process compare call frame addresses
StackID::IsYoungerThan asks Process::CompareCFAs before it assumes a stack that
grows down; the default has no opinion.
[lldb][NFC] Pass the process to StackID::IsYoungerThan (#243487)
A following change lets the process decide how call frame addresses
order
frames.
Stack:
- #243487
- #243488
- #243535
NAS-145276 / 27.0.0 / Reject "/" in nvmet NQNs and guard configfs entry names (by bmeagherix) (by bugclerk) (#20241)
NQNs are used as directory names below /sys/kernel/config/nvmet, but
validation only checked the part before the first colon, so a hostnqn or
subnqn (or a subsystem name used to generate one) containing "/.." could
create entries outside of it.
Reject "/" and control characters in NQNs, validate subnqns generated
from the subsystem name, and check that each name is a single entry
before the kernel render uses it in a path.
Original PR: https://github.com/truenas/middleware/pull/20230
Original PR: https://github.com/truenas/middleware/pull/20237
Co-authored-by: bmeagherix <118192357+bmeagherix at users.noreply.github.com>
[LoongArch] Match BSTRINS when an OR operand is already a BSTRPICK
performANDCombine rewrites (and X, mask) into BSTRPICK, or into
(shl (BSTRPICK X, msb, lsb), lsb) for a shifted mask. When the OR is
combined after its operands, the AND operands are already rewritten.
This happens when the OR is created late, e.g. when a funnel shift is
expanded, and for any OR when the DAG combiner visits operands before
their users, as with -combiner-topological-sorting (#83422). All 8
BSTRINS patterns in performORCombine require ISD::AND, so none matches
and the OR is selected as separate bstrpick, shift and or instructions.
Add matchAndWithMask(), which matches (and X, mask) and the two BSTRPICK
forms performANDCombine produces from it, and use it in every pattern.
Both forms compute exactly the AND, so the existing checks stay valid.
In the default order this shortens the funnel shift tests. In a sample
of real-world bitcode compiled for loongarch64, 7 functions get shorter
and none longer, e.g. a byte inserted into the top of an i64 and vXi1
mask bitcasts with LSX.
[2 lines not shown]
[clang][deps] Fast path before the line-by-line walk (#239449)
`isPreprocessedModuleFile()` scans the whole source line by line,
looking for `__preprocessed_module` or `__preprocessed_import`
directives. This scan is pretty expensive.
Add a fast path by checking for the presence of the `__preprocessed_`
string. On `swiftlang/llvm-project`, a cache hit through `clang-cache`
with its default inline dependency scan drops
- from 201.4 to 189.8 ms (-5.7%) on Windows
- from 107.7 to 100.3 ms (-6.9%) on Linux
[bazel][SPIR-V] Pass -gisel-extended-llt for SPIRV GlobalISel tablegen (#243554)
Fixes d2a93dd549d0 (#240752).
Port the -gisel-extended-llt flag that #240752 added in CMake for
SPIRVGenGlobalISel.inc and SPIRVGenPreLegalizeGICombiner.inc.
Assisted-by: Gemini
NAS-145256 / 28.0.0-BETA.1 / Sync SMB pools before STCNITH so durable handles survive (#20228)
On failover, the other controller drops SMB durable handles that have
unflushed writes. Copies in progress then fail (Windows error
0x8007003B).
With SMB stateful failover on, become_passive now does this first:
- Block SMB and VIP traffic both ways.
- Run `zpool sync` on the pools that have SMB shares.
- Run `truenas_smbhad mark-synced` so the other controller keeps the
handles.
Each step has a timeout. If one fails, the rest are skipped and the
handles are dropped as before.
`failover.firewall.drop_all` gets a `replies` option for the first step.
Without it, the rules are as before.
[3 lines not shown]