[libc++] Harden the test suite for running against older libc++ versions (#214820)
When running against older libc++ versions, the test suite had problems
when sniffing carve-out macros. Since we changed from e.g.
_LIBCPP_HAS_NO_LOCALIZATION to _LIBCPP_HAS_LOCALIZATION == 0|1, we would
mis-detect the absence of _LIBCPP_HAS_NO_LOCALIZATION being defined for
localization being supported.
Fix this by explicitly handling checks for older versions. Note that
this also simplifies how we deal with the C++03 frozen headers, since in
most cases the same handling covers both the frozen headers and older
versions of the library.
Also, move the detection of Lit features for carve-outs from ad-hoc
Python checks to using <test_macros.h> directly, since that centralizes
the logic in a single place. This requires making "test_macros.h"
available to libunwind tests, which previously didn't have the proper
include path.
[lldb][test] Do not check order of elements in SharedCluster test (#215529)
Fixes #215310
ClusterManager uses a SmallPtrSet to track elements. SmallPtrSet is not
intentionally ordered, but its "small" representation is when only using
it in the ways that SmallPtrSet does.
When LLVM_REVERSE_ITERATION is ON, the order is reversed which causes
this unit test to fail.
From what I understand, the order is not important. So I've changed the
test to ignore the element order.
I think the large representation of SmallPtrSet is more likely to be
unordered. So the fact that we've been using it in the field since 2022
(33722848fcb5b569ab3a388cae15f31acf9a9c5e) also backs up order not being
important.
[libc++] Update the CMake version we use in the CI (#215783)
LLVM is raising the minimum CMake version to 3.31.0. We're currently
using an older version, so we need to upgrade. To make sure things work
with all supported versions this updates to the now oldest supported
version instead of something more recent (which we've done previously).
RFC for updating CMake:
https://discourse.llvm.org/t/rfc-raising-minimum-required-cmake-version-to-3-31
[libc++abi] Prevent zero-capacity PODSmallVector (#215386)
Require PODSmallVector to have a non-zero inline capacity.
PODSmallVector<T, 0> can reach reserve(0) when growing from
an empty vector, leaving the capacity at zero. Add a static_assert
requiring N > 0 to prevent this unsupported configuration.
[mlir][bufferization] Add a ValueBoundsOpInterface model for to_tensor/to_buffer (#215357)
The bufferization dialect attaches no `ValueBoundsOpInterface` models,
so a bound query that reaches a tensor materialized from a buffer stops
at the `bufferization.to_tensor`, even though the memref side is
analyzable: upstream models `memref.alloc`, `memref.cast`, `memref.dim`,
`memref.get_global` and `memref.subview`. The mirror case has the same
problem: a query that reaches a buffer materialized from a tensor stops
at the `bufferization.to_buffer`.
This matters during bufferization. An operand that was a tensor is by
then a `to_tensor` of the buffer of the producer, so every bound query
through it fails.
Attach a model to both ops. For `to_tensor`, the tensor and its source
buffer describe the same memory, so they have the same size in every
dimension. For `to_buffer`, the op carries `SameOperandsAndResultShape`,
so the buffer and its source tensor have the same size in every
dimension. Both ops also accept tensor-like and buffer-like types that
[4 lines not shown]
[GlobalISel][AMDGPU][NFC] Use typed integer LLTs in the load legalizer tests (#214700)
Extended LLTs are enabled for AMDGPU, so `LLT::integer` prints iN and
the kind-less sN in these test bodies no longer reflects what the
legalizer works with. Several of these tests already showed a mix of
both kinds in their assertions, because the value types came from the
test body while the types the legalizer creates internally are typed.
Switch the scalar value types in the bodies to iN and regenerate the
assertions. The generated code is almost unchanged; the difference is
that constants which previously differed only in kind now CSE, so a few
redundant G_CONSTANTs disappear.
Vector types are left alone. The AMDGPU legality rules use
`LLT::fixed_vector(N, Size)`, whose element is a kind-less ANY_SCALAR
that compares equal to any same-size scalar, so both <2 x i16> and <2 x
f16> already match them. Migrating vecotrs is a separate change that has
to update the rules, and is out of scope here.
[libc++] Rewrite the set_intersection benchmark without CartesianBenchmarks (#214302)
The set_intersection benchmark was taking around 15% of the time of the
whole test suite by itself. It generated 1296 test cases including many
that were irrelevant. It also nested two mutually exclusive
GoogleBenchmark iteration APIs (a for-loop on state and
KeepRunningBatch), leading to invalid results anyway.
This patch rewrites the benchmark with manually curated cases instead.
Fixes #120763
Assisted by Claude
clang/SPIRV: Respect __launch_bounds__ for AMDHIP case
Follow the somewhat dodgy logic for packing amdgpu_flat_work_group_size
into the X field of max_work_group_size if the value is provided
to __launch_bounds__. The explicit amdgpu_flat_work_group_size takes
precedence, like in the AMDGPU case.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
clang/AMDGPU: Respect __launch_bounds__ attribute
Currently the HIP headers manually implement this with a
macro setting amdgpu attributes, and the proper clang attribute
is silently ignored. Directly map the proper attribute into
the target IR attributes. The first argument sets
"amdgpu-flat-work-group-size" and the second (reinterpreted by HIP
as minimum waves per EU) sets "amdgpu-waves-per-eu". An explicit
amdgpu_flat_work_group_size / amdgpu_waves_per_eu attribute takes
precedence. This matches the launch_bounds macro in the HIP headers,
which can now be dropped.
The 3rd maxclusterrank argument is only handled for NVPTX, so restrict
the sm_90 arch check to NVPTX targets and ignore the third argument on
other targets.
Fixes #91468
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
CodeGen: Replace Generic FP libcall tests with per-backend coverage
"Generic" codegen tests are impossible, and we should work to
eliminate this test directory. Eliminate some cases that have
particular dependence on host library function availability.
Delete a few unreasonable cases (like the frem handling in print-arith-fp.ll),
and shard out math intrinsic tests not already covered in existing backend
tests.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
Keep two USB devices from being pointed at one port
## Problem
The USB port migration resolved each stored bus and device number to the port currently holding it, but never checked whether another device was already pointing there. A row carrying a device number and a row that already named that port both ended up on it, and nothing downstream objects: the uniqueness check only runs when a device is created or updated. Which of the two rows won also depended on the order the rows happened to come back in.
## Solution
- **A claim ledger, scoped per instance.** Every row is resolved before anything is written, and rows that keep their stored value claim their port first, so a rename landing on a port another device of the same instance already holds is left alone and logged rather than applied. Scoping to the instance rather than the table is deliberate: two VMs configured for one dongle is valid config, they simply cannot both be running.
- **One udev scan for the whole run.** `usb_device_names_by_bus_and_devnum` builds the bus and device number map in a single pass, so every row is resolved against the same view of the machine instead of one scan per row.
- **A write that fails no longer takes the rest down with it.** A migration that raises is not recorded and starts over on the next boot, by which time the kernel has reissued the very device numbers the rows that did get written were resolved from.
Log lines now name the instance, so an admin reading them can tell which VM or container lost a device without going to the database for it.
`middlewared/utils/usb.py` goes too: it had no callers anywhere and was a second implementation of the naming scheme this work replaced, waiting for someone to wire it up.
[clang-tidy] Fix a -Wrange-loop-construct warning (#215775)
As a follow up to commit d4c991d34c8c8568c
([clang-tidy][NFC] Apply const-correctness for auto 1/N (#213839)) we
make sure to use a const reference when iterating of FixLocations.
As indicated by -Wrange-loop-construct this prevents a copy from type
'std::pair<clang::SourceLocation, bool> const'.
[clang][Sema] Fix crash when checking scalar type with excess braces (#192471)
`InitListChecker::CheckScalarType()` crashed with multiple nested braces
in scalar initializers (e.g., `int v = {{}, {}, {}};`) due to
out-of-bounds access when retrieving diagnostic location from
uninitialized StructuredList.
Add bounds checking before `getInit(0)` access and add regression test
Fix #137845. Fix #69213. Fix #198767. Fix #207566. Fix #106180.
[clang][bytecode] Make `SourceMap` a proper class (#215760)
Instead of a typedef. Save offsets and infos separately to speed up the
binary search a bit.
[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>
clang/SPIRV: Respect __launch_bounds__ for AMDHIP case
Follow the somewhat dodgy logic for packing amdgpu_flat_work_group_size
into the X field of max_work_group_size if the value is provided
to __launch_bounds__. The explicit amdgpu_flat_work_group_size takes
precedence, like in the AMDGPU case.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
clang/AMDGPU: Respect __launch_bounds__ attribute
Currently the HIP headers manually implement this with a
macro setting amdgpu attributes, and the proper clang attribute
is silently ignored. Directly map the proper attribute into
the target IR attributes. The first argument sets
"amdgpu-flat-work-group-size" and the second (reinterpreted by HIP
as minimum waves per EU) sets "amdgpu-waves-per-eu". An explicit
amdgpu_flat_work_group_size / amdgpu_waves_per_eu attribute takes
precedence. This matches the launch_bounds macro in the HIP headers,
which can now be dropped.
The 3rd maxclusterrank argument is only handled for NVPTX, so restrict
the sm_90 arch check to NVPTX targets and ignore the third argument on
other targets.
Fixes #91468
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
Update libexpat to version 2.8.3.
Relevant for OpenBSD are bug fixes #1297 #1300 #1286 #1305 #1306,
other changes #1303. Library bump is not necessary. CVE-2026-72522
OK deraadt@ tb@