[SCEVExpander] Also apply 0/poison-free expansion to URem. (#243898)
Also apply SAfeUDivMode to expanding URem in SCEVExpander, which
triggers UB on zero or poison, similar to UDiv.
The code for expanding a safe divisor is moved to a helper.
PR: https://github.com/llvm/llvm-project/pull/243898
[LV] Don't fall back on legacy cost model for unknown replicates (#243844)
In VPReplicateRecipe::computeCost we currently call getLegacyCost if we
encounter an unknown opcode, however I think the cost model here is
sufficiently complete for us to mimic the behaviour of
getInstructionCost in LoopVectorize.cpp and simply return the cost of a
mul. I tried putting a llvm_unreachable in the default case and no test
failed and I also didn't hit the error when compiling the LLVM test
suite.
[X86] Fix f64 mask encoding in demanded-elts VPERMV to VPERMILPV narrowing (#238829)
SimplifyDemandedVectorEltsForTargetNode narrows a 256-bit X86ISD::VPERMV
whose upper elements are not demanded to a 128-bit X86ISD::VPERMILPV. It
passes the VPERMV mask through unchanged. VPERMV masks hold plain
element indices, but VPERMILPD selects with bit 1 of each mask element.
So for f64, index 1 decodes as element 0, and the narrowed permute then
folds to its input.
According to Claude (I left it here as it might be helpful):
The bad narrowing is older. It became reachable after 961ab7a36967
("[SDAG][X86] Uplift pseudo fmin/fmax from X86"), which routes the x86
fmin/fmax intrinsics through ISD::PSEUDO_FMAX. I found this by reading
the code. I did not confirm it with a build bisect.
Assisted-by: Claude (Anthropic)
[X86] Lower i16 partial reductions to PMADDWD on targets without VNNI (#240904)
Part of #223374. The first commit adds the tests (NFC, #240903); the
second commit is the change.
Without VNNI, an i16 × i16 → i32 partial reduction was expanded and only
partly folded back into PMADDWD. That came to 11 instructions for a
v4i32 accumulator on SSE2, and pmulhw/pmullw sequences for v8i32. This
marks signed i16 × i16 → i32 partial reductions as Custom (512-bit only
with BWI registers, and not when PMADDWD is slow) and lowers them to
`add(acc, pmaddwd(a, b))`. The partial reduction leaves the lane
grouping unspecified. A wrap case (all four inputs 0x8000) matches
VPDPWSSD.
Instruction counts for v4i32 / v8i32 / v16i32 accumulators:
- SSE2: 11 / 16 / 36 → 2 / 4 / 8.
- AVX2: 6 / 10 / 20 → 2 / 2 / 4.
- AVX512BW v16i32: 10 → 2.
[18 lines not shown]
[mlir][ComplexToStandard] Fix intermediate result fmf in exp lowering (#243397)
When computing `complex.exp(x + iy)`, the intermediate result `exp(x)`
may overflow even though the final result doesn't. Passing the `ninf`
flag to it (and to the inf comparison) is thus incorrect, and leads to
the branch that handles the overflow case being optimized out.
[libc++abi] Remove has_path_to_static_ptr from dynamic_cast
`path_dst_ptr_to_static_ptr` already contains whether we found a path to
static_ptr, so there is no need to track it explicitly.
[AMDGPU] Preserve noclobber after acquire operations from a different addrspace
Follow-up to #219991 to address reviewer comments:
AMDGPUAnnotateUniformValues should annotate uniform global loads as
`!amdgpu.noclobber` if the memory they are reading is never clobbered (since
kernel launch) before the load is executed.
PR #219991 strengthened the logic to consider acquire operations before the
load as clobbering (because they cause stores from other threads to be observed
by the load without a data race).
This PR weakens this criterion to ignore acquire operations that don't affect
the global address space (because they don't affect what the load in question
may or may not see). This addresses the performance-relevant case of s_barriers
with LDS-only fences.
The logic is still overly pessimistic for one-as load acquires, they could also
be ignored when looking for clobbering operations.
Disclaimer: Claude gave review comments and suggestions that I addressed during
[5 lines not shown]
[AMDGPU] Extract SIAtomicAddrSpace and fence MMRA parsing from SIMemoryLegalizer (#231854)
Determining which memory accesses are ordered by a fence is already
useful in the middle-end; this PR extracts the code to do that from
SIMemoryLegalizer, so that it can be used in middle-end transformations.
So far, unexpected suffix values for the `amdgpu-synchronize-as` were
reported when they were encountered in SIMemoryLegalizer. This PR keeps
that and doesn't report them in the middle end, since that would lead to
a lot of repeated diagnostics for them.
This patch also makes the extracted toSIAtomicAddrSpace logic consistent with
isExtendedGlobalAddrSpace. That means that constant addrspaces and addrspaces
above `MAX_AMDGPU_ADDRESS` now map to `SIAtomicAddrSpace::GLOBAL` instead of
`OTHER`. This means that atomics on these addrspaces are no longer rejected by
SIMemoryLegalizer.
It also changes the lowering for volatile loads from the constant addrspaces; so
far we haven't waited directly after each such volatile load, with this change
[8 lines not shown]
gas: vax: Cherry-pick upstream commit 2722595890a
PR port-vax/59326
---
Author: Jan-Benedict Glaw <jbglaw at getslash.de>
Date: Sun Nov 15 18:36:27 2026 +0100
VAX: In PIC code, use GOT for function pointers
Use GOT references for function pointers in PIC code. Actual fix by
Rin Okuyama, initially reported for NetBSD in https://gnats.netbsd.org/59326 .
PR gas/32941
gas/
* config/tc-vax.c (md_estimate_size_before_relax): Use GOT instead of PLT.
* testsuite/gas/vax/elf-got-func.s,
* testsuite/gas/vax/elf-got-func.d: New test.
* testsuite/gas/vax/vax.exp: Run it.
[orc-rt] Add dlfcn-host APIs. (#244110)
Adds API calls that forward to the host's native dlfcn.h APIs:
* orc_rt_dlopen_host -> dlopen
* orc_rt_dlclose_host -> dlclose
* orc_rt_dlsym_host -> dlsym
* orc_rt_dladdr_host -> dladdr
* orc_rt_dlerror_host -> dlerror
These give JIT'd code a way to reach host libraries directly, bypassing
the ORC runtime, e.g. when the usual dlfcn.h names have been aliased to
the upcoming dlfcn-jit.h APIs.
The APIs are covered by unit tests, and by a regression test that checks
that JIT'd code can call them. To support the regression test, this
commit also adds:
* An orc-rt-c/ regression test directory, for tests that JIT'd code can
[5 lines not shown]
[mlir][arith] Keep only nnan on the widening in the f8E8M0FNU truncf (#243379)
The f8E8M0FNU truncf expansion extends an f16, bf16 or tf32 source to
f32 and copies the truncf's fastmath flags onto that extf. With
contract, ExtFOp::fold cancels the extf against a contract truncf that
produced the source, dropping that truncf's rounding (f32 2 - 2^-11 via
f16 gives 1.0, not 2.0). Keep only nnan on the extf.
Assisted-by: Claude
---------
Co-authored-by: Matthias Springer <me at m-sp.org>