[MLIR] Preserve operand segment sizes when removing dead inputs (#223154)
`RemoveDeadRegionBranchOpSuccessorInputs` was calling `eraseOperands`
and ignoring potential `AttrSizedOperandSegments`. Trying to use
`populateRegionBranchOpInterfaceCanonicalizationPatterns` on downstream
control flow op with it resulted in broken IR. Update the segments sizes
if present.
Also fix LLVM dialect `CallOp` and `InvokeOp` `getArgOperandsMutable`
which were dropping segment sizes and a parser bug uncovered by the
tests.
Code was vibed and then edited, tests were vibed and not particularly
edited.
ARM: Fix mixed dead and not-dead LR operands in vlldm-vlstm-uops.mir
This operand list had LR listed twice, once from its implicit-defs on
the instruction definition, and another in the variadic argument list.
One had a dead flag, and the other didn't which should be a verifier error
in the future, so remove the redundant operand.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
LoongArch: Simplify handling of call pseudo operands when expanding.
copyImplicitOperands isn't really intended for the call instruction case
where there are also variadic operands. This avoids duplicating the R1
implicit-def operand when expanding calls. This avoids having mixed dead
and not dead flags on the same register, which will fail a future verifier
check.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[SelectionDAG] Allow PARTIAL_REDUCE_SUMLA in getPartialReduceMLS (#220886)
foldPartialReduceMLAMulOp turns
partial_reduce_*mla(acc, neg(mul(sext(a), zext(b))), splat(1))
into a PARTIAL_REDUCE_SUMLA node and, because of the negation, builds it
through SelectionDAG::getPartialReduceMLS. That helper only accepted
UMLA
and SMLA, so the mixed-sign case hit its "Unexpected opcode" assertion
whenever the target marks SUMLA as legal or custom for the transformed
types. The loop vectorizer produces exactly this shape for a reduction
chain that mixes adds and subs, e.g.
acc += (int)s8_a[i] * (int)u8_b[i];
acc -= (int)s8_c[i] * (int)u8_d[i];
so this crashed at -O2 in builds with assertions enabled on AArch64 with
+dotprod, and since #205373 also on X86 with AVX512-VNNI (release builds
[9 lines not shown]
[Option] Store the StringTable by value. NFC (#224818)
Suggested by
https://github.com/llvm/llvm-project/pull/224805#discussion_r4052408942
A StringTable is just a StringRef. Hold it by value and build it from
the storage array in optionTables(), so the generated OptionStrTable
object (16 bytes of .data.rel.ro and a relocation per table) is
unreferenced and discarded, and string lookups skip a load.
Aided by Opus 5
[Mips] Remove experimental warning bits in a few places (#223230)
- Remove the warning message "warning: MIPS-I support is experimental" from
MipsSubtarget.cpp. The warning can interfere with build systems that do not
expect diagnostic output on stderr.
- Remove experimental / highly experimental from a few MIPS processors.
MIPS I is on track and the rest I wouldn't consider experimental anymore.
[orc-rt] In SimpleRemoteCA, carry tag field as uint64_t (#224814)
A message's tag field is a 64-bit value on the wire, so carry it as a
uint64_t inside SimpleRemoteCA and only convert to an ExecutorAddr or
ResultKind only where needed, with validation.
[Option] Shrink Info from 40 to 24 bytes (#224807)
Few options set MetaVar, AliasArgs, Values, help text variants, or
subcommands (12%, 4%, 4%, 0.1%, 0.06% of 6955 options), yet every entry
carries all five. Move them to a deduplicated InfoExtra side table
reached by a 16-bit offset; row 0 serves options that set none. Narrow
Visibility to 16 bits; clang uses seven.
clang's table shrinks from 155 KB to 93 KB plus 4 KB of extras.
Aided by Opus 5
[AMDGPU] Fold 24 bit multiply with zero low bits
Fold `MUL_I24` and `MUL_U24` to zero when either operand has known zero
low 24 bits.
For example:
```
llvm.amdgcn.mul.i24(x, 0x01000000) -> 0
```
[AMDGPU] Always optimize out llvm.amdgcn.mbcnt.hi in wave32 mode (#224573)
The instruction v_mbcnt_hi_u32_b32 does nothing useful in wave32 mode so
we can always optimize it regardless of the workgroup size.
[Option] Derive the prefix union in the constructor. NFC (#224813)
The union is a function of the prefix table, so compute it in the
OptTable constructor instead of emitting OptionPrefixesUnion and
carrying it in Tables.
LLM-aided, extracted from #224805
[libcxx] Avoid a busy-loop in atomic's lost_wakeup.pass.cpp (#211242)
Fixes #207763
On single-core or heavily loaded systems, using this_thread::yield()
prevents the notifier from burning all its allocated time on the
busy-loop.
The measurements were done on my Linux box, the time is the one reported
by lit. To isolate the test on a single core I used the following
commands:
export LIT_FILTER="wait/lost_wakeup.pass.cpp"
taskset -c 0 ninja -C build check-cxx
| Configuration | Linux futex | | Fallback | |
| -------------- | ----------- | ----------- | -------- | ----------- |
| | Normal | Pinned core | Normal | Pinned core |
| Before | 1.50s | 8.44s | 1.57s | 301.02s |
| With yield | 1.73s | 7.36s | 1.64s | 8.88s |
Both configurations are with the `run < 10` change.
[Option] Replace the OptionTables object with a function. NFC (#224805)
The generated `Tables` holds seven addresses, so needs dynamic
relocations in PIE and shared library builds:
```
static constexpr llvm::opt::OptTable::Tables OptionTables = {
OptionStrTable, OptionPrefixesTable, OptionPrefixesUnion, ...};
...
FooOptTable() : OptTable(OptionTables) {}
```
Emit a function instead. The caller builds the aggregate on the stack
from PC-relative addresses, which the linker resolves:
```
static constexpr llvm::opt::OptTable::Tables optionTables() {
return {OptionStrTable, OptionPrefixesTable, OptionInfoTable, ...};
}
[7 lines not shown]
[flang][cuda] Split realloc for host-accessible CUDA Fortran allocatable assigns (#224195)
Allow SeparateAllocatableAssign to peel reallocation off hlfir.assign
for
managed, pinned, and unified allocatables, using cuf.alloc/cuf.free so
the
CUDA Fortran allocator is honored. Device (and other
non-host-accessible)
storage still keeps the runtime realloc path as well as derived-type.
Drop the extra op-level MemFree on cuf.free so OptimizedBufferization
can
see the freed pointer. Without that, a valueless Free effect between the
elemental and the assign forced a temporary for cases such as
`a = int(ran*100)` on a managed allocatable in the example below.
```
subroutine foo(n, a, ran)
integer :: n
[7 lines not shown]
[CIR][SYCL] Emit attributes on the SYCL kernel caller (#224667)
Emit norecurse, mustprogress, and sycl-module-id.
This matches the classic behavior that is specific to the SYCL kernel
caller.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply at anthropic.com>
[lldb/test] Register the addressable_bits_scripted_process module with the script interpreter (#224803)
`test_scripted_process_addressable_bits` imported
`addressable_bits_scripted_process` into the test process, which makes
the module's constants available to the test but tells lldb's own script
interpreter nothing about it, so
`SBLaunchInfo::SetScriptedProcessClassName()` had nothing to resolve:
```
error: failed to create ScriptedProcess: failed to create script object:
Could not find script class:
addressable_bits_scripted_process.AddressableBitsScriptedProcess
```
Import the file with `command script import` the way the other scripted
process tests in this file do.
[WebKit Checkers][NFC] Extract hasGuardian from isPtrOriginSafe in RawPtrRefLocalVarsChecker (#224726)
So an upcoming borrow checker can skip it.
(A guardian variable is an independent declaration that ensures a
lifetime. Borrow checking does not accept guardian variables because
they do not convey `lifetimebound` links.)
Assisted-by: Claude
[lldb] Bound DataExtractor::PeekCStr to the data it reads from (#224452)
PeekCStr only validated the first byte without checking for a terminator.
Every caller then treated the result as a C string, so an unterminated
string table let strlen run past the mapping, causing a crash or
security bug.
Return an optional StringRef, produced only when the terminator lies
within the data. The length comes along with it, so callers no longer
rescan, and an absent string stays distinct from an empty one.
ValueObject was the only caller that wanted an unterminated buffer. It
scans fixed size chunks of inferior memory, so it now asks for bytes with
PeekData and bounds its own scan.
rdar://186891223
[lldb][FreeBSDKernel] Support cross-architecture FreeBSD kernel cores (#223593)
FreeBSD's kvm_open(3) man page states that a valid resolver is required
to debug non-native kernel images as libkvm needs to map symbol names to
kernel virtual addresses. Since ProcessFreeBSDKernelCore aims to debug
kernel image and core dump from any architectures, pass a valid resolver
to kvm_open2().
Assisted-by: GPT
[lldb][FreeBSDKernel] Avoid null dereference probing FreeBSD kernels (#223590)
CheckForKernelImageAtAddress() accepts an optional read_error pointer,
but dereferenced it unconditionally in many code paths. If read_error is
null, point read_error to a dummy local variable to prevent null
dereference.
Fixes: b3cc4804d45d6b612ac9b3cc47ebbb0da44ebc60
[lldb][FreeBSDKernel] Load unrelocated FreeBSD kernel sections (#223589)
Even though displacement is zero, we need to mark the module as loaded.
Fixes: 62d06083ef186abe610de4742c62c84c2f97fcd0
[clang][bytecode] Flip a boolean flag meaning (#224649)
We only use this flag once, when passing it to
`setFoldFailureDiagnostic()` (where we invert it), so it doesn't make
sense to call it IsCCEDiag.
[Support] Only enable use of /proc/self/fd on Linux (#222497)
Only enable the use of /proc/self/fd on OSes that provide
the compatible /proc/self/fd interface.