clang: Decide optsize and minsize together with optnone
Instead of adding optsize and minsize everywhere and removing them
when the definition is optnone, only add them to definitions that are
not optnone. Also stop adding these to declarations.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Reapply "[AMDGPU] Support the RF and m inline asm constraints (#195123)" (#245801)
This reapplies #241996 (510874d1f795), which is a reapply of #195123,
minus the change to SIInstrInfo::verifyInstruction.
This patch supports the RF inline asm constraint for memory operands in
the flat address space as well as the generic 'm' constraint.
PR #241996 was reverted be #245558 because EXPENSIVE_CHECKS builds
failed several AMDGPU CodeGen tests (e.g. callbr.ll, pack.v2f16.ll,
llvm.maximum.f32.ll) with "Bad machine code: inlineasm operand has
incorrect register class". Those failures were caused by the change to
SIInstrInfo::verifyInstruction that stopped skipping INLINEASM, making
the existing inline asm register class check reachable. They are not
related to the RF/m constraint support itself.
The original patch is therefore split in two:
- This patch: RF and m constraint support only.
- A follow-up patch: enabling the inline asm register class check in
[3 lines not shown]
[Clang][Sema] Avoid unsigned overflow in sentinel call checks (#245549)
This fixes https://github.com/llvm/llvm-project/issues/245437. Adding
the sentinel offset to the fixed parameter count can wrap for large
offsets, allowing an out-of-bounds access to the argument list.
Check that the number of remaining arguments exceeds the offset before
looking up the sentinel. This preserves the existing warning when there
are too few variadic arguments.
Assisted-by: OpenAI Codex
[mlir][ArmSME] Do not lower masked scalable column reads to loops (#245014)
`LowerColumnTransferReadToLoops` ignores masks. This read becomes a loop
that loads every lane, so the masked-off lanes get memory instead of
`%pad`:
```mlir
%read = vector.transfer_read %src[%a, %b], %pad, %mask {in_bounds = [true, true]} : memref<?x?xf32>, vector<[4]x1xf32>
```
Under `vector.mask`, the loop is created inside the mask region, which
is invalid IR.
The pattern now skips both forms. For downstream users: lowering a read
with a mask operand may now fail, where before the mask was silently
dropped. Out-of-bounds reads are unchanged (see the TODO on the
pattern).
Tested with a negative test for each form. Not run on SME hardware.
[5 lines not shown]
clang: Only emit the M68k interrupt vector alias for the definition
The target hook runs for the declaration of an interrupt handler and
again for its definition, so the __isr_N alias was emitted twice. A
declaration-only handler also produced an alias of a declaration.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
clang: Stop marking M68k and MSP430 interrupt handlers noinline
There seems to be no rationale for marking these as noinline, and no
other target does this. This helps avoid another source of IR
attributes reading existing IR attributes.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
clang: Remove HLSL checks for a preexisting noinline
SetLLVMFunctionAttributesForDefinition only adds alwaysinline to
functions that are not already noinline. Nothing marks these functions
noinline before this point. The HLSL entry functions are marked
noinline, but they are created separately and never reach here.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
IR: Remove trailing space from printed AVR calling convention names (#245831)
avr_intrcc and avr_signalcc were printed with a trailing space, which
produced a double space before the return type.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
improve intel S3 suspend/resume
move intel QI to use wait completion indication, range invalidation follows
various register and descriptor definition fixes
ok kettenis@
[X86] Schedule ENDBR32/ENDBR64 as WriteNop instead of WriteSystem (#245739)
`ENDBR32`/`ENDBR64` only mark valid indirect-branch targets for CET, and
they are NOPs on processors without CET. They were scheduled as
`WriteSystem`, which every X86 model treats as a very expensive
microcoded instruction (znver3: 100 µops, 100-cycle latency). As a
result, llvm-mca greatly overestimates the cost of any analysed region
that includes a CET function entry (`-fcf-protection` is the default on
several distributions).
This patch schedules them as `WriteNop`, the same class used for the
other no-op encodings in `X86InstrSystem.td` (segment and address-size
prefixes). It adds an llvm-mca test covering x86-64, skylake, alderlake,
znver3 and znver4.
Effect on the #121344 kernel (GCC 15 `-Ofast`, Ubuntu default CET),
`llvm-mca -mcpu=znver3`, 100 iterations:
| | Total Cycles |
[14 lines not shown]
EC2: Set hw.dmar.enable="1"
Large EC2 "bare metal" instances route interrupts to APIC IDs > 255,
and unlike the "virtualized" instances, don't support extended APIC
destination IDs (since that's a hypervisor feature, and bare metal
instances have no hypervisor).
Enable the IOMMU for interrupt remapping; this unbreaks booting on
m8i.metal-96xl and variants thereof (e.g. c8in).
MFC after: 1 day
Sponsored by: Amazon
Tested on: c5n.9xlarge, c6a.24xlarge, c8in.96xlarge, c5.metal,
c6in.metal, c6a.metal, c7a.metal-48xl, c7i.metal-24xl,
c7i.metal-48xl, c8a.metal-24xl, c8a.metal-48xl,
c8i.metal-48xl, c8i.metal-96xl, c8in.metal-48xl,
c8in.metal-96xl, m5.metal, m8azn.metal-24xl
IR: Remove trailing space from printed AVR calling convention names
avr_intrcc and avr_signalcc were printed with a trailing space, which
produced a double space before the return type.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
IR: Add avr_builtincc calling convention keyword (#245825)
AVR_BUILTIN had no textual IR name so it was printed as "cc86". Use
the same avr_builtincc spelling the MLIR LLVM dialect already uses for
this calling convention.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
problem-reports: Ask for `git format-patch` patches
Although we prefer to receive patches by methods other than bugzilla
attachments, if a patch is going to be attached we'd like it to be a
`git format-patch` patch.
Reviewed by: jrtc27, linimon, adrian
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D62030
CodeGen: Constify atomic load and store expansion hooks
The atomicrmw and cmpxchg expansion hooks already take const
instructions.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
libc/time/localtime.c - fix bad tm_wday calc from TZ=<tzstring>
Simplified version of a patch supplied on the tz list, apparently
from FreeBSD, to correct overflow problems introduced by other
recent changes to the way the values are computed.
When using a TZ setting like TZ=UTC0UTC (where specifying the DST
abbreviation is important), and when time_t is 64 bits, the value
calculated for the tm_wday field of struct tm would underflow, and
be truncated when assigned to that int var, before it was reduced
modulo 7 (days/week) - the 64->32 bit truncation modified the
value incorrectly.
[SPIRV] Do not emit generic mIR after lowering (#245051)
As part of the target specific lowering finalisation steps we sometimes
might create a new type, for bitcasting. A consequence of this is that
for certain cases (e.g. for an array) we currently emit generic MIR
(e.g. a G_CONSTANT for the array size). This is invalid, as at this
point lowering is assumed to have completed, and thus no generic
constructs should be left. This change addresses that issue by setting
`EmitIR` to `false` where relevant - this required extending the
existing pointer creation interface. In the long run we want to move
these steps to pre-lowering (as an ominous pre-existing `TODO` states).
[Mips] Honor -mips-compact-branches=never for calls on R6 (#245145)
Since #241162 direct calls and tail calls on MIPS32/64 R6 always use
BALC/BC, even with -mips-compact-branches=never (clang
-mcompact-branches=never). Select JAL/TAILCALL on R6 when compact
branches are disabled.
Also:
- Restore the jal tests in MC/Mips/mips{32,64}r6/valid.s. jal is still
valid on R6.
- Restore the jal R6 coverage in lld mips-npic-call-pic.s and
mips-plt-r6.s, and add the balc case as an extra run instead.
- Add hasExtraSrcRegAllocReq to TAILCALL_R6 like the other tail call
pseudos.
- Drop the 64-bit JAL texternalsym pattern, which the generic iPTR
pattern now covers.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[CIR] Implement CIR va_arg lowering for AArch64 (#244729)
This change adds an AArch64-specific rewrite context subclass to handle
va_arg lowering.
AArch64 Windows and Darwin targets, which both require special handling,
are not yet implemented.
Assisted-by: Cursor / claude-opus-5.5