[libc++] Fix cfi-unrelated-cast failures in allocator, __new_at_least, and shared_ptr
Fix three `cfi-unrelated-cast` failures in libc++ headers discovered while bringing up a CFI CI job (https://github.com/llvm/llvm-project/issues/245696):
- Annotate `__operator_new_wrapper` in `__memory/allocator.h` with `_LIBCPP_NO_SANITIZE("cfi-unrelated-cast")`. Commit edad54e08d3b (https://github.com/llvm/llvm-project/pull/229771) replaced `__libcpp_allocate` (which had `_LIBCPP_NO_CFI`) with `__operator_new_wrapper`, so Clang's `matchesStlAllocatorFn` exemption no longer applies to its `static_cast<_Tp*>` on uninitialized memory.
- Annotate `__new_at_least<_Tp>` in `__new/new_at_least.h` with `_LIBCPP_NO_SANITIZE("cfi-unrelated-cast")`. Commit f59521e7ec81 (https://github.com/llvm/llvm-project/pull/215813) introduced a `static_cast<_Tp*>` on freshly allocated `void*` memory that breaks polymorphic `std::vector` allocations across standard modes.
- Construct `_ControlBlock` directly with placement `::new (static_cast<void*>(...))` in `__allocate_shared_unbounded_array` (`__memory/shared_ptr.h`), matching `__allocate_shared_impl`, instead of casting uninitialized storage to polymorphic `_ControlBlock*` before construction. (Bounded arrays already allocate `_ControlBlock` directly and do not trigger a cast check.)
Assisted-by: Gemini
[GVN] Process Foldable Terminator beforehead
GVN generates phi node to replace a load call. However, addDeadBlock
modify such phi so that any deadblock sucessor in a phi becomes
poison.
This causes disagreement on SSAUpdater as [%a, %b1] [poison, %b2] is
considered as different with [%a, %b1] [0, %b2] even if poison is
replace with 0.
As a result, we make processFoldableTerminator (which is the only
caller of addDeadBlock now) runs before processInstruction. This is
before what we have on phi node generation so that non of the mismatch
happens.
Asissted-by: Claude # Test
Revert "[libc++] Add __repeat_iterator and use it in the sequence containers (#240378)" (#248213)
This reverts commit 484552add0fb92195f2e3f70734adf4a57f8ebc0.
This breaks std::vector::insert(const_iterator, size_type, const_reference)
in C++23 (-std=c++23 -stdlib=libc++), leaving newly inserted elements appended
at the end of the vector instead of at pos when n > (end - pos) and
n <= __remaining_capacity(), which is actively breaking builds in our CI.
See https://github.com/llvm/llvm-project/pull/240378#issuecomment-7322947076
for the minimal C++23 reproducer and root-cause analysis:
1. __repeat_iterator lacks a default constructor, so it does not model
std::forward_iterator in C++20/23 (and lacks relational operators for
std::random_access_iterator).
2. In vector::__insert_with_size, the C++23 !forward_iterator path calls
std::rotate(__p, __old_last, __end) with a stale cached __end (== __old_last)
instead of __layout_.__end_ptr() (a latent regression from bd338806e423 /
#155330, which already has an open fix in #229763).
Verified that this clean revert builds libc++/libc++abi/libunwind and makes the
minimal C++23 reproducer pass (Result (5): 1 9 9 9 2).
[mlir][EmitC][MLGO] Emit reflectionSizeMap in mlgo-add-reflection-map (#242627)
Let callers check the byte size of a field before writing through
reflectionMap
User: In MLGO input shapes became runtime options since #224598, so a
compiled field can be smaller than the tensor, this PR is a prerequisite
for #242629
[SPIR-V] Restore image, sampler, event and queue types from MIR (#247729)
Without them, -start-after crashes when instruction selection looks up
these types
Signed images are recovered from their OpName
[analyzer][NFC] Out-line CheckerManager::CheckerTags accessors (#248205)
- `CheckerManager::getChecker` and `isRegisteredChecker` are templates
instantiated in every checker TU. Their inline `DenseMap<void *,
std::unique_ptr<CheckerBackend>>` lookup/insert code was therefore
re-instantiated and re-compiled in each of them.
- Route both through the new private out-of-line members
`getCheckerSlot` and `hasCheckerWithTag`, defined in
`CheckerManager.cpp`.
- `getChecker` runs only at checker registration, so there is no
analysis run-time cost.
Build-time impact (instructions retired, 196 `lib/StaticAnalyzer` TUs):
- Total: -0.77% median (-0.12..-0.88% over 5 paired sweeps, noise 0.2%).
Run-time impact (analyzer, 20 TUs of clang/lib/{AST,Sema,Parse,CodeGen},
elapsed cycles, 10 interleaved rounds per binary, before = merge base
a26d5a8):
- Result: no slowdown detected. Median of per-round totals -0.32%: no
[9 lines not shown]
[analyzer][NFC] Drop `SourceManager.h` from `CallEvent.h` (#248179)
- `CallEvent::isInSystemHeader` was the only user of `SourceManager` in
`CallEvent.h`, yet its inline body made every includer of the header
parse `clang/Basic/SourceManager.h`. Move the body into `CallEvent.cpp`
and drop the include.
- Include `clang/Basic/SourceManager.h` explicitly in
`ErrnoChecker.cpp`, `ErrnoModeling.cpp`, `LocalizationChecker.cpp`,
`NullabilityChecker.cpp`, `VirtualCallChecker.cpp` and
`ExprEngineCallAndReturn.cpp`, which relied on it transitively.
Build-time impact (instructions retired, 196 `lib/StaticAnalyzer` TUs):
- Total: -0.79% (5 paired sweeps, all faster; run-to-run noise 0.3%).
- 140 TUs change by more than 0.15%, by -1.07% over those (net,
including the TUs that regain the include).
Run-time impact (analyzer, 20 TUs of clang/lib/{AST,Sema,Parse,CodeGen},
elapsed cycles, 10 interleaved rounds per binary, before = merge base
a26d5a8):
[9 lines not shown]
[analyzer][NFC] Out-line `CheckerContext::addTransitionImpl` (#248181)
- `CheckerContext::addTransitionImpl` is reached from every
`addTransition` overload and instantiated `CoreEngine::makeNode` and the
`ExplodedNodeSet` calls in every checker TU. Move it into
`CheckerContext.cpp`.
Build-time impact (instructions retired, 196 `lib/StaticAnalyzer` TUs):
- Total: -1.23% (4 paired sweeps, all faster; run-to-run noise 0.2%).
- 97 TUs change by more than 0.15%, by -2.5% over those.
Run-time impact (analyzer, 20 TUs of clang/lib/{AST,Sema,Parse,CodeGen},
elapsed cycles, 10 interleaved rounds per binary, before = merge base
a26d5a8):
- Result: no slowdown detected. Median of per-round totals -0.12%: no
slowdown; total cycles are slightly lower (95% CI -0.21%..-0.08%
excludes zero).
- Total per round (%): -0.05, -0.12, -0.20, -0.11, -0.32, -0.02, -0.01,
-0.30, -0.10, -0.19.
[5 lines not shown]
[NVPTX] Fold predicate only when it has one user (#248159)
This is a perf fix for 9386502801a033a676d9dce8ca8482c0d50e4f43. Folding
the predicate is not beneficial if there are multiple users. In that
case the shared predicate can be kept in a register and we need a
shorter code sequence in the final codegen.
NAS-145549 / 27.1.0 / Fix infinite loop in path_in_ctldir() on paths starting with // (by ixhamza) (#20355)
### Motivation
`path_in_ctldir()` can enter an infinite loop when a path starts with
exactly two slashes, such as `//mnt/tank/share`. This can happen when a
user accidentally enters an extra leading slash in an SMB share path or
supplies such a path through the API. Linux treats `//` like `/`,
allowing the path to pass the earlier existence checks.
### Description
The loop assumes that the root is always `/`, but `pathlib` preserves
exactly two leading slashes. Since the parent of `//` is itself,
terminate the loop when `path == path.parent` instead of comparing
against `/`.
### Testing
[6 lines not shown]
NAS-145547 / 27.1.0 / Fix autorid migration (by anodos325) (#20358)
Prior to TrueNAS 25.10 we exposed a non-default idmap backend for Active
Directory (added in TrueNAS 9.10) that users really shouldn't have been
using because it was non-deterministic in ways that are quite painful to
fix. We removed the backend in 25.10 and had a best-effort migration to
put the user into something equivalent that wouldn't require redoing
ACLs. Overall, the backend was rarely used and so an edge-case in the
migration was missed until recently. This commit fixes the migration
in-place (e.g. doesn't add a new migration). Anyone who was impacted by
it most likely simply rejoined AD after failure on upgrade.
Original PR: https://github.com/truenas/middleware/pull/20352
Co-authored-by: Andrew Walker <andrew.walker at truenas.com>
Fix autorid migration
Prior to TrueNAS 25.10 we exposed a non-default idmap backend
for Active Directory (added in TrueNAS 9.10) that users really
shouldn't have been using because it was non-deterministic in
ways that are quite painful to fix. We removed the backend in
25.10 and had a best-effort migration to put the user into something
equivalent that wouldn't require redoing ACLs. Overall, the
backend was rarely used and so an edge-case in the migration
was missed until recently. This commit fixes the migration in-place
(e.g. doesn't add a new migration). Anyone who was impacted by
it most likely simply rejoined AD after failure on upgrade.
(cherry picked from commit 1d6e57042f6b636513a60337ebedeeb89e93a22d)
NAS-145547 / 28.0.0-BETA.1 / Fix autorid migration (#20352)
Prior to TrueNAS 25.10 we exposed a non-default idmap backend for Active
Directory (added in TrueNAS 9.10) that users really shouldn't have been
using because it was non-deterministic in ways that are quite painful to
fix. We removed the backend in 25.10 and had a best-effort migration to
put the user into something equivalent that wouldn't require redoing
ACLs. Overall, the backend was rarely used and so an edge-case in the
migration was missed until recently. This commit fixes the migration
in-place (e.g. doesn't add a new migration). Anyone who was impacted by
it most likely simply rejoined AD after failure on upgrade.
[mlir][python][dsl] Move the DSL to mlir/python/mlir/dsl
The package moves from mlir/tools/mlir-dsl to the root Python package and
its tests to mlir/test/python/dsl, so they use the lit configuration of the
Python bindings. The MLIR_ENABLE_PYTHON_DSL option and the check-mlir-dsl
target are removed: the DSL is built and tested with the bindings.
Co-Authored-By: Claude Fable 5.2 <noreply at anthropic.com>
[Attributor][NFC] Remove AAValueSimplify
Unused since bf789b1957ef replaced it with AAPotentialValues. Seed
AAPotentialValues instead in allow_list.ll.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[ValueTracking] Fix arg conflation in ComputeMaxSignificantBits (#248129)
The function llvm::ComputeMaxSignificantBits passes a Depth integer in
place of the UseInstrInfo boolean to ComputeNumSignBits, which was
unflagged to date due to implicit conversions. Fix this.
Assisted-by: llm, for testing
[flang] Optionally warn when a structure constructor nulls a pointer subcomponent (#247865)
When a structure constructor omits a component whose type has default
initialization, that component gets the default initialization.
In the case where a pointer subcomponent has no initializer of its own,
the standard (F'2023 7.5.10 p3, 19.5.2.2 p1, 7.5.4.6 p7) specifies that
it is undefined. However, flang makes such a pointer subcomponent
NULL().
This PR adds a usage warning for it which is off by default. The
warning is enabled by -pedantic or -Wdefault-init-null-pointer.
The existing -Wdefault-struct-constructor-null-pointer warning catches
cases
where the pointer is omitted directly. This PR and
-Wdefault-init-null-pointer
cover a pointer nested inside an omitted component.
Follow-up to #247370.
Assisted-by: AI
net-im/continuwuity: Update to 26.11.0
Experimental features are now opt-in and have to be enabled in the new
experiments section, and support for unauthenticated media is gone along
with the allow_legacy_media and freeze_legacy_media options. The
release also carries security fixes.
Changelog: https://forgejo.ellis.link/continuwuation/continuwuity/releases/tag/v26.11.0
Sponsored by: Netzkommune GmbH
[PowerPC] Enable SlotIndexes compaction by default
Greedy measures live ranges in slot indexes, and instructions erased
before allocation (by PHI elimination, two-address lowering and the
coalescer) leave entries behind that make ranges look longer than
they are. Opt PowerPC in to dropping them, as AMDGPU and ARM do, so
allocation works with real distances. Passing
-greedy-compact-slot-indexes=false restores the old behaviour.
On CTMark (pwr8, pwr10, AIX, ppc32), .text and llc compile time move
by less than 0.03% and evictions drop by 1.5-5.8%.
The test updates are register allocation changes; csr-split.ll gets
back the live range split it was written to check.
[RISCV] Fix RVV callee-saves in realigned frames
The prologue saves RVV callee-saved registers before it realigns SP
and sets up BP, but their slots were addressed from the realigned SP
or BP. The epilogue reloaded them from the wrong address, BP frames
stored them through the caller's s1, and their CFI was wrong.
Address these slots from FP, which does not move, and derive their
CFI from getFrameIndexReference so the two cannot diverge.
Fixes #244792
[RISCV] Add tests for RVV CSRs in realigned frames
Precommit the tests for #244792 so that its fix shows up as a diff.
The checks record the current, wrong output: the prologue saves the
vector callee-saved registers before it realigns the stack, and the
epilogue reloads them from a different address.