SelectionDAG: Use the memory type for atomic libcall actions
The atomic libcall selection is driven by the memory type, not the
legalized value type. Convert targets to use the LibCall action
instead of Expand.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[BoundsSafety][Docs] Add an index page and upstream status for -fbounds-safety (#238142)
Move -fbounds-safety docs into BoundsSafety/ without changing their
content.
Add BoundsSafety/index.md as the landing page for the -fbounds-safety
docs. It covers how to contribute, standardization efforts in WG14,
open-source adoption efforts, RFCs, and talks.
Add upstream status and the link #238453, which lists what is available
upstream, what is in progress, and what is planned, with links to the
relevant PRs and issues.
Leave a stub at the old BoundsSafety.html location so existing links
keep working.
Assisted-by: Opus 5.5
[clang][APFloat] Print floating-point literals in the shortest round-trip form (#218471)
StmtPrinter printed a `FloatingLiteral` at the maximum round-trip
precision, so `3.14` printed as `3.1400000000000001`. This patch adds
`APFloat::toStringShortest` and calls it from `PrintFloatingLiteral`.
NaN, infinity, and zero keep the old path.
`toStringShortest` computes the shortest digit count from the value's
rounding interval (Ryu's formulation with a Dragonbox-style grid anchor)
in exact APInt arithmetic, so every IEEEFloat semantics works. The
existing `toString` then formats at that count and the round trip is
verified. PPCDoubleDouble keeps a plain probe from precision 1.
Two cases keep the natural-precision form:
- An integer in fixed notation has exact digits; a shorter form would
only switch it to scientific notation. `100.0` prints as `100.`, not
`1.0E+2`.
- The largest value of a format with neither infinity nor NaN parses
back from any larger string by saturation, which is not a round trip.
[24 lines not shown]
RuntimeLibcalls: Declare vector libcall attributes in TableGen
Replace the type-based heuristics for vector math libcall attributes
with attributes declared on the libcall definitions, emitted with the
same attribute table helpers as intrinsics.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
TableGen: Move attribute set and sequence table helpers to a header
Move AttributeSetTable and AttributeSequenceTable out of
IntrinsicEmitter into a reusable header so the runtime libcall emitter
can use the same encoding.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Mark vector libcall out pointers dereferenceable
The whole vector width will be written, so mark the vector width. To
maintain the element width alignment for some functions, we need to
start explicitly tracking if the element alignment is used or not.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
TableGen: Unique intrinsic attribute tables by attribute value
Unique the intrinsic attribute tables by the attributes themselves
rather than by CodeGenIntrinsic, and separate the uniquing from the
emission in AttributeSetTable and AttributeSequenceTable so other
emitters can reuse them.
This also fixes MaxNumAttrs, which was computed from one representative
intrinsic per argument attribute sequence and could undercount.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[SimpleLoopUnswitch] Do not let droppable instructions block trivial unswitching (#238292)
In a loop such as
```c
for (...) {
__builtin_assume(i < n);
if (c) break; // c is loop-invariant
...
}
```
the invariant exit should be unswitched trivially as `c` is checked once
before the loop with no copy of the loop. Instead, the assume stops
trivial unswitching since the pass gives up at any instruction that may
have side effects before the branch, and `llvm.assume` claims to write
memory so that it is not deleted as dead code. The loop then goes
through non-trivial unswitching, which duplicates the loop body.
Skip droppable instructions (`llvm.assume`, `llvm.pseudoprobe`,
`llvm.experimental.noalias.scope.decl`) in that check. LoopDeletion uses
the same principle.
[Clang][Driver] Forward -f[no-]vectorize to clang-linker-wrapper and LTO (#231693)
Forward -fvectorize and -fno-vectorize through clang-linker-wrapper to
device compiler invocations.
The frontend flags are translated into -vectorize-loops=<0|1> for the
LTO backend, mirroring the existing SLP vectorization handling.
Assisted by gpt-5.6.
[AMDGPU] Reapply "Support the RF and m inline asm constraints (#195123)" (#232540)
Relanding 6b58e144bee8, reverted in 6b804fdec943 due to a CI failure in
hazard-inlineasm.mir.
Root cause: the original commit fixed an incidental problem by adding
`&& !MI.isInlineAsm()` to the `isGenericOpcode` early-return in
SIInstrInfo::verifyInstruction, which caused the verifier to actually
check INLINEASM instructions. This exposed stale RC ID encodings in the
raw flag integers in hazard-inlineasm.mir. The original commit fixed
those values, but they became stale again at the time when the commit
was merged.
Fix: recompute all five INLINEASM flag operands using current RegClassID
assignments.
Original description:
This patch supports the RF inline asm constraint for memory operands in
the flat address space as well as the generic 'm' constraint.
[CMake] Pass through -DCMAKE_MAKE_PROGRAM= when generating profdata for clang (#225970)
Since we're already passing the -DCMAKE_GENERATOR through, we need the
corresponding CMAKE_MAKE_PROGRAM, which CMake doesn't always know how to
find itself.
rdar://187916126
NAS-142270 / 28.0.0-BETA.1 / Add Webshare MCP option (by Qubad786) (by bugclerk) (#20126)
## Context
Webshare ships an MCP server configured through the `mcp` block of the
webshare-auth config, and there was no way to turn it on from
middleware.
## Solution
- **New settings**: `webshare.update` accepts `mcp_enabled`,
`mcp_allowed_groups` and `mcp_allow_write`, which are rendered into the
`mcp` block. `allowed_hosts` is left unset.
- **MCP groups must be login groups**: webshare only checks login groups
at OAuth consent, while token refresh and session spawn check only the
MCP groups, so every MCP group must be `truenas_webshare` or an entry of
`groups`. Otherwise MCP access could outlive Webshare access. Enabling
MCP without a group is rejected, since webshare denies everyone on an
empty list.
- **Canonical group names**: MCP groups are resolved through NSS,
compared by gid and stored under their canonical name, so a directory
[10 lines not shown]
[AMDGPU] Clear NoPHIs after SIFixSGPRCopies under the new pass manager (#238429)
SIFixSGPRCopies can build waterfall loops, which add PHIs. The legacy
pass declares that it clears NoPHIs, but the new pass manager's
SIFixSGPRCopiesPass declared no properties and never applied them. So a
function kept NoPHIs after the pass added a PHI, and the machine
verifier rejected it. Declare the cleared property and apply it with
MFPropsModifier. The test waterfalls a buffer load's resource under both
pass managers.
[AMDGPU] Use the mul24 result width for known bits
Extend the low 24 operand bits to the destination width before multiplying. Using the i32 operand width for i64 results can incorrectly fold upper product bits to zero.
Cover signed and unsigned i64 results and restore the bf16-to-i128 sign-extension checks affected by the incorrect inference.
[AMDGPU] Track GlobalISel known bits for mul24 intrinsics
Sign or zero extend the low 24 operand bits before querying KnownBits::mul. This allows GlobalISel to narrow shifts and simplify address calculations through mul24 intrinsics.
Cover ignored high bits, zero operands and overflow, and update the affected codegen checks.
[KnownBits] Cover negative multiplication boundaries
Exercise both operand orders and i8, i32, i65 and i128 results. Preserve cases where zero or signed and unsigned wraparound prevent leading-bit inference.
TableGen: Keep the instregex prefix for patterns with a top-level ?
instregex discarded a pattern's literal prefix, and ran the regex on
every instruction, if the pattern had a ? outside parentheses, as in
LDPS?Wi. A ? only makes the atom before it optional, and an atom
directly before it is already dropped from the prefix. Only a top-level
| makes the prefix unusable.
AArch64GenSubtargetInfo.inc tablegen run:
Gigainstructions Gigacycles CPU seconds
Before 44.6 18.8 5.7
After 43.1 (-3.4%) 17.8 (-4.9%) 5.4 (-4.6%)
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[CIR][NFCI] Prepare LLVM lowering patterns for one-shot conversion (#235196)
One-shot conversion (which speeds up LLVM lowering significantly) erases
the root op as soon as a pattern replaces it, so any read of the op past
that point is a use after free. Capture the values the lowering patterns
reuse after the replace: the parent location and module in the
CIRAttrToValue visitors and the MemSet alignment. AtomicXchg is split
into create plus replace so the forward helpers still see a live op.
Region type conversion also moves ahead of the block moves in the FuncOp
and generic patterns, so a conversion failure leaves the body unmoved
for the driver to report.
[mlir][Presburger] Add PresburgerRelation::gist
Add PresburgerRelation::gist (and PresburgerSet forwarding overloads)
for a convex context and for a context that is itself a union of
disjuncts, following ISL's isl_map_gist / isl_map_gist_basic_map.
For a convex context, each disjunct is simplified separately with
IntegerRelation::gist; disjuncts that become empty are dropped and if any
disjunct becomes the universe, the universe is returned.
For a non-convex context, the trivial cases (universe set or context,
empty context, equal set and context, context being a subset of the
set) are handled first. Otherwise, the context is approximated by a
convex set. Instead of ISL's unshifted simple hull of the context and the
set, we use the universe together with all constraints of the disjuncts
of the context and of the set that are valid for every disjunct of the
context (checked with Simplex); including the constraints of the set
allows removing constraints that are implied by every disjunct of the
context even if they are not implied by the simple hull.
[mlir][Presburger] Add IntegerRelation::gist (context-based simplification)
Add IntegerRelation::gist(context), a port of ISL's isl_basic_map_gist
(uset_gist / uset_gist_full). It replaces the relation S by a relation
S' such that S' ∩ context == S ∩ context, with as few constraints as
possible: constraints of S that are implied by the context together with
the remaining constraints of S are removed, and the remaining constraints
may be rewritten using the equalities of the context. Outside of the
context S' may differ from S, so the result is only meaningful together
with the context. The result has at most as many constraints as S
(except that the constraints defining a division that is still used may
be restored, see below), never more local variables, and never involves
variables that S does not involve; in particular, locals of the context
are never introduced.
Trivial cases: an obviously empty context yields the universe; if the
intersection with the context is found to be empty later (inconsistent
combined equalities, a context that turns out to be rationally empty, or
an empty combined Simplex), the result is empty; an obviously empty S
[43 lines not shown]
[BoundsSafety][Docs] Track upstream status in a GitHub issue
Replace the BoundsSafetyUpstreamStatus page with a short summary in the
Upstream Status section of the index page, and link to a tracking issue
for the details. The per-feature tables and PR links change often, and
are easier to keep up to date in an issue than in the docs.
Assisted-by: Sonnet 5.5
[BPF] Sign-extend constants folded from sign-extending loads (#238316)
`PreprocessLoad` replaces a load from a constant global with the
constant value, but always zero-extends it. On v4, where LDSX is legal,
the load can be a `SEXTLOAD`, and the sign extension is lost:
```
struct S { signed char a; };
static const struct S g = { -1 };
long f(void) { return *(&g.a); }
```
clang --target=bpf -mcpu=v4 -O0: r0 = 255 ; should be -1
At -O1 and above the load is folded in IR first, and clang folds a plain
`g.a` itself, hence `-O0` and `*(&g.a)`.
Sign-extend the folded constant when the load is a `SEXTLOAD`.
[CIR][EH] Drop personality from functions without landing pads (#236322)
Match classic codegen, which sets a personality only where it emits
landing pad and erase the personality declaration once it is unused