[mlir][reducer] Delete the temp files of failure-test.sh (#246243)
`mlir/test/mlir-reduce/script/failure-test.sh` says its temp files are
"automatically deleted after the script's execution", but nothing
deletes them. Every run leaves `/tmp/stdout.XXXXXX` and
`/tmp/stderr.XXXXXX` behind. The reducer calls this script once per
reduction so the leak adds up quickly.
This PR adds a `trap ... EXIT` right after `mktemp` calls so both files
are removed however the script exits (exit 0 or exit 1). The script's
logic is unchanged.
[mlir][vector] Prove all-false masks with value bounds (#243127)
This PR extends the all-true handling in `eliminate-vector-masks` to
masks that can be proven all-false.
This was found while compiling a
[FlagGems](https://github.com/flagos-ai/FlagGems) batched matmul for
SME. A 4x4 output tile was lowered to four column subtiles, with 12 of
16 FMOPA instructions in each peeled K block fully masked off. The mask
bounds included expressions such as `4 - 4*vscale`, which the pass did
not resolve, so more instructions were emitted than necessary.
For example, given `empty-mask.mlir`:
```mlir
func.func @empty_mask() -> vector<[4]xi1> {
%c4 = arith.constant 4 : index
%vscale = vector.vscale
%width = arith.muli %vscale, %c4 : index
%bound = arith.subi %c4, %width : index
[29 lines not shown]
[AArch64] Implement ACLE intrinsics for FPv2 SVE min/max instructions
ACLE PR: https://github.com/ARM-software/acle/pull/480
Implements the following intrinsics:
- svmaxmg / svminmg
- svmaxinm / svmininm
- svmaxmginm / svminmginm
Includes f16, f32, and f64 types, _m, _z, and _x predication and _n variants
AI assistance: Codex used for generating test cases
[clang] Add codegen regression test for friend function template (#231022)
The reproducer from #89400 crashed in IR generation because the friend
template definition was instantiated in the wrong template context,
leaving `foo<U>{}` dependent. #125266 fixed this but the case was not
covered by a test.
The test is in CodeGenCXX because clang 19 accepts the reproducer with
`-fsyntax-only` and only crashes when emitting IR.
Fixes #89400
interfaces: ifctl: remove eval and hash interface names for variable use
Simplify the export and print and use a md5 checksum. We could still
return garbage names to the caller, but that's only because they do
exist and FreeBSD virtually has no restrictions on the interface name
except when tools prohibit something due to implementation choices.
Reported by: squirt1e, outis, atum (MiniMax Cyber)
[CIR][AMDGPU] Add support for __builtin_amdgcn_log_clampf (#244000)
Adds CIRGen support for `__builtin_amdgcn_log_clampf`, also adds CIR and
LLVM IR test coverage in
`clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip`.
Part of #241525
Signed-off-by: Harshit Jha <harshitiszz23 at gmail.com>
Co-authored-by: Ayokunle Amodu <ayokunle321 at gmail.com>
Add new section to Building.md
Removed the now-ignored option from the bootstrap-build config example.
Created a new section dedicated to omptest and how to make it
installable.
[OpenMP][omptest] Do not install an ompTest that embeds LLVM's GoogleTest
The GTest-based ompTest embeds LLVM's vendored GoogleTest objects, but LLVM
installs no GoogleTest headers, and the installed OmptTesterGoogleTest.h
includes "gtest/gtest.h". Users of the installed package therefore compile
against whichever GoogleTest their system provides, which need not declare the
testing::internal API the library exports. That API carries no compatibility
promise -- MakeAndRegisterTestInfo() takes its test suite name as const char *
in the copy LLVM vendors and as std::string in later releases -- so the
mismatch surfaces as an undefined symbol when the user links, far from its
cause. The package config cannot express the requirement, because it is not a
version but the exact API generation vendored when the library was built.
Decline to install that configuration and say why. The standalone and
system-GoogleTest builds carry no vendored GoogleTest and remain installable.
Warn rather than error, for now. A build that asks for an installed ompTest
and gets a GoogleTest-based one is asking for something undeliverable, which
would justify a hard failure, but erroring immediately breaks every such build
[8 lines not shown]
[OpenMP][omptest] Add LIBOMPTEST_USE_SYSTEM_GTEST
The GTest-based ompTest embeds LLVM's vendored GoogleTest, whose headers LLVM
does not install. A consumer of the installed package therefore compiles
against whichever GoogleTest it has, which need not declare the same
testing::internal API the library exports, and the package config has no way to
state the requirement.
Add an option to build against the system GoogleTest instead. Library and
consumer then resolve the same gtest/gtest.h, so the dependency becomes an
ordinary one: GTest::gtest is linked PUBLIC and omptest-config.cmake calls
find_dependency() with the version the library was built against.
Note the resulting asymmetry. The vendored build embeds GoogleTest
unconditionally and exports its symbols, so consumers get GoogleTest for free;
a system-GoogleTest build embeds nothing and consumers link it themselves.
Only valid where the system GoogleTest matches this build's C++ standard
library and RTTI setting, since LLVM compiles the vendored copy with
[8 lines not shown]
[CIR][AMDGPU] Implement __builtin_amdgcn_ds_append and __builtin_amdgcn_ds_consume (#244656)
Adds CIRGen support for `__builtin_amdgcn_ds_append` and
`__builtin_amdgcn_ds_consume`. Adds CIR and LLVM IR test coverage in
`clang/test/CIR/CodeGenHIP/builtins-amdgcn.hip`.
Part of #241525
ntfs: Fix ntfs_readdir() to avoid stack overflow
The readdir name conversion in ntfs_readdir() never validates
ie_fnamelen against the destination: it is an attacker-controlled u8
taken straight from the mounted image, and the loop writes into the
256-byte stack buffer convname[] with no bound on the write index. On
the default mount NTFS_U28 resolves to ntfs_u28(), whose conversion
table cells hold sign-extended chars, so every name wchar >= 0x80
makes the loop emit two bytes per character. With ie_fnamelen = 255
the write index j reaches 510 and the loop writes 255 bytes past
convname[], overwriting five saved registers, rbp and the return
address (the kernel has no stack canary on this path). A single
getdents(2) on a mounted crafted NTFS image by any user with read
access to the mount then controls the return address; verified to
give uid 0 on master.
Fix ntfs_readdir() to check the buffer space and thus avoid stack
overflow.
[12 lines not shown]
drm: return a positive errno from drm_mmap_single()
drm_mmap_single() is the d_mmap_single method of drm_cdevsw. On devices
with a TTM buffer object device (radeon, amdgpu) it returned the result
of ttm_bo_mmap_single() unchanged: ttm_bo_mmap() gives the negative
errno of the Linux code (-EINVAL, -EACCES and -EPERM, which is ERESTART
here), while the DragonFly part of ttm_bo_mmap_single() assigns a
positive EINVAL.
Convert the result with drm_cdev_errno() like the other methods;
positive values pass through unchanged.
GitHub-PR: https://github.com/DragonFlyBSD/DragonFlyBSD/pull/71
drm: convert errors at the cdevsw boundary
drm_open(), drm_read() and drm_ioctl() are the d_open, d_read and
d_ioctl methods of drm_cdevsw, but their bodies are Linux code that
returns a negative errno (and the amount read for drm_read()), while the
cdev layer expects zero or a positive errno. They were adapted one
function at a time: drm_ioctl() negated the handler results, but the
Linux syncs left -ENODEV, drm_ioctl_permit(), drm_open() and drm_read()
returning negative values, which e9a3645661, 4d09039497 and d23da7dd7d
fixed one by one.
Keep the drm_*() functions in the Linux convention and convert the
result once, in dev_ops wrappers in drm_drv.c: a negative errno becomes
positive, -ERESTARTSYS becomes EINTR, and a positive amount read from
drm_read() becomes zero. drm_ioctl() no longer negates the handler
results or maps ERESTARTSYS itself, and drm_read() loses its zero
return special case.
GitHub-PR: https://github.com/DragonFlyBSD/DragonFlyBSD/pull/71
[Mips] Use libcalls for constrained FP arithmetic on R5900 (#246083)
The R5900 FPU does not implement NaN and infinity, so FADD, FSUB, FMUL,
FDIV and FSQRT only use it when fast-math flags rule those out and are
libcalls otherwise. Their constrained counterparts were Legal for all
hard-float subtargets though, so constrained arithmetic on the R5900
went to the FPU unconditionally.
Make them libcalls on the R5900. The FPU also always rounds toward zero,
so it cannot follow the rounding mode that constrained operations use,
even with fast-math flags.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[wasm] Swift async ABI p3: Lower llvm.swift.async.context.addr to local 0
In functions with a swiftasync argument, the async context is in local 0.
Loads and stores through llvm.swift.async.context.addr become local.get 0
and local.set 0. In functions without a swiftasync argument, the intrinsic
returns the address of a stack slot, as on X86 without an extended frame.
The swiftasync argument also arrives in local 0, so a store through the
intrinsic would also change the argument. Await resume funclets store their
own context through the intrinsic and can then read the argument, which is
the callee's context. To keep the argument intact, WebAssemblyExplicitLocals
copies it to another local in functions that use the intrinsic.
www/wikid: update to 3.2.3
new feature(s)
background, non-blocking check is performed to check for updates (freed U): 5aa242a
bug fix(es)
pinned settings modal footer: c7d6d61
fixed some links not being recognised in the "on this day" modal: a30089f
wrapping image captions instead of truncating them: 0a6e028
[CIR] Mark calls in strictfp functions strictfp
LangRef requires every call in a function that uses constrained FP
intrinsics to be `strictfp`, at the call site or on the callee, and
LLVM checks the call, not its caller, before it folds or simplifies a
libcall. Classic codegen gets the attribute from IRBuilder's
constrained mode. ClangIR marked only the function, so at -O1 LLVM
folded `erf(1.0)` to a constant under `FENV_ACCESS ON`.
The lowering now maps the CIR `strictfp` function attribute to the
`strictfp` attribute of `llvm.func` instead of a `passthrough` entry.
After the conversion to the LLVM dialect, it sets `strictfp` on every
`llvm.call`, `llvm.invoke`, `llvm.inline_asm` and `llvm.call_intrinsic`
in a `strictfp` function. That covers direct and indirect calls,
invokes, inline assembly, constrained intrinsics, and the calls that
LoweringPrepare and EH lowering create. CIR does not change, `strictfp`
stays a function attribute. The marks are part of the LLVM dialect, so
they survive any route to LLVM IR.
[11 lines not shown]
[mlir][ExecutionEngine] Move the OpenMP translation dependency to the C API (#246443)
`MLIRExecutionEngine` linked `MLIROpenMPToLLVMIRTranslation` although
the execution engine never uses OpenMP. Every C++ JIT user therefore
pulled in the OpenMP dialect.
The only user of the translation is the C API, which registers it since
db7cc0348c9a.
Link it from `MLIRCAPIExecutionEngine` instead.
Co-authored-by: Claude <noreply at anthropic.com>
[mlir][LLVM] Add strictfp to llvm.func and the call ops (#246250)
In a function that uses constrained floating-point intrinsics, LLVM
requires every call to be `strictfp`, at the call site or on the callee,
and its folders check the call before they fold or simplify a libcall.
The LLVM dialect could mark only the function, through `passthrough`, so
a frontend lowering to it had no way to mark its calls.
This adds a `strictfp` unit attribute to `llvm.func`, `llvm.call`,
`llvm.invoke`, `llvm.inline_asm` and `llvm.call_intrinsic`, the way the
dialect already models `convergent`, `no_unwind` and `will_return`.
Export turns it into the LLVM `strictfp` attribute and import reads it
back, so a `strictfp` function no longer lands in `passthrough`; the
tests cover round-trip, export and import for each op. Calls of the
constrained intrinsic ops already get the attribute from IRBuilder.
Other named intrinsic ops have no call-site attributes.
The inliner now refuses a callee marked `strictfp` and no longer looks
for `strictfp` in `passthrough`.
Assisted-by: Claude Code (Opus 5.5).