[AMDGPU][MC] Upstream gfx11/gfx12 true16 assembler test coverage
Upstream new assembler test cases, covering true16 .l/.h operands and op_sel
handling that had no upstream coverage.
[AMDGPU][MC] Upstream gfx12 true16 disassembler test coverage (#223825)
Upstream new gfx12 disassembler test cases, covering true16 operand
(.l/.h)
and op_sel decoding for f16 opcodes that had no upstream coverage:
[lldb] Bounds check minidump location descriptors (#223911)
MinidumpParser::GetModuleUUID sliced the file with the RVA and DataSize
taken straight from a module's CvRecord. ArrayRef::slice asserts, but a
build without assertions still reads out of bounds.
Route both through MinidumpFile::getRawData, which range checks in 64
bits, and log the error rather than returning a slice that looks valid.
rdar://186889966
rdar://186890172
[flang-rt][unittests] Define MAP_ANONYMOUS fallback for AIX in Assign tests (#224675)
We ran into
```
flang-rt/unittests/Runtime/Assign.cpp:497:21: error: use of undeclared identifier 'MAP_ANONYMOUS'
497 | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)};
```
On AIX, `flang-rt` is built with `_XOPEN_SOURCE=700` and without `_ALL_SOURCE`, which prevents `<sys/mman.h> `from exposing `MAP_ANONYMOUS` / `MAP_ANON`. Provide a fallback definition so mmap unit tests introduced in PR #222101 compile successfully on AIX.
[DebugInfo] Fix 32-bit overflow in AppleAcceleratorTable::equal_range (#224866)
Computing the end offset overflowed 32 bits before widening to 64 bits.
Because SameNameIterator stops on exact equality, a wrapped offset
caused an infinite loop.
Compute the product in 64 bits and return an empty range if the end
offset exceeds the section size.
rdar://186839483
[AMDGPU] Fold fpround of fadd and fsub into v_mad/fma_mixlo and mixhi
MadFmaMixFP32Pats turns (fadd x, y) into (fma x, 1.0, y) and (fsub x, y)
into (fma (-y), 1.0, x) so the mix instructions absorb the operation along
with the f16 or bf16 source modifiers. MadFmaMixFP16Pats and
MadFmaMixFP16Pats_t16 only did this for fmul, so a rounded result still
needed a separate convert for a rounding the mix instructions perform
themselves.
Unlike the f32 patterns these do not require an operand to be an fpextend
of an f16, since an fpround on the result always removes the convert. The
rewrite is exact because the mix instructions round the f32 result again
when they write the 16-bit destination, so it stays f32_to_f16(fma(x, 1.0,
y)).
Assisted-by: Claude Code Opus 5
[AMDGPU] Require flushed FP16 denormals for the mad-mix f16 results
v_mad_mixlo_f16 and v_mad_mixhi_f16 are the unfused gfx900 forms and flush
16-bit denormals, so a denormal half result is written as zero even when the
FP16 mode asks for it to be kept, while the patterns only required the FP32
mode to flush and that is the one a HIP compile turns off on its own.
Assisted-by: Claude Code Opus 5
[SystemZ][z/OS] Do not cache section definitions
If a section was seen before, `MCContext::getGOFFSection()` returns
that section for reuse. However, in most cases this is the wrong
behaviour. ED symbols, e.g. C_WSA64, need to be recreated instead of
being reused. The current code attempted that by constructing a
unique name including the name of the SD symbol. But this fails for
the DWARF EH data, because teh SD symbol is always the same. Therfore
the C_WSA64 section is shared across all DWARF tables, resulting in
a "invalid data" binder error.
To fix this, the caching of section object is removed.
ARM: Track CPSR liveness in Thumb2SizeReduction without kill flags
Thumb2SizeReduction narrows a 32-bit instruction to its flag-setting
16-bit form only when CPSR is dead afterwards. It determined this from
kill flags on CPSR operands. Kill flags have been semi-deprecated
for over a decade, so avoid relying on them. Liveness should be evaluated
as a reverse walk over a block.
The existing forward walk over the block is still necessary as a separate
step for the different A9 avoidCPSRPartialUpdate optimization.
Co-Authored-By: Claude claude-opus-4.8 <noreply at anthropic.com>
ARM: Use divmod type signatures from RuntimeLibcallsInfo
Start moving towards an API to emit calls from RuntimeLibcallsInfo's
knowledge about the type signature of a function instead of manually
computing an IR type from the EVT of the operation.
Also change the swap of arguments to be based on the libcall impl,
rather than the ABI since it's logically a property of the function
itself.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
RuntimeLibcalls: Describe register-returning divmod libcall ABIs
Teach RuntimeLibcallsInfo::getFunctionTy about the ARM AEABI
(__aeabi_*divmod) and Windows (__rt_*div*) divmod sigantures. Currently
the custom lowering to these calls hardcodes the call signature information,
but in the future this should be automatically handled.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
AArch64: Fix duplicating VG def operands in isel pseudo expansion (#225113)
Previously MSRpstatePseudo's handling would produce a duplicate VG operand.
AdjustInstrPostInstrSelection added an implicit VG use/def and an FPMR def. It's
dubious to introduce a def in the output which wasn't already present in the input,
so fix the missing FPMR def. Also guard against re-introducing the operands for
instructions which already have the defs. Ideally there would not be any of these m
anual def add calls, but that is a larger fix.
This removes the duplicate operand and fixes potentially inconsistent
dead flags, avoiding a failure in a future verifier check.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
WebAssembly: Don't duplicate implicit CALL operands in LowerCallResults (#225069)
When recombining the CALL_PARAMS/CALL_RESULTS pseudo-pair into a real
CALL, LowerCallResults copied CallParams.uses() onto the new instruction.
uses() includes the implicit operands (implicit-def $arguments and the implicit
$sp32/$sp64 uses), which the freshly created CALL already carries. This
resulted in a duplicated implicit-def of $arguments. This avoids a
future verifier error.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[clang][CodeGen] Exempt lifetime marker cleanups in musttail check (#224731)
PR #219045 started emitting @llvm.lifetime.start and @llvm.lifetime.end
markers for block-scoped compound literals in C via
pushCleanupAfterFullExpr<CallLifetimeEnd>.
When a compound literal is evaluated inside a conditional branch,
pushCleanupAfterFullExpr wraps CallLifetimeEnd inside
EHScopeStack::ConditionalCleanup, which did not override
EHScopeStack::Cleanup::isRedundantBeforeReturn(). Consequently,
CodeGenFunction::EmitCall rejected [[clang::musttail]] calls when a
conditional compound literal was in scope at -O1 and above.
Because EHScopeStack::ConditionalCleanup wraps cleanups by composition,
virtual methods on EHScopeStack::Cleanup other than Emit() do not work
for conditional cleanups. Replace the virtual
EHScopeStack::Cleanup::isRedundantBeforeReturn() method with a
StackRestore bit on CleanupKind/EHCleanupScope alongside the existing
LifetimeMarker bit, and check EHCleanupScope::isRedundantBeforeReturn()
[5 lines not shown]
[clang] Migrate away from PointerUnion::dyn_cast (NFC) (#225022)
Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:
// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa<T>, cast<T> and the llvm::dyn_cast<T>
Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast
where the operands are known to be nonnull.
The operands are known to be nonnull in one of three ways:
- Preceding checks: A null check, assertion, or dereference a few
lines above guarantees the PointerUnion is nonnull.
- Downstream code: The else or fallthrough branch unconditionally
calls cast<...>, dereferences the pointer, or reaches
[6 lines not shown]
AArch64: Don't duplicate the branch's implicit defs in call pseudo expansion (#225064)
These pseudo expansions started with an implicit LR def and are replaced
with a new instruction with a different LR def. Previously this would copy the
old instruction's operand list, merging with the newly build instruction def
list. Avoid creating a redundant def with inconsistent dead flags. This avoids
failing a future verifier check.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>