[LLVM][docs] Finish MyST migration for remaining docs (batch 11) (#223100)
Migration notes:
- I left several eval-rest blocks in `TableGen/ProgRef` which uses EBNF
production lists to define grammars. This apparently doesn't work in
myst.
- Accidental list blockquotes were converted to native lists. The
project-layout and Makefile entries in `Projects` are native definition
lists.
Tracking issue: #201242
See the [migration guide] for more information.
[migration guide]:
https://llvm.org/docs/SphinxQuickstartTemplate.html#markdown-migration-guidelines
This is a stacked PR based on #223098, which is a standalone commit that
renames *.rst -> *.md before this PR lands for history preservation
purposes.
This was prepared with rst2myst plus LLM-assisted cleanup.
[LLVM][docs] Rename remaining reST docs to Markdown (batch 11) (#223098)
Tracking issue: #201242
See the [migration guide] for more information.
[migration guide]:
https://llvm.org/docs/SphinxQuickstartTemplate.html#markdown-migration-guidelines
This is the initial straight rename commit. It will probably break the
docs build, but it has to be a separate PR for blame preservation
purposes.
The stacked conversion and cleanup is in #223100.
[clang][bytecode] Lazily evaluate static variables (#208794)
They usually go through `evaluateAsInitializer()`, which is where we
register them as global variables. But if they're imported, they don't.
Just try to evaluate them in `VisitMemberExpr()`.
[clang-tidy] Add null-checking in Use designated Initializer check (#220093)
Part of #219739
This null check should avoid null dereferencing crash in the Use
designated Initializer check.
AI has been used in this contribution to understand the code as I'm a
beginner to the codebase. The problem understanding and proposed fix is
mine.
[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
```
[X86] Prevent legalization cycles in lane-permute shuffle lowering (#224265)
When a cross-lane shuffle reproduces the original mask, trying a finer
sublane size can produce a decomposition that legalization transforms
back into the original shuffle. This causes legalization to cycle
indefinitely.
Stop trying finer sublane sizes when this condition is detected, and add
a regression test for the shuffle that previously caused `llc` to hang.
Fixes #224266
[ConstraintElim] Add isNoWrap overload taking opcode + ops (NFC). (#224758)
Add overload that is independent of an IR value/instruction, and only
takes opcode + operands.
This prepares for using it in saturating/overflowing op simplification
in follow-ups.
PR: https://github.com/llvm/llvm-project/pull/224758
[AArch64] If-convert diamonds merging a 128-bit vector (#220616)
canInsertSelect handles GPRs via csel and 32/64-bit FPRs via fcsel, but
returns false for everything else. For example, EarlyIfConversion
flattens a diamond merging a v4i16 but leaves the equivalent v4i32
branchy.
We can create a conditional select similarly to how vector selects are
lowered in the backend by spreading the condition into an all-1's /
all-0's mask and use a bit select.
Assisted-by: Opus 5.0
[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.