[offload][omp] Query device info directly through liboffload
Route DeviceTy::getInfo through olGetDeviceInfo instead of the
plugin's obtain_device_info, and drop the now-unused
GenericPluginTy::obtain_device_info wrapper and its liboffload
export.
[clang][Sema] Crash due to asm labeled incomplete global register decls (#219746)
CheckAsmLabel fails to check for an incomplete type before attempting to
get the type layout. Short circuit on an incomplete type as Sema will
already reject a global with an incomplete type.
[CIR] Implement PromotableRegionOpInterface for cir.scope
Same treatment as cir.if: a slot read inside a cir.scope no longer needs
the CFG flattened before mem2reg can promote it. The scope region is
entered directly from before the operation, so it sees the reaching
definition unchanged.
cir.scope yields at most one value and may already be using it for the
scope's own result, so regions that store to the slot are refused.
Co-Authored-By: Claude Opus 5 <noreply at anthropic.com>
[CIR] Implement PromotableRegionOpInterface for cir.if
mem2reg gives up on a memory slot as soon as one of its uses lives in a
nested region whose parent op does not implement
PromotableRegionOpInterface. Since no CIR op implements it, promoting a
slot read inside a cir.if required running cir-flatten-cfg first, which
is why clang/test/CIR/Transforms/mem2reg.cir has to flatten before it can
promote anything.
Implement the interface for cir.if. Both regions are entered directly
from before the operation, so both see the same reaching definition.
A definition created inside a region has to leave the operation through
one of its results, and cir.if has none, so isRegionPromotable refuses
regions that store to the slot. Supporting those requires giving cir.if
results and is left for later.
Co-Authored-By: Claude Opus 5 <noreply at anthropic.com>
libc - Remove optimization that breaks malloc_usable_size() use cases
* The malloc implementation had an optimization meant to aid realloc()s
whereby unused portions of large memory blocks could be munmap()d.
However, lots of code uses the space returned by malloc_usable_size()
without calling realloc() to notify libc that additional space is being
used. Leading to segmentation faults.
* Original proposed solution to make malloc_usable_size() aware of a
prior munmap optimization does not completely fix the problem as excess
space may be unmapped after such calls as well as before.
* Removing the optimization and letting the pager deal with any actually-dead
excess space is the only option. So that is what we do.
Reported-by: Several people
[CIR] Reject willreturn on __declspec(noalias) attribute groups
Classic codegen never adds willreturn for NoAliasAttr. Bracket the
definition and call-site groups so a wildcard cannot hide it.
[CIR] Tighten malloc(dealloc) noalias FileCheck negatives
Unrestricted {{.*}} before ptr can swallow an incorrect return noalias,
so the following -NOT is never tested. Bracket the return-attribute
region instead.
[MLIR][Arith] Don't narrow shifts whose amount can exceed the target width (#218495)
A shift by an amount >= the operand bitwidth is poison. Narrowing
changes that bitwidth, so an amount valid at the original width (e.g. 32
for i64) can become poison at the narrowed one (>= 32 for i32),
miscompiling `4 >> 32` from 0 to 4.
Only narrow shifts when the shift amount is provably below the target
width.
Fixes #218191
[mlir][spirv] Avoid copies of local APInt values in folds (NFC) (#221084)
Move locally constructed APInt values into arithmetic operations at
their last use. Expand conditional returns where needed so returning a
local can use implicit move construction.
Found by Coverity.
Assisted-by: Codex
[CIR] Derive lowering attr names from cppClassName, not the def name (#220891)
CIRLoweringEmitter built its CXX_ABI_ALWAYS_LEGAL_ATTRS entries with
GetOpCppClassName, which splits the TableGen def name at the first
underscore. That works only while every def is named
CIR_<CppClassName>Attr.
When one is not, the emitter writes an `isa<>` for a class that does not
exist, and the failure lands as a compile error in generated code.
Attributes carry the authoritative name in cppClassName, which
GenerateAttrToValueVisitor was already reading. Factor that out as
GetAttrCppClassRef and use it for both attribute paths.
GetOpCppClassName
stays for operations.
[MLIR][math] Remove dead IPowI fold return (NFC) (#221827)
The folder returns the constant-fold helper result directly, remove the
unreachable fallback after the helper call.
Found by Coverity.
Assisted-by: Codex
[MLIR][linalg] Remove discarded failure conversion (#221826)
Silence warning for unused result with a `(void)` cast instead of
converting its result with failed() and then discarding the converted
value.
Fix a Coverity warning, and it's cleaner about the intent.
Assisted-by: Codex
[mlir][AMDGPU] Move gather index vectors at final use (NFC) (#221825)
The gather lowering copies two temporary vectors into the next
construction stage and never reads the source vectors again. Move their
storage instead.
Found by Coverity.
Assisted-by: Codex
linuxkpi: Add `hrtimer_setup()`
`hrtimer_setup()` replaces `hrtimer_init()` in Linux 6.15. The API and
the role are the same, except:
* it takes the `function` callback as argument
* if `function` is NULL, it assigns a default callback
At the same time, we hide `hrtimer_init()` if LINUXKPI_VERSION is
greater than or equal to 61500 because it was dropped in Linux 6.15.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58757
linuxkpi: Add `timer64_to_tm()`
The function converts a number of seconds since Epoch to a `struct tm`.
The implementation was copied from `contrib/tzcode/localtime.c`.
The amdgpu DRM driver started to use it in Linux 6.15.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58758
NAS-143041 / 26.0.0 / Remove dead `force_remove_ix_volumes` app delete option (by Qubad786) (#19611)
## Problem
`app.delete` accepts `options.force_remove_ix_volumes`, validates it as
a bool and documents it in the method docstring, but nothing reads it.
It was live when introduced in 0c4381a2b4, where it picked which kwarg
to hand to `zfs.dataset.delete` — `recursively_remove_dependents` when
set, `recursive` otherwise. 9712dc3084 ("remove zfs.dataset.delete
(replace w/ zfs.resource.destroy)") swapped that call for an
unconditional `recursive=True, bypass=True` destroy and dropped the
conditional along with it, leaving the flag accepted but inert. The
capability it selected is gone too: `zfs.resource.destroy_impl` has no
dependents-removal parameter, so there is nothing left to wire it back
up to.
## Solution
Dropped the field from `AppDelete` in both v26_0_0 and v27_0_0 and
removed the docstring paragraph describing it. `remove_ix_volumes` is
unaffected — it is still the live gate on ix-volume deletion.
[8 lines not shown]
[CIR][CMake] Limit MLIR dependencies to used components
CIR libraries and tools consume MLIR's global dialect, conversion, and
translation library collections. This makes every library in those collections
reachable from Ninja's all target even when MLIR is configured only as a CIR
dependency.
Replace the collections with target-specific dependencies. Register only the
CIR, LLVM, and MemRef dialects in cir-lsp-server, and replace the all-LLVM
translation registration in cir-translate with the Builtin, LLVM, and OpenMP
interfaces used by CIR lowering.
For a dependency-only MLIR configuration with tests enabled, archives reachable
from Ninja all fall from 511 to 314. The libMLIR*.a subset falls from 333 to
136, and Ninja dry-run edges fall from 6,925 to 6,277.
Validation:
- Configured CIR with dependency-only MLIR, with and without tests.
- Configured Clang and MLIR explicitly with CIR and tests enabled.
[5 lines not shown]
[Flang][CMake] Limit MLIR dependencies to registered dialects
Flang currently consumes MLIR_DIALECT_LIBS and MLIR_EXTENSION_LIBS in many
libraries and tools. These global collections include every configured MLIR
dialect and extension, including test-only components when MLIR tests are
available.
Define Flang-specific dialect and extension lists matching the registry in
InitFIR.h, and use them in place of the global collections. Remove the unused
InitAllDialects include and register-all libraries. List MemRef explicitly for
fir-opt's additional registration.
For a dependency-only MLIR configuration with tests enabled, archives reachable
from Ninja all fall from 500 to 355. The libMLIR*.a subset falls from 317 to
172, and Ninja dry-run edges fall from 6,969 to 6,493.
Validation:
- Configured Flang with dependency-only MLIR, with and without tests.
- Configured Flang and MLIR explicitly with tests.
[4 lines not shown]
[CIR][CMake] Configure MLIR as a dependency-only project
ClangIR requires MLIR, but enabling CIR currently requires users to list MLIR
explicitly in LLVM_ENABLE_PROJECTS. That also attaches all MLIR build, install,
unit-test, and lit targets to the corresponding LLVM aggregates.
When Clang is selected and CLANG_ENABLE_CIR is enabled, append MLIR to the
effective LLVM_ENABLE_PROJECTS list. The common project setup compares that
list with the cached user selection, so an explicit MLIR selection retains its
normal behavior while an implicit selection is configured with EXCLUDE_FROM_ALL.
This makes MLIR targets available for CIR dependency resolution without adding
MLIR's aggregate targets. Keep the existing standalone ClangIR restriction and
do not configure MLIR when CIR is disabled.
Validation:
- Configured Clang with CIR and implicit MLIR test support.
- Configured Clang and MLIR explicitly with CIR and tests enabled.
- Configured Clang without CIR and verified that MLIR remains disabled.
[4 lines not shown]
[CMake] Infer dependency-only projects from the cache
LLVM_ENABLE_PROJECTS historically treats projects enabled to satisfy another
project's dependency the same as projects selected by the user. Consequently,
implicit projects attach their complete build, install, and test suites to
LLVM's aggregate targets.
Keep the cache entry as the user-requested project roots and use the normal
LLVM_ENABLE_PROJECTS variable as the effective dependency closure. Projects in
the effective list but not the cache entry are configured with EXCLUDE_FROM_ALL.
Normalize the special all value before comparing the two sets.
This makes Flang's MLIR and Clang dependencies dependency-only without a second
project collection. It also applies the same rule to Clang when it is added for
LLDB. Forward the cached roots to cross-compilation and bootstrap configurations
so implicit projects do not become explicit in nested builds.
Let MLIR own its dependency-only test policy: configure test support libraries
for downstream consumers without creating MLIR unit tests or registering its
[10 lines not shown]
[CIR] Register only the LLVM IR translations CIR lowers to (#221797)
The ClangIR tests reach LLVM IR through mlir-translate, which links
every MLIR dialect and translation, so building check-clang builds most
of MLIR. Register mlir-to-llvmir in cir-translate over the same three
dialects and use it instead. Remove the dependency on `mlir-translate`
to run CIR tests.
ninja check-clang drops from 6499 to 5853 build edges.
LLM-aided