[mlir][LLVMIR] Precompile NVVM and ROCDL operation declarations (NFC) (#233106)
The eight source shards in each dialect repeatedly parse their operation
headers after loading the shared LLVM PCH. Give each dialect a local PCH
containing LLVMIR/pch.h followed by its operation header. Disable
downstream reuse so other libraries retain their existing PCH selection.
Reduces CPU from 103.12 to 87.48 s (-15.17%) for the affected objects.
Assisted-by: Codex
[libc++] Disable automatic module scanning on ARM CI builders
The ARM Buildkite toolchains do not expose clang-scan-deps to CMake.
When CMP0155 enables automatic scanning for libc++abi C++23 sources,
these standalone runtimes builds fail with the scanner set to NOTFOUND.
Pass CMAKE_CXX_SCAN_FOR_MODULES=OFF in the eight ARM job invocations,
including the no-exceptions variants, until their toolchains provide a
matching scanner. Keep the other CI configurations on their defaults.
Validated bash syntax, git diff --check, and argument dispatch for all
eight ARM jobs with generic C++20, C++23, and modules jobs as controls.
Assisted-by: Codex
[libc++] Provision a suitable CMake for CI builds
The previous commit raised cmake_minimum_required to 3.31. The GitHub
jobs already satisfy it (the Linux image pins 3.31.0, macOS uses brew,
Windows uses the hosted image), but some self-hosted Buildkite agents
ship an older CMake and their images cannot be updated by us.
Teach run-buildbot to check the CMake version up front. When the cmake
on PATH is new enough, this costs a single `cmake --version` and nothing
else changes. Otherwise, download a pinned, SHA-256 verified CMake
3.31.12 release binary into ${XDG_CACHE_HOME:-~/.cache}/libcxx (outside
the build directory that run-buildbot wipes) and, when no binary exists
for the host or it cannot run there, bootstrap it from source with the
host compilers rather than the runtime's CC/CXX. The install is
published with an atomic rename so concurrent builders on one agent
never see a partial cache entry.
An explicit CMAKE override is still honored but now validated; in the
provisioned or overridden cases its directory is prepended to PATH so
[5 lines not shown]
[libc++abi] Retain the old CMP0155 behavior for GCC compatibility
Raising the minimum CMake version to 3.31 enables automatic module dependency
scanning for the C++23 libc++abi object libraries. GCC 16 and 17 then probe
the libstdc++ bits/stdc++.h header when processing libc++ headers and fail
if it is absent.
Set CMP0155 to OLD within libc++abi only when using GCC until its optional
header lookup is fixed. Preserve automatic scanning with Clang and guard
the policy setting for older CMake versions.
GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127940
Validated the policy workaround on the CMake 3.31 minimum-version branch
with GCC 16.2.0 and CMake 3.31.12: the focused cxa_handlers.cpp reproducer
compiles. Clang 22.1.0 still generates and successfully executes the
clang-scan-deps rule for that source. git diff --check passes.
Assisted-by: Codex
[NVPTX] Set default value of nvptx-allow-ftz-atomics to false
This restores the strict FTZ default originally introduced in #200732
and temporarily relaxed in #206154.
Frontends can now explicitly opt in to native FTZ-mismatched atomics on a
per-instruction basis using !atomic.ignore.denormal.mode metadata (#217585,
#217586), which is supported in Clang, MLIR, and XLA. Users who need the
previous behavior globally can still pass -nvptx-allow-ftz-atomics=true.
Update test cases to verify the new default disallow behavior.
[SLP]Do not seed on vectorizer-created compares
With revec, alternate compares are emitted as pairs of compares on
the same operands, which were re-seeded and hanged the compiler.
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/233101
[Mips] Select RINT instructions for scalar rint on R6 (#233042)
Legalize FRINT and STRICT_FRINT for supported scalar floating-point
types on standard-encoding MIPS R6 targets, and match both operations to
the existing RINT_S and RINT_D instructions instead of libcalls.
Preserve strict FP exception semantics using the existing instruction
properties.
[X86] splitVectorOp - add BUILD_VECTOR handling (#233077)
In case a call to splitVectorOp has already constant folded into a BUILD_VECTOR
Fixes #233063
[offload] Add direct-write memcpys to liboffload and implement them on AMDGPU
olMemcpy gets a variant with a flag parameter. The flags are an enum and
DIRECT_WRITE is the first member of it. Specifying DIRECT_WRITE means
that the olMemcpy may issue the copy as a direct H2D write, which means
that it will be unordered with respect to the currently enqueued
operations. It will, however, be completed upon completion of olMemcpy,
so it will not be unordered with respect to operations that get enqueued
afterwards.
The AMDGPU implementation queries is a transfer of the ROCr/HIP
implementation. It more or less boils down to a std::memcpy with fences
around it.
Claude assisted with this patch.
[clang][DebugInfo] Attribute beginning of catch to opening brace (#177032)
It was previously attributed to the end of the last catch or the end of
the try block. Attributing it to the beginning of the right catch block
is especially interesting when e.g. using `catch catch` in GDB.
Fixes #164414.
[LTO,lld] Initialize lto::Config::PTO with LibraryOptions (#233069)
Commit 27e2fc2de79d (#233026) switched `llvm-lto2` and `lld` from
`cl::ParseCommandLineOptions` to
`cl::parseCommandLineOptions(LibraryOptions, ...)`
and set `lto::Config::LibraryOptions`, but left `lto::Config::PTO`
default-constructed with a null `LibraryOptionsContext`. As a result,
`PipelineTuningOptions` read `PassesOptions::Global` instead of the
parsed
`LibraryOptions`, causing flags like `-enable-loopinterchange=false` to
be
ignored (`cross-project-tests :: dtlto/remote-options.test`).
Initialize `PTO` with `PipelineTuningOptions(LibraryOptions)` in
`llvm-lto2`
and `lld` (`COFF`, `ELF`, `MachO`, `wasm`), matching `clang`s
`BackendUtil.cpp`.
Note: This root-cause analysis and patch were generated by an AI coding
assistant (LLM-aided).
[InstCombine] Canonicalize atomicrmw sub of a constant to add
Rewrite `atomicrmw sub ptr, C` as `atomicrmw add ptr, -C`. This
matches the canonical form InstCombine already uses for plain `sub`.
In wrapping arithmetic $old - C = old + (-C)$, so both the stored
value and the returned old value stay the same, including when C is
`INT_MIN`. Ordering, syncscope and metadata are kept.
```llvm
; before
%old = atomicrmw sub ptr %p, i32 1 syncscope("agent") monotonic
; after
%old = atomicrmw add ptr %p, i32 -1 syncscope("agent") monotonic
```
This benefits AMDGPU, for example: https://godbolt.org/z/39xsYro3o
[InstCombine] Add tests for atomicrmw sub of a constant. NFC (#232625)
atomicrmw sub C can be canonicalized to atomicrmw add -C because both
produce the same stored and returned values under wrapping arithmetic.
Cover syncscope, INT_MIN, and negative cases.
[LTO,lld] Initialize lto::Config::PTO with LibraryOptions
Commit 27e2fc2de79d (#233026) switched `llvm-lto2` and `lld` from
`cl::ParseCommandLineOptions` to `cl::parseCommandLineOptions(LibraryOptions, ...)`
and set `lto::Config::LibraryOptions`, but left `lto::Config::PTO`
default-constructed with a null `LibraryOptionsContext`. As a result,
`PipelineTuningOptions` read `PassesOptions::Global` instead of the parsed
`LibraryOptions`, causing flags like `-enable-loopinterchange=false` to be
ignored (`cross-project-tests :: dtlto/remote-options.test`).
Initialize `PTO` with `PipelineTuningOptions(LibraryOptions)` in `llvm-lto2`
and `lld` (`COFF`, `ELF`, `MachO`, `wasm`), matching `clang`s
`BackendUtil.cpp`.
Note: This root-cause analysis and patch were generated by an AI coding
assistant (LLM-aided).
[clang][OpenMP] Regenerate stale checks in two codegen tests (NFC) (#232041)
The generated checks in these two tests no longer match what
`update_cc_test_checks.py` produces, mostly attribute and metadata
numbers. They still pass because those positions match any number.
Regenerating them separately keeps the real changes in #220316
reviewable.
No functional change. Regenerated with `update_cc_test_checks.py`, and
the tests pass before and after.
The contents of this PR is created with help from Claude Code.
MC: Remove MCAsmInfo::ExceptionsType
The exception model now comes from the module, and the MCAsmInfo
predicates that depend on it take the model as a parameter. The
target's default model is still available from
Triple::getDefaultExceptionHandling.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
WebAssembly: Use reportFatalUsageError for eh option errors
Avoid using the deprecated report_fatal_error, and add missing
error test coverage.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>