Coroutines: Only invalidate analyses of lowered functions in CoroCleanup
CoroCleanupPass already invalidates the analyses of the functions it
lowers, but then reported no preserved analyses, which clears every
cached function.
Also stop preserving CFG analyses for lowered functions, since noop
coroutine elision can change the CFG.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[KnownFPClass] Refine fadd/fsub for directed rounding modes (#243325)
Follow up to https://github.com/llvm/llvm-project/pull/242911
Part of https://github.com/llvm/llvm-project/issues/242935
Refines `KnownFPClass::fadd`, `KnownFPClass::fsub`, and
`KnownFPClass::fadd_self` for directed rounding modes:
- TowardZero cannot overflow to infinity.
- TowardPositive cannot overflow to negative infinity.
- TowardNegative cannot overflow to positive infinity.
- NearestTiesToEven/NearestTiesToAway: normal + subnormal never
overflows.
[orc-rt] Allow non-const ref params in alloc action handlers (#245478)
AllocActionFunction::handle now uses ArgForwardingTraits (shared with
WrapperFunction) to deserialize handler arguments and forward them to
the handler. Each argument is forwarded according to the handler's
declared parameter type, so in addition to by-value, const reference,
and rvalue reference parameters, handlers may now take non-const lvalue
reference parameters. These bind to the deserialized value.
To support this:
- ArgForwardingTraitsFor<C> is added to ArgForwardingTraits.h. It
provides the ArgForwardingTraits for callable type C's parameter types,
and replaces AllocAction.h's AAHandlerTraits.
- ForwardArgsAsRequested now returns the handler's result, and takes its
callable by value. The latter allows lvalue handlers, which
AllocActionFunction::handle previously accepted, to continue to work.
CloneFunction: Factor out pruned clone terminator folding
Remove the cleanup code after inlining unto a helper function which
will be reused in a future patch.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Add SME attributes to the AArch64 SME support routines
SMEAttrs currently assumes these attributes based on the function
name. Add them to the function definition so this code can be cleaned
up in the future.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Add attributes to __arm_sc_memcpy, memmove and memset (#244726)
The streaming-compatible variants behave like memcpy, memmove and
memset. Omit captures(none) since these can be used to implement
volatile memory intrinsics.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Prevent overread of pfsync received messages
Only reachable by a host that can deliver a pfsync packet to the sync
interface with IP TTL of 255.
OK sashan@, dlg@
RuntimeLibcalls: Add attributes to __clear_cache and __riscv_flush_icache (#244496)
Neither unwinds or captures its arguments. Leave the memory effects
unknown so calls aren't removed or reordered with the stores to the
flushed range.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Test the register pressure cases at -O0, too
A comment said that -O0 picks memory for "rm", which a direct output can't
use. At -O0 only an "rm" input still picks memory, and an output takes a
register for the fast register allocator to fold, which nothing tested end to
end. Add an -O0 RUN line, and fix the same claim in asm-constraints-rm.ll.
Assisted-by: Claude Opus 5.5
Include what the folding uses, and fix two comments
Include STLExtras.h, <algorithm>, and <limits> for the helpers that the
folding code uses. tiedUseMustCopy() had been put between lowerTiedUse() and
its comment, and the reason given for not folding a subregister operand was
wrong: it's that a subregister def would lose the register's other lanes.
Assisted-by: Claude Opus 5.5
Fix the rm_and_m comment
It said that the stack slot's memoperand isn't added to an asm that accesses
other memory without memoperands, but the asm gets one for any memory along
with the slot's.
Assisted-by: Claude Opus 5.5
Assert that an operand is folded, and fix the tied-use comments
The loop that finds the first operand to fold relies on there being one,
which nothing checked. The comments also said that every operand of the
register is folded, but a use tied to another register's def keeps its
register.
Assisted-by: Claude Opus 5.5
Fix the comments in greedy-inline-asm-fold.mir
The C source of tied_rm_before_tied_r had the MIR clobber list pasted over
CLOBBERS, ALL_GPRS wasn't defined, and the header said that one value is
spilled, where the checks show several. Nothing said that the qm tests' MIR
is written by hand, which their C can't produce: instruction selection never
makes a "Qm" operand foldable, and gives an i8 "Q" operand GR8_ABCD_L.
Assisted-by: Claude Opus 5.5
[X86] Keep the implicit zero extension when folding a zero operand (#236135)
`foldImmediateImpl` turns a 32-bit ADD/SUB/OR/XOR with a zero operand
into a COPY. On x86-64 the 32-bit instruction also zeroes the upper 32
bits, and a `SUBREG_TO_REG` user may rely on that. After coalescing, the
COPY leaves the upper bits of the source in place. In #213979 a jump
table index is then computed from those bits.
This patch uses MOV32rr instead of COPY when the result is a 32-bit
register on a 64-bit target.
Fixes #213979
Assisted-by: Claude Opus 5.5
---------
Co-authored-by: Phoebe Wang <phoebe.wang at intel.com>
[orc-rt] Move ForwardArgsAsRequested into its own header. NFC. (#245474)
Moves the arg-tuple type and ForwardArgsAsRequested utility out of
WFHandlerTraitsImpl in WrapperFunction.h and into a new
ArgForwardingTraits class template in ArgForwardingTraits.h.
WFHandlerTraitsImpl now inherits from ArgForwardingTraits.
This will allow the utility to be re-used by AllocActionFunction in an
upcoming patch.
snp(4): drain snp_outpoll before destroying the open data
kib' note: comparing to the original submission, seldrain() is called
before cv_destroy().
PR: 301062
MFC after: 1 week
[Clang][AST] Do not lower the alignment of `_Atomic(T)` below that of `T` (#239264)
Fixes #111295
`getTypeInfoImpl` rounds the size of `_Atomic(T)` up to a power of two
and then sets the alignment equal to that size. When `T` is more aligned
than it is wide, e.g. `typedef __attribute__((aligned(8))) int`, this
lowers the alignment, `_Atomic(T)` ends up less aligned than `T`, and
`AtomicInfo` asserts on every access.
The alignment is now only raised to the size, never lowered. Whenever it
is not raised, the value type's alignment requirement is kept as well,
so record layout places such a member like a plain `T`, including under
`#pragma pack` in the Microsoft layout. This matches GCC behavior.
AI was involved!