[SystenZ][z/OS] Beautify HLASM output
Instructions are currently indented by 2 spaces, which makes the output
hard to read. This changes increases the indentation to 10, which improves
the readability. The indent is now controlled by a constant instead of
hard-coded spaces.
[SystemZ] Lower ISD::PDEP and ISD::PEXT on z17 using BDEPG and BEXTG
Implement custom lowering for ISD::PDEP and ISD::PEXT on IBM z17
(Miscellaneous-Instruction-Extensions Facility 4 / arch15).
z17 introduces BDEPG (Bit Deposit) and BEXTG (Bit Extract) instructions,
which operate on left-justified (MSB-first) bit fields:
- ISD::PEXT is lowered using BEXTG followed by a right shift (by 64 - popcount(mask))
to right-justify the extracted bits.
- ISD::PDEP is lowered by left-shifting the value (by 64 - popcount(mask)) to align
LSBs to the MSB, followed by BDEPG.
- For constant masks, popcount and shift amounts are computed at compile time.
- Scalar sub-i64 types (i8, i16, i32) are promoted to i64.
RuntimeLibcalls: Add attributes to operator new and delete
Annotate operator new and delete implementation variants. The nothrow
variants are nounwind. No library registers these yet so they don't
appear in the DeclareRuntimeLibcalls tests.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[Offload] Fix missing return in RPC callback registration test (#244709)
Return 0 from the callback stub in olRegisterRPCCallback.cpp to avoid
compiler warning.
---------
Co-authored-by: Joseph Huber <huberjn at outlook.com>
RuntimeLibcalls: Add attributes to printf variants
Give the integer-only and size-optimized printf variants the
attributes of the corresponding printf functions.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Add attributes to ObjC runtime calls
Mark the ObjC runtime functions nounwind, and mark the argument of
the functions whose intrinsics mark their argument returned.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Add attributes to libc libcalls (#244442)
Annotate C library functions with the attributes InferFunctionAttrs
gives. This isn't fully captured in the DeclareRuntimeLibcalls testing
because not all of these functions are yet associated with a library.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[OpenMP][OMPT] Enable OMPT on 32-bit PowerPC (#227540)
The tests' return-address offsets are the same as on LoongArch64: a nop,
optionally followed by one or two branches.
Tested with check-openmp under qemu-ppc with OMPT enabled.
Assisted-by: Claude Code
[OpenMP] Add __kmp_invoke_microtask for 32-bit PowerPC (#227541)
32-bit PowerPC ELF targets use the generic C++ `__kmp_invoke_microtask`,
which exits when a parallel region has more than 15 arguments, so
misc_bugs/many-microtask-args.c fails. Add an assembly version for the
SysV ABI, based on the ppc64 one.
AIX also defines `KMP_ARCH_PPC` and already has its own version in
z_AIX_asm.S.
Tested with check-openmp under qemu-ppc.
[CMake] Name languages explicitly in llvm_add_warning_options
Address review feedback: instead of a hardcoded C|CXX|ALL selector,
llvm_add_warning_options() now takes any number of enabled languages followed
by options. Arguments starting with '-' or '/' are options and everything
else is a language, which must already be enabled (checked against
ENABLED_LANGUAGES). Every option is added to every named language, and the
per-language lists are LLVM_WARNING_OPTIONS_<lang>.
The ALL selector is removed so that adding a language later cannot change the
meaning of existing calls; callers now say "C CXX". llvm_apply_warning_options(),
the -Wno- stripping and the runtimes fold-back loop iterate over the enabled
languages instead of assuming C and CXX, so languages such as Fortran work
once something populates their list. The helper is now a function, and the
temporaries introduced by this patch are unset after use.
LLM-aided
[AMDGPU] Keep soft waitcnts unchanged until SIInsertWaitcnts converges
On the first visit to a loop header only the preheader state is known.
A soft waitcnt there (e.g. from a release fence) can have some of its
counters simplified away while another counter keeps the instruction
alive: the fence's own vmcnt(0), a preceding wait.asyncmark, or an
explicit s_waitcnt. The soft waitcnt was then rewritten with the
simplified value and promoted to a hard waitcnt, or merged into a
preceding hard one. When the back edge later brought a pending LDS
store, the original lgkmcnt(0) request was gone, and the s_barrier after
the release fence no longer waited for it.
Treat soft waitcnts as requests that depend on the incoming state: never
merge, promote or rewrite them while the analysis iterates. They are
kept unchanged in DeferredErasures, a hard waitcnt (existing or new)
carries what is needed on each visit, and the soft waitcnts are erased
once the analysis converges. This extends #220357, which did the same
only for soft waitcnts that were simplified away entirely.
[11 lines not shown]
[AMDGPU] Pre-commit tests for soft waitcnt requests lost at a loop header (NFC)
Two cases where a soft waitcnt at a loop header loses its lgkmcnt(0)
request: on the first visit no LDS operation is pending, so lgkmcnt is
simplified away while vmcnt keeps the instruction alive (either the soft
waitcnt's own vmcnt, or a preceding hard vmcnt(0) it is merged into).
The DS write in the loop is then not waited for before the S_BARRIER on
the next iteration. The checks show the current, incorrect output.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
[OpenMP][flang] Score unknown context selector properties by selector (#232960)
Flang records an unknown property such as kind(bogus) or vendor(bogus)
as TraitProperty::invalid, which belongs to no selector. Under
match_any or match_none, where such a variant can still be selected,
the property therefore lost its selector's weight: kind(bogus) added
nothing, while an unmatched kind(gpu) adds 2^l, where l is the number of
constructs in the context. A score on a selector that mixes known and
unknown properties was also added twice, once for the known property and
once for invalid, and unknown properties in different selectors shared
a single score.
Add VariantMatchInfo::addUnknownTrait, which keeps the property
unmatched and records its selector and score, and score that selector
like any other. Use it in Flang. Clang drops unknown properties while
parsing and is unaffected.
Fixes: https://github.com/llvm/llvm-project/issues/233029
Assisted-by: GitHub Copilot (Claude Opus 5.5)
[clang] Ensure the AST file extracted from a PCM is aligned
The COFF object writer doesn't align section contents within the file, so
the `clangast` section of a `-fmodule-format=obj` PCM may start at an
unaligned offset. The readers use the AST file in place, which trips the
on-disk hash table alignment assertion.
Before #242384, the importing compiler instance copied the AST file out of
a freshly built PCM into a (suitably aligned) heap buffer, which hid the
issue for that PCM. However, reading the PCM from disk has always used the
memory-mapped file directly, which happens when:
* reusing the implicit module cache in a subsequent compilation,
* reading a PCM built by another process (while waiting on the lock),
* reading dependencies that already exist on disk,
* loading explicit modules or PCHs,
* building the global module index.
Since #242384, the freshly built PCM is no longer copied either, so the
assertion now fires on the very first compilation. Note that the reads
[8 lines not shown]
[clang] Make `PCHContainerReader::ExtractPCH()` return a buffer
`ExtractPCH()` used to return a view into the buffer holding the PCM,
leaving it up to the callers to keep that buffer alive. This patch changes
it to take the PCM buffer by-value and return the sub-buffer holding just
the AST file by-value as well. This gives the readers more room to decide
how the AST file is exposed, e.g. to make a copy when needed. No
functional change intended.
The callers are updated as follows:
* The importing compiler instance, the module manager and the global
module index builder extract the AST file once, up front. The
`SubMemoryBuffer` helper moves to the object file reader, the only one
that needs it.
* `ASTReader::ReadASTCore()` and `ModuleManager::addModule()` now rely on
the buffer already being extracted instead of extracting it again. This
relies on the in-memory module cache only holding extracted buffers,
which is why `ASTUnit::LoadFromASTFile()` extracts the AST file read from
stdin before adding it. As a side effect, `ModuleFile::SizeInBits` (used
[6 lines not shown]
[SystenZ][z/OS] Beautify HLASM output
Instructions are currently indented by 2 spaces, which makes the output
hard to read. This changes increases the indentation to 10, which improves
the readability. The indent is now controlled by a constant instead of
hard-coded spaces.
[LLDB] Halt the process before disabling an InstrumentationRuntime plugin
Disabling an InstrumentationRuntime plugin in a process destroys the
plugin instance. The plugins pass a raw `this` pointer as the baton for
their breakpoint callbacks so the plugin's breakpoint must not be hit
while the plugin is being destroyed.
`Process::SetInstrumentationRuntimeEnabled()` now refuses to disable a
plugin unless the process is stopped. When the `plugin disable` command
disables a plugin in a running process it halts the process, disables
the plugin and then resumes the process. The halt is not hidden so
clients see the process stop and then run again.
If the process happens to stop for another reason (e.g. a breakpoint)
at the same time as the halt it is still resumed. This is very unlikely
and is noted in a FIXME.
Enabling a plugin doesn't require the process to be stopped.
Assisted-by: Claude Code
[clang] Ensure the AST file extracted from a PCM is aligned
The COFF object writer doesn't align section contents within the file, so
the `clangast` section of a `-fmodule-format=obj` PCM may start at an
unaligned offset. The readers use the AST file in place, which trips the
on-disk hash table alignment assertion.
Before #242384, the importing compiler instance copied the AST file out of
a freshly built PCM into a (suitably aligned) heap buffer, which hid the
issue for that PCM. However, reading the PCM from disk has always used the
memory-mapped file directly, which happens when:
* reusing the implicit module cache in a subsequent compilation,
* reading a PCM built by another process (while waiting on the lock),
* reading dependencies that already exist on disk,
* loading explicit modules or PCHs,
* building the global module index.
Since #242384, the freshly built PCM is no longer copied either, so the
assertion now fires on the very first compilation. Note that the reads
[8 lines not shown]
[clang] Make `PCHContainerReader::ExtractPCH()` return a buffer
`ExtractPCH()` used to return a view into the buffer holding the PCM,
leaving it up to the callers to keep that buffer alive. This patch changes
it to take the PCM buffer by-value and return the sub-buffer holding just
the AST file by-value as well. This gives the readers more room to decide
how the AST file is exposed, e.g. to make a copy when needed. No
functional change intended.
The callers are updated as follows:
* The importing compiler instance, the module manager and the global
module index builder extract the AST file once, up front. The
`SubMemoryBuffer` helper moves to the object file reader, the only one
that needs it.
* `ASTReader::ReadASTCore()` and `ModuleManager::addModule()` now rely on
the buffer already being extracted instead of extracting it again. This
relies on the in-memory module cache only holding extracted buffers,
which is why `ASTUnit::LoadFromASTFile()` extracts the AST file read from
stdin before adding it. As a side effect, `ModuleFile::SizeInBits` (used
[6 lines not shown]