[CIR] Implement aligned-array-delete. (#216789)
This ends up being a pretty trivial implementation, since we just have
to add the additional i64 argument to the call. This patch adds that,
after threading the alignment through CIR.
Also, the type-aware and destroying deletes aren't valid on a array
delete, so replace those checks with 'assert' instead.
[Clang][CodeGen] Use ptrtoaddr for pointer diff (#210729)
We don't have to expose the provenance of pointers for pointer
subtraction, so use ptrtoaddr instead of ptrtoint if -fwrapv-pointer is
not set.
[CodeGen] Fix stale LiveIntervals regmask tables after MachineBasicBl… (#209610)
MachineBasicBlock::splitAt() moves the tail of a block -- including any
call instructions carrying register-mask operands -- into a newly
created block. When LiveIntervals is attached it calls
LIS->insertMBBInMaps() for the new block, which records the block with
zero regmask slots. That is only correct for a fresh, empty block:
because the tail (and its regmasks) was *moved* out of the original
block, the per-block RegMaskBlocks index for both blocks is left stale,
so checkRegMaskInterference() can miss a call clobber and the register
allocator can assign a live value to a clobbered physical register.
Add a LiveIntervals::splitAt(Orig, SplitBB) entry point that inserts
SplitBB into the SlotIndexes/regmask maps and then re-slices the moved
regmask slots out of Orig's RegMaskBlocks entry into SplitBB's
(RegMaskSlots is sorted, so the slots that moved are those at/after
SplitBB's start index). MachineBasicBlock::splitAt() now calls it in
place of insertMBBInMaps().
[13 lines not shown]
[flang][OpenACC] Fix crash on ATTACH/DETACH with an unresolved name (#216801)
`AccAttributeVisitor::EnsureAllocatableOrPointer()` passes the last name of the
designator to `IsAllocatableOrObjectPointer()`, which accepts a null `Symbol`
pointer and returns `false` for it. When the argument of an `ATTACH` or `DETACH`
clause fails name resolution -- for example a component reference whose derived
type could not be resolved -- that name's symbol is null, so control reaches the
error-reporting path, which then dereferences the same null symbol and crashes
the compiler.
Because the crash happens during name resolution, it precedes the point where
semantic diagnostics are emitted, so the compiler dies with no output at all
rather than reporting the errors that caused the name to be unresolved.
Reproducer:
```fortran
subroutine test_attach_unresolved
type :: ty
[13 lines not shown]
Hexagon: Fix early if-conversion crash on an undef PHI operand
Found by AI while working on something else.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
[NFC][MemProf] Remove unused memprofraw test file (#216778)
`llvm/test/Transforms/PGOProfile/Inputs/memprof_loop_unroll.memprofraw`
was created in https://github.com/llvm/llvm-project/pull/79433 for the
`llvm/test/Transforms/PGOProfile/memprof_loop_unroll.ll` test, but the
usage was removed in https://github.com/llvm/llvm-project/pull/165338 in
favor of an inline `.yaml` file. Remove the `.memprofraw` file and the
generator script.
malloc: Use ckdint.h helpers instead of WOULD_OVERFLOW
This serves to demonstrate some usage of the ckdint.h helpers. The new
version also generates better machine code on amd64 and arm64.
Reviewed by: kib, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
sys: Add sys/ckdint.h
We have a C23 stdckdint.h header for userspace, which provides checked
addition, subtraction and multiplication. We lack similar helpers in
the kernel, where they are regularly needed.
Let's just adopt the C23 macros. For bonus points, I added a wrapper to
ensure that ignored an return value is raised as an error by the
compiler.
Reviewed by: kib, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58773
[DSE] Stop double-counting the dead slice offset in shortenAssignment (#216227)
DSE marked the wrong part of a variable dead when a shortened store started
at an offset from its base object, leaving stale values visible in the
debugger for bytes the shortened store no longer covered.
shortenAssignment passed calculateFragmentIntersect both the materialized
destination and DeadStart * 8. DeadStart is that destination's offset from the
base object, and calculateFragmentIntersect already measures the destination
against the dbg.assign address, so this counted the same distance twice.
SROA and AssignmentTrackingAnalysis pass a base pointer and a separate offset
into it. DSE already passes the materialized destination, so its slice offset
is zero when DSE removes the beginning of the store and the size of the
surviving store when it removes the end. Remove OldOffsetInBits from
shortenAssignment.
Add coverage for the three affected cases. shortenBeginWholeFragment checks
that DSE unlinks the whole 12-byte assignment when it removes every byte the
[8 lines not shown]
AMDGPU: Capture G_PTR_ADD flags via m_MIFlags in getBaseWithConstantOffset
Read the nuw flag from the m_GPtrAdd match itself instead of a redundant
getVRegDef of the pointer register. NFC.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
AMDGPU: Use mi_match for G_BITCAST check in RegBankLegalize
Replace the getVRegDef + G_BITCAST opcode check in tryEliminateReadAnyLane
with m_GBitcast. NFC.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
AMDGPU: Use mi_match in isFPExtFromF16OrConst
Replace the getVRegDef + G_FPEXT/G_FCONSTANT opcode checks with m_GFPExt and
m_GFCst matchers. NFC.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
[mlir][AMDGPU] Enable useStrictPropertiesInAssemblyFormat
This is part of the migration to keeping inherent and discardable
attributes separate touched.
**Migration note:** this'll change the syntax of a bunch of `amdgpu`
dialect ops to keep inherent attributes out of the `attr-dict`.
Syntax changes:
1. Operations like the dpp operations have had their inherent operands
turned into oilists that use `name(value)` syntax, such as
`bound_ctrl(false)`, which also leads to the elision of default
values.
2. Buffer operations now use `boundsCheck(true/false)` before the main
operation (keeping the visibility from the old attr-dict) and have
moved to `sgprOffset(%offset)` and `indexOffset(constant)` as optional
syntax alements after the main specification.
3. WMMA operations also now have the same `attribute[(value)]` element
[15 lines not shown]
[mlir][ROCDL] Enable useStrictPropertiesInAssemblyFormat
**Migration note:** Separate out inherent and discardable attributes
on your `rocdl.*` operations and put a `<>` around the inherent ones.
This commit adds `prop-dict` clauses to all the ROCDL-dialect
operations that have inherent attributes but don't have better syntax
for them.
I looked at creating better syntaxes here, but these are fairly
low-level operations and it was hard to put together comma-separated
lists of optional arguments in tablegen. So I've gone with the rather
straightforward and consistent fix of adding in `prop-dict`s.
AI note: Claude did the changes here, I reviewed the designs.
Co-Authored-By: Claude Opus 5 (1M context) <noreply at anthropic.com>
[mlir] Don't print a stray space for a fully-elided prop-dict
**Migration note**: if you have a custom `prop-dict` printer, add a
leading space into the format - it'll no longer be printed implicitly.
The `prop-dict` printer generated by mlir-tblgen would always print
a space before dispatching to printProperties(). When every property is
elided (because it is bound elsewhere in the assembly format or matches
its default value) printProperties() prints nothing, leaving a stray
space in the output. We had a test TODO about this.
This PR makes the leading space the responsibility of the properties printer, so
it's emitted only when needed. The generic
printer in OpState::genericPrintProperties() and all in-tree custom
printers have been updated accordingly.
XeGPU had worked around the stray space by writing an empty space
directive (``) after prop-dict to suppress the space before ':'. Those
workarounds are now redundant, and removing them restores the normal
[6 lines not shown]
RISCV: Fix VL optimizer crash on an undef VL operand
Found by AI while working on something else.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
NAS-142192 / 25.10.7 / Don't let one registry failure abort the image update sweep (#19507)
## Problem
`ContainerImagesService.check_update()` catches only `CallError`:
```python
for image in images:
for tag in image['repo_tags']:
try:
await self.check_update_for_image(tag, image)
except CallError as e:
logger.error(str(e))
```
Anything else raised by the registry client escapes the per-tag handler
and aborts the whole sweep, so every image after the failing one keeps
whatever flag it already had. `check_update` is launched with
`create_task()` and nobody awaits it, so there is no user-visible
[38 lines not shown]
[libc] Add a couple of constants to elf.h. (#216784)
* STT_GNU_IFUNC is a GNU-specific ELF symbol type used to implement
ifunc's, which is often used in parser code.
* Add EM_PPC64 denoting 64-bit PowerPC architecture (in addition to
i386/x86, ARM, and RISC types we already support).