LLVM/project 1a8b98e.github/workflows premerge.yaml

[Github] Bump AArch64 premerge to Ubuntu 26.04 (#224016)

Mainly so that we pull in a new CMake. x86 Linux needs to be handled in
zorg.
DeltaFile
+1-1.github/workflows/premerge.yaml
+1-11 files

LLVM/project 1a318edllvm/lib/Target/AMDGPU AMDGPUFeatures.td AMDGPU.td, llvm/test/TableGen AMDGPUTargetDefGenericClassification.td

[AMDGPU] Classify generic-target features

Classify features used by generic targets but absent from some covered
GPUs as AMDGPUGenericAnyFeature. This covers the gfx11 workarounds,
gfx12.5 register fixup and WMMA timing, and LDS size and bank count.

Derive the classified features directly from the SubtargetFeature subclass
and preserve their existing predicates. Keep RequiresCOV6 outside this
policy because it is specific to generic targets and absent from their
covered GPUs.

Test the real target definitions, missing support for classified features,
and the existing all-member requirement for instruction capabilities.

Change-Id: I9fffbe532b8b5bc8875f20f394f29e2e6899f52e
DeltaFile
+70-0llvm/test/TableGen/AMDGPUTargetDefGenericClassification.td
+40-24llvm/lib/Target/AMDGPU/AMDGPU.td
+3-3llvm/lib/Target/AMDGPU/AMDGPUFeatures.td
+0-2llvm/utils/TableGen/Basic/AMDGPUTargetDefEmitter.cpp
+113-294 files

LLVM/project a9dc56cllvm/lib/Target/AMDGPU AMDGPUTargetParser.td, llvm/test/TableGen AMDGPUTargetDefErrors.td AMDGPUTargetDefGenericFeatures.td

[AMDGPU][NFC] Allow selected generic features on any covered GPU

Add AMDGPUGenericAnyFeature so individual feature classes can require
support from at least one covered GPU. Check explicitly marked features
even when they are not frontend-visible, while retaining the all-member
check for ordinary frontend-visible features.

Follow implied features using their own validation rules. Require named
generic targets to cover at least one concrete AMDGPU GPU, rejecting self
references, other generic targets, pseudo targets, and invalid members.

Cover partial support, missing support, exact numeric-feature membership,
backend-only features, implications, and malformed coverage lists with
TableGen tests. Generated target definitions remain unchanged.
DeltaFile
+166-0llvm/test/TableGen/AMDGPUTargetDefGenericFeatures.td
+38-17llvm/utils/TableGen/Basic/AMDGPUTargetDefEmitter.cpp
+14-5llvm/lib/Target/AMDGPU/AMDGPUTargetParser.td
+1-1llvm/test/TableGen/AMDGPUTargetDefErrors.td
+219-234 files

LLVM/project eac6cdfmlir/include/mlir/Dialect/SparseTensor/IR SparseTensorOps.td

[mlir][SparseTensor][NFC] Improve documentation for SparseTensor_LvlOp (#223307)

Update the `sparse_tensor.lvl` documentation to correctly describe the
level mapping for `%j floordiv 3`.
DeltaFile
+2-2mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorOps.td
+2-21 files

LLVM/project 24ebba1mlir/test/python/dialects/linalg ops.py

Fix linalg.elementwise assembly syntax in Python test
DeltaFile
+1-1mlir/test/python/dialects/linalg/ops.py
+1-11 files

LLVM/project eb0b656clang-tools-extra/clang-tidy/modernize UseRangesCheck.cpp, clang-tools-extra/clang-tidy/utils UseRangesCheck.cpp

[clang-tidy] `use-ranges`: avoid unsafe result fix-its

Preserve callable results with .fun, allow structured-binding-safe rewrites, and keep diagnostics while suppressing unsafe fix-its when ranges result objects do not match the original result shape.

Assisted by Codex.
DeltaFile
+38-2clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
+37-0clang-tools-extra/test/clang-tidy/checkers/modernize/use-ranges.cpp
+22-5clang-tools-extra/clang-tidy/modernize/UseRangesCheck.cpp
+26-0clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h
+7-0clang-tools-extra/docs/ReleaseNotes.md
+2-0clang-tools-extra/docs/clang-tidy/checks/modernize/use-ranges.rst
+132-71 files not shown
+134-77 files

LLVM/project 64d1f1allvm/include/llvm InitializePasses.h, llvm/include/llvm/CodeGen Passes.h

[llvm] Remove dead INITIALIZE_PASS instances and declarations (NFC) (#223938)

initializeARCOptAddrModePass:
Introduced on March 20, 2019 in commit
b062239d638ba668d277dd0ec735497b71321d3f without any callers.

initializeResetMachineFunctionPass:
Introduced on August 27, 2016 in commit
374796d6785311f93ba38ebce1b22e11a3df3ec7 without any callers.

initializeCFGuardPass:
Introduced on October 28, 2019 in commit
e59f7488c772c91ba0f7457ef67ffb4b455047b8 without any callers.

initializeMIRPrintingPassPass, MIRPrintingPassID:
Introduced on May 27, 2015 in commit
2bdb4e1063f5cbc8bb1262d90cca056e9fb31fbb without any callers.

initializeRegToMemWrapperPassPass:

    [3 lines not shown]
DeltaFile
+0-6llvm/lib/Target/ARC/ARCOptAddrMode.cpp
+0-5llvm/lib/Transforms/Scalar/Reg2Mem.cpp
+0-4llvm/include/llvm/InitializePasses.h
+0-4llvm/include/llvm/CodeGen/Passes.h
+0-3llvm/lib/CodeGen/MIRPrintingPass.cpp
+0-2llvm/lib/CodeGen/ResetMachineFunctionPass.cpp
+0-241 files not shown
+0-257 files

LLVM/project ff37783clang-tools-extra/clang-tidy/modernize UseRangesCheck.cpp, clang-tools-extra/docs ReleaseNotes.md

[clang-tidy] `use-ranges`: preserve output results

Preserve used output iterator results for output algorithm replacements by appending .out where the ranges algorithm returns an algorithm result object.

Fix #110223

Assisted by Codex.
DeltaFile
+104-0clang-tools-extra/test/clang-tidy/checkers/modernize/use-ranges.cpp
+59-0clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h
+26-28clang-tools-extra/clang-tidy/modernize/UseRangesCheck.cpp
+4-0clang-tools-extra/docs/ReleaseNotes.md
+2-0clang-tools-extra/docs/clang-tidy/checks/modernize/use-ranges.rst
+195-285 files

LLVM/project a37f19alibc/include unistd.yaml, libc/include/llvm-libc-macros/linux unistd-macros.h

[libc] Add macro / sysconf support for POSIX threads features. (#223543)

Define all `_POSIX_THREAD_*` macro and corresponding `_SC_THREAD_`
sysconf names that provide information on availability of certain
POSIX threads features.

* Explicitly provide all relevant macro from POSIX standard:
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/unistd.h.html
to either 202405L (current POSIX version supported by LLVM-libc), or -1
  (if the feature is unsupported)
* Support returning these features via `sysconf` for matching `_SC_`
name values;
* Add unit tests that validate the actual numerical values.
DeltaFile
+48-0libc/include/unistd.yaml
+28-1libc/include/llvm-libc-macros/linux/unistd-macros.h
+24-0libc/src/unistd/linux/sysconf.cpp
+17-3libc/test/src/unistd/sysconf_test.cpp
+117-44 files

LLVM/project 4d00c7bllvm/test/Analysis/CostModel/X86 arith-mulh.ll

[CostModel][X86] Add baseline costs for smulh/umulh intrinsics (#224022)
DeltaFile
+289-0llvm/test/Analysis/CostModel/X86/arith-mulh.ll
+289-01 files

LLVM/project 1b66ee2lldb/test/API/accelerator/mock TestMockAcceleratorAddressSpaces.py, lldb/tools/lldb-server/Plugins/Accelerator/Mock ProcessMockAccelerator.h ProcessMockAccelerator.cpp

[lldb] End to end test for address spaces using lldb-server mock accelerator  plugin (#217092)

Relevant RFC:
https://discourse.llvm.org/t/rfc-address-spaces-support-in-lldb/91222/

Add an end to end test using a mock accelerator that advertises multiple
address spaces.
DeltaFile
+84-0lldb/test/API/accelerator/mock/TestMockAcceleratorAddressSpaces.py
+19-2lldb/tools/lldb-server/Plugins/Accelerator/Mock/ProcessMockAccelerator.cpp
+6-0lldb/tools/lldb-server/Plugins/Accelerator/Mock/ProcessMockAccelerator.h
+109-23 files

LLVM/project 0b60507flang/test/Lower/OpenMP mismatched-bound-types.f90

[flang][test][NFC] Re-add OpenMP test for mismatched loop bound types (#223876)

Lowering now materialises the literal at the loop variable's kind, so
there is a single i64 constant and no fir.convert. Updated the checks to
match and re-added the test.
DeltaFile
+65-0flang/test/Lower/OpenMP/mismatched-bound-types.f90
+65-01 files

LLVM/project e0f6d55llvm/lib/Target/SPIRV SPIRVAPI.cpp

SPIRV: Avoid TargetMachine::createDataLayout in SPIRVTranslate (#224017)
DeltaFile
+1-2llvm/lib/Target/SPIRV/SPIRVAPI.cpp
+1-21 files

LLVM/project e250f34llvm/bindings/ocaml/llvm llvm_ocaml.c llvm.mli, llvm/docs ReleaseNotes.md

[IR] Deprecate ConstantExpr::getSizeOf() and getAlignOf() (#223710)

These cannot be represented in terms of ptradd. They should be replaced
with plain constants with the size/alignment (based on DataLayout, or
direct frontend knowledge).

The C API wrappers `LLVMSizeOf()` and `LLVMAlignOf()` are deprecated for
the same reason.

The C APIs `LLVMBuildMalloc()` and `LLVMBuildArrayMalloc()` create a
constant with the size based on data layout now.
DeltaFile
+14-6llvm/lib/IR/Core.cpp
+0-12llvm/bindings/ocaml/llvm/llvm_ocaml.c
+0-12llvm/bindings/ocaml/llvm/llvm.mli
+6-2llvm/include/llvm-c/Core.h
+7-0llvm/docs/ReleaseNotes.md
+2-4llvm/test/Bindings/OCaml/core.ml
+29-362 files not shown
+33-388 files

LLVM/project 6f8b62fclang/lib/CIR/FrontendAction CIRGenAction.cpp

CIR: Set the target's canonical DataLayout on the lowered module
DeltaFile
+2-0clang/lib/CIR/FrontendAction/CIRGenAction.cpp
+2-01 files

LLVM/project 7e1bbb0lldb/test/API/functionalities/inline-sourcefile inline.ll

Drop the stale DataLayout from inline.ll
DeltaFile
+0-1lldb/test/API/functionalities/inline-sourcefile/inline.ll
+0-11 files

LLVM/project 3906e0allvm/lib/ABI/Targets X86.cpp, llvm/unittests/ABI X86TargetInfoTest.cpp

[LLVMABI] Narrow the eightbyte past a union's storage member (#223859)

`getIntegerTypeAtOffset` sized the eightbyte from the storage member the
union reduction picked, even at an offset that member does not reach. A
union whose second eightbyte holds one data byte then coerced to `i64`
where clang coerces to `i8`:

```c
union { char c[9]; void *p; };
```

Clang lowers it to `{ ptr, [8 x i8] }`, so that offset lands on padding
and the coercion narrows to a byte. The classifier now does the same,
and sizes the coercion from the union's remaining bytes otherwise.

Assisted-by: Cursor / claude-opus-5
DeltaFile
+98-0llvm/unittests/ABI/X86TargetInfoTest.cpp
+16-3llvm/lib/ABI/Targets/X86.cpp
+114-32 files

LLVM/project 9dc532blibcxx/include string

[libc++] Optimize string::erase (#223721)

This change allows the `traits_type::move` (i.e. `memmove`) call to be
tail-called, removing the need for allocating any stack space and a
call. We also copy the null terminator through `memmove` instead of
inserting it manually.
DeltaFile
+6-7libcxx/include/string
+6-71 files

LLVM/project ef15e2allvm/include/llvm/Transforms/Vectorize/SandboxVectorizer VecUtils.h, llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes LoadStoreVec.h

[SandboxVectorizer] Dispatch LoadStoreVec::runOnRegion on seed kind
DeltaFile
+150-105llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/LoadStoreVec.cpp
+105-0llvm/test/Transforms/SandboxVectorizer/Passes/LoadStoreVec/load_store_vec_load_seeds.ll
+26-11llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/LoadStoreVec.h
+15-4llvm/lib/Transforms/Vectorize/SandboxVectorizer/VecUtils.cpp
+6-4llvm/unittests/Transforms/Vectorize/SandboxVectorizer/VecUtilsTest.cpp
+2-1llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/VecUtils.h
+304-1256 files

LLVM/project e364b9dlibcxx/include/__configuration abi.h, libcxx/include/__random mersenne_twister_engine.h

[libc++] Take the mersenne twister ABI break unconditionally (#222700)

Technically this is ABI breaking, since we change the meaning of the
bytes inside the mersenne twister. However, this doesn't cause changes
in the size of any objects and is only an issue in very specific
circumstances. Specifically, the mersenne twister has to be passed on an
ABI boundary and be used on both sides of that ABI boundary. If it's
only used on one side, the values will continue to be correct, since
only a single algorithm is used. Even then, the only issue is that the
values aren't properly randomized, since both versions of the mersenne
twister implementation read the same type of data and produce the same
kind of output with it.

Fixes #209514
DeltaFile
+4-272libcxx/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_sseq.pass.cpp
+3-211libcxx/test/std/numerics/rand/rand.eng/rand.eng.mers/ctor_result_type.pass.cpp
+0-10libcxx/include/__random/mersenne_twister_engine.h
+0-1libcxx/utils/libcxx/test/features/libcxx_macros.py
+0-1libcxx/include/__configuration/abi.h
+7-4955 files

LLVM/project 1892ec0llvm/cmake config-ix.cmake

[cmake] Use the C++ linker when checking libxml2 (#221970)

When libxml2 is built statically with ICU support, its link interface
contains C++ libraries. `check_symbol_exists()` uses the C linker
driver, causing the libxml2 check to fail on unresolved C++ runtime
symbols and incorrectly report that `xmlReadMemory` is unavailable.

This issue was found in https://github.com/microsoft/vcpkg/pull/53727
DeltaFile
+2-2llvm/cmake/config-ix.cmake
+2-21 files

LLVM/project 503e108llvm/lib/Transforms/Vectorize VPlanHelpers.h VPlan.cpp

[VPlan] Create VPSlotTracker's ModuleSlotTracker for the plan (NFC). (#223952)

Move the lazy creation of VPSlotTracker's ModuleSlotTracker into a new
getOrCreateMST helper, so it can be shared with other users in the
future (https://github.com/llvm/llvm-project/pull/203982).

Also get the function and module directly from the plan Create it for
the cached module and get the function to incorporate from the plan,
instead of using the module and function of the first unnamed
instruction printed.

PR: https://github.com/llvm/llvm-project/pull/223952
DeltaFile
+15-14llvm/lib/Transforms/Vectorize/VPlan.cpp
+13-6llvm/lib/Transforms/Vectorize/VPlanHelpers.h
+28-202 files

LLVM/project 296ae1dclang-tools-extra/clang-tidy/modernize UseRangesCheck.cpp, clang-tools-extra/clang-tidy/utils UseRangesCheck.cpp

[clang-tidy] `use-ranges`: avoid unsafe result fix-its

Preserve callable results with .fun, allow structured-binding-safe rewrites, and keep diagnostics while suppressing unsafe fix-its when ranges result objects do not match the original result shape.

Assisted by Codex.
DeltaFile
+38-2clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
+37-0clang-tools-extra/test/clang-tidy/checkers/modernize/use-ranges.cpp
+22-5clang-tools-extra/clang-tidy/modernize/UseRangesCheck.cpp
+26-0clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h
+7-0clang-tools-extra/docs/ReleaseNotes.md
+2-0clang-tools-extra/docs/clang-tidy/checks/modernize/use-ranges.rst
+132-71 files not shown
+134-77 files

LLVM/project 2570c9dclang-tools-extra/clang-tidy/modernize UseRangesCheck.cpp, clang-tools-extra/docs ReleaseNotes.md

[clang-tidy] `use-ranges`: preserve output results

Preserve used output iterator results for output algorithm replacements by appending .out where the ranges algorithm returns an algorithm result object.

Fix #110223

Assisted by Codex.
DeltaFile
+104-0clang-tools-extra/test/clang-tidy/checkers/modernize/use-ranges.cpp
+59-0clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h
+26-28clang-tools-extra/clang-tidy/modernize/UseRangesCheck.cpp
+4-0clang-tools-extra/docs/ReleaseNotes.md
+2-0clang-tools-extra/docs/clang-tidy/checks/modernize/use-ranges.rst
+195-285 files

LLVM/project 3e8a370llvm/docs AMDGPUUsage.rst, llvm/lib/Target/AMDGPU SIMemoryLegalizer.cpp

Prohibit demotion if function contains LDSDMA
DeltaFile
+15-5llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp
+11-8llvm/docs/AMDGPUUsage.rst
+10-0llvm/test/CodeGen/AMDGPU/memory-legalizer-single-wave-workgroup-lds-dma.ll
+5-2llvm/test/CodeGen/AMDGPU/lds-dma-war.ll
+4-2llvm/test/CodeGen/AMDGPU/lds-dma-war-async.ll
+45-175 files

LLVM/project 649e3d6llvm/lib/Transforms/Scalar ConstraintElimination.cpp

[ConstraintElim] Unify signed and unsigned decomposition paths (NFC) (#223835)

NFCI clean-up after https://github.com/llvm/llvm-project/pull/223537.

Unify signed/unsigned decomposition via isKnownNoWrap.

PR: https://github.com/llvm/llvm-project/pull/223835
DeltaFile
+49-100llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
+49-1001 files

LLVM/project 95ead5fmlir/lib/Conversion/SCFToOpenMP SCFToOpenMP.cpp, mlir/lib/Dialect/OpenACC/IR OpenACC.cpp

[MLIR] Use false instead of nullptr for boolean args. (NFC) (#224009)

This fixes a build failure on macOS with -Werror:
error: implicit conversion of nullptr constant to 'bool'
[-Werror,-Wnull-conversion]

PR: https://github.com/llvm/llvm-project/pull/224009
DeltaFile
+3-3mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
+2-2mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
+1-1mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp
+6-63 files

LLVM/project 1d94f59clang/lib/CodeGen CGOpenMPRuntimeGPU.cpp CGStmtOpenMP.cpp, clang/test/OpenMP target_no_loop.c

[clang][OpenMP] Emit lastprivate final copies in no-loop kernels

Promotion rejected lastprivate because the no-loop branch leaves the
worksharing path before it privatizes or copies out, so the clause would
have been silently dropped.

Privatize the non-counter variables in the parallel region and copy them
out under the last iteration that applyWorkshareLoop publishes, forcing
the exit barrier the copy reads through. Loop counters stay at the
distribute level and reach EmitOMPSimdFinal.
DeltaFile
+60-8clang/lib/CodeGen/CGStmtOpenMP.cpp
+54-1clang/test/OpenMP/target_no_loop.c
+48-0offload/test/offloading/target-no-loop.c
+1-3clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+163-124 files

LLVM/project 664a9dbclang/lib/CodeGen CodeGenFunction.cpp CGOpenMPRuntimeGPU.cpp, clang/test/OpenMP target_no_loop.c

[clang][OpenMP] Add no-loop SPMD kernel promotion

A target teams distribute parallel for that is guaranteed a thread for
every iteration does not need the loop around its body. Flang already
drops it and runs the region as a no-loop kernel.

Enable the same optimization for Clang through mirroring Flang's MLIR
promotion using OpenMPIRBuilder. The kernel is tagged SPMD_NO_LOOP, so
the runtime sizes the grid to the iteration space, and the body is
emitted without a loop around it. The canonical loop it consumes is
reconstructed in the no-loop branch rather than taken from an
OMPCanonicalLoop node, so the promotion does not require
-fopenmp-enable-irbuilder.

Restrict offload entry creation to module level finalize, preventing
asserts on missing offload entries from nested CodeGenFunction
finalizing before module completion.
DeltaFile
+121-40clang/lib/CodeGen/CGStmtOpenMP.cpp
+91-0offload/test/offloading/target-no-loop.c
+83-0clang/test/OpenMP/target_no_loop.c
+21-3clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+10-8clang/lib/CodeGen/CodeGenFunction.cpp
+8-0llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+334-514 files not shown
+347-5310 files

LLVM/project 9f55972flang/test/Integration/OpenMP privatization-barrier.f90, flang/test/Lower/OpenMP taskloop.f90

[OpenMP] Honor barrier and last iteration flags in loop lowering

Emitting loop-free kernels for no-loop target regions in Clang requires
the shared OpenMP lowering to honor flags that reach it today and are
then discarded.

applyWorkshareLoop takes a NeedsBarrier flag, but the device path drops
it, so a worksharing loop without nowait emits no barrier at its exit.
The device path also never sets the canonical loop's last iteration
variable, which the linear clause finalization reads. Forward the flag
to applyWorkshareLoopTarget and compute the last iteration in the loop
body, mirroring how the host runtime reports it.

Auditing the surrounding lowering for the same class of problem turned
up one more. The barrier that follows privatization is emitted as part
of the firstprivate copy region, so a construct with lastprivate and no
firstprivate never gets one. Emit it independently of the copy region.
Flang skips it for taskloop, where the write-back already happens after
the reads.
DeltaFile
+53-43mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+38-4llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+40-0mlir/test/Target/LLVMIR/omptarget-wsloop.mlir
+38-0flang/test/Integration/OpenMP/privatization-barrier.f90
+10-6llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+15-0flang/test/Lower/OpenMP/taskloop.f90
+194-531 files not shown
+201-537 files