[bazel] Add subpackages for libc/hdr/... (#242520)
This PR creates subpackages for `libc/hdr/...` as part of
https://github.com/llvm/llvm-project/issues/238076.
The refactor was entirely generated by a one-off tool
[jtstogel/bazel-move-targets](https://github.com/jtstogel/bazel-move-targets)@1e51f7f
(LLM-written), since AFAICT there's no good standard tooling for this
kind of thing.
Generated by:
```
function new-pkg() {
pkg=$1
shift
bazel-move-targets move \
--workspace_root=utils/bazel/llvm-project-overlay \
--src_package=libc \
[9 lines not shown]
textproc/py-rst2ansi: unbreak py-b2 after py-docutils 0.22.4
The contributed patch includes the change I proposed and also fixes
a Python 3.14 issue.
The patch backports two fixes from upstream master:
- 81758ed drops the unused docutils.utils.error_reporting imports
(upstream issue #16), the same fix as attachment 274652
- 3728e16 passes an 8-byte struct winsize to the TIOCGWINSZ
ioctl in rst2ansi/get_terminal_size.py; Python 3.14 rejects
the old 4-byte
buffer with SystemError (upstream issue #18)
Also update pkg-descr and switch to pep517.
PR: 298414
Approved by: PopularMoment at protonmail.com (maintainer)
Obtained from: Patrick Crandol
clang/AMDGPU: Check constant argument ranges of builtins
These builtins take a constant argument that the IR verifier range
checks on the corresponding intrinsic. Sema didn't enforce this, so
you could write code that failed the IR verifier. Use the new Range
annotation on the builtins to fix this.
This only covers builtins that previously had no range validation at
all. Builtins already checked by the manual switch in SemaAMDGPU will
be converted separately.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[docs] Use intersphinx for LLVM cross-project links
Configure the LLVM documentation with the external project inventories it
references and replace absolute cross-project documentation URLs with
validated intersphinx document and reference roles.
Part of #214861
LLM-aided
[docs] Use intersphinx for Clang cross-project links
Configure the Clang documentation with the external project inventories it
references and replace absolute cross-project documentation URLs with
validated intersphinx document and reference roles.
Part of #214861
LLM-aided
[docs] Add a shared intersphinx inventory for LLVM projects
Define the documentation sites of the LLVM subprojects in one place so each
project's Sphinx configuration can resolve cross-project links through
intersphinx instead of absolute URLs. The mapping is not used by any project
yet; follow-up changes adopt it. Document the `inv:` link syntax in the Sphinx
quickstart so authors know how to write these links.
By default the inventories are fetched from the published sites, which keeps
developer builds fast and free of new dependencies. Setting
LLVM_SPHINX_INVENTORY_DIR makes a
build hermetic instead: an `inventory` Sphinx builder writes only `objects.inv`
for each project, and the HTML builds read them all from that directory, so every
link resolves with no network access, including links to labels added by the
same change and circular links. The tools and the runtimes are separate CMake
builds, so the utils/docs/hermetic_build project builds both as ExternalProjects:
first their inventories in parallel, then their docs in parallel. The
documentation CI workflow uses it and always builds all of the docs, because
the projects'"'"' docs now depend on each other.
[4 lines not shown]
[clang][deps] Flush the in-process module cache on a background thread
The in-process module cache keeps every PCM built during the lifetime of the
dependency scanning service in memory, and flushes them to disk at the end.
Long-running builds that scan many variants of modules (e.g. with different
search paths or macro definitions) accumulate tens of gigabytes worth of
scanning PCMs this way. Moreover, the final flush is single-threaded and
happens after all scanning work is done.
This PR makes the service start a background thread that flushes each PCM to
disk as soon as it's written, and then replaces its in-memory buffer with the
memory-mapped file. Readers of the in-memory buffer keep it alive on their own
(shared ownership), and importers of the freshly built PCM never wait for the
IO, since the file gets written without holding the entry lock. Reads and
timestamps are still served from memory. The final flush is kept, but only
writes PCMs the background thread failed to write. With
`-no-flush-module-cache`, nothing changes.
I tried several approaches, all measured on a scan of the macOS SDK where
[52 lines not shown]
[clang] Extract built PCMs from their container without copying
When a module is built implicitly, the importing instance extracts the AST
file from the module cache's view of the written PCM and stores a copy of it
in its `InMemoryModuleCache`. That's an extra heap copy of every built PCM,
kept alive for the lifetime of the translation unit.
This PR resolves the FIXME by storing a buffer that keeps the written PCM
alive and exposes just the AST file: the `__clangast` section for PCMs
wrapped in an object file (`-gmodules`), or the whole PCM otherwise. The
in-process module cache now shares the memory of its entry with the
importing instance, and the cross-process module cache gives it the
memory-mapped file.
For a regular implicit modules build importing Foundation and friends, this
reduces peak memory footprint from ~150 MB to ~100 MB. For a TU importing
Foundation with `-gmodules` (31 PCMs), the copy increased the peak memory
footprint by 12-17%.
[clang] Use the module cache's view of built PCMs
When building a module implicitly, the compiler hands the PCM contents to
`ModuleCache::write()` and then extracts the AST file from the PCH container
of its own buffer, storing a copy of it in the `InMemoryModuleCache` of the
importing instance.
This PR makes `ModuleCache::write()` return a buffer with the written
contents, which the importing instance now extracts the AST file from. The
in-process module cache returns a buffer sharing ownership of its entry, the
cross-process module cache returns the written file, read back from the same
file descriptor it was written through (memory-mapped for all but small
files). This is a prerequisite for storing the module cache's view in the
`InMemoryModuleCache` without copying it.
To support this, `writeImpl()` can now read the written file back from the
same file descriptor, guaranteeing we map exactly the contents we wrote and
making it immune to concurrent replacement of the file.
[4 lines not shown]
[clang][deps] Share ownership of buffers in the in-process module cache (#242382)
Previously, `InProcessModuleCache::read()` returned non-owning
references
to buffers stored in the cache entry. Since other threads may be reading
an entry while it gets written, the entry had to keep the buffer it read
from disk alive alongside the written buffer for the lifetime of the
service. This happens whenever a PCM read from disk turns out to be out
of
date and gets rebuilt.
This PR stores a single buffer with shared ownership in the entry and
makes `read()` return a buffer that keeps the contents alive. Writing to
the entry now simply replaces the buffer, and the previous one gets
released
once the last reader is done with it. This is a prerequisite for
evicting
buffers from memory.
[9 lines not shown]
[lldb] Use the indexed host shared cache for symbolication (#194998)
Add HostInfo::WithSharedCacheImage to look up a dyld shared cache image
directly by UUID, replacing the expensive repeated loading of the SC in
ObjectFileMachO's symbol table parsing. The new API takes a callback
that receives the retained image handle, ensuring it remains valid for
the duration of the call.
[ValueTracking] Propagate poison through lround and llround (#242066)
`llvm.lround` and `llvm.llround` (along with their constrained FP
variants) have the same poison-propagation semantics as `llvm.lrint` and
`llvm.llrint`. Add them to `intrinsicPropagatesPoison` so
`propagatesPoison` and `InstSimplify` fold poison inputs to poison.
Gemini was used to help generate this change and its tests.
Hexagon: Remove dead kill flag maintenance in HexagonQFPOptimizer (#239775)
The operands are virtual registers, which can no longer carry kill flags.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[bazel] Add subpackages for libc/src/... (#242489)
This PR creates subpackages for `libc/src/...` as part of
https://github.com/llvm/llvm-project/issues/238076.
`alias` targets are left for compatibility so that downstream targets do
not need to be updated in lock step w/ this PR.
The refactor was almost entirely generated by a one-off tool
[jtstogel/bazel-move-targets](https://github.com/jtstogel/bazel-move-targets)@1e51f7f
(LLM-written), since I couldn't find any standard tooling for this kind
of thing.
Generated with commands:
```
function new-pkg() {
pkg=$1
shift
[52 lines not shown]
Terminate the string fields of zfs_cmd_t and drr_toname
zfsdev_ioctl_common() terminates zc_name before the secpolicy and
handler functions see it, but zc_value and zc_string are left as
userland passed them. Several secpolicy and legacy handler functions
use them as C strings (property names, snapshot and bookmark names,
vdev paths and FRUs), so an unterminated value is read on into the
fields after it and can end up stored, e.g. as a vdev FRU.
Terminate zc_value and zc_string in the same place as zc_name.
The drr_toname of a receive's BEGIN record comes from userland too,
either in zc_begin_record or in the "begin_record" nvlist pair. An
unterminated drr_toname in a resumable receive's BEGIN record (a
malformed stream, received by a user with receive permission) is read
past the end of the field in dmu_recv_begin_sync(), and panics
txg_sync on kernels built with CONFIG_FORTIFY_SOURCE. Terminate it in
dmu_recv_begin(), after the BEGIN record has been checksummed, which
covers both ioctls.
[7 lines not shown]
ZTS: strings in fixed-size ioctl fields that fill them
zfs_cmd_t's zc_value and zc_string, and the drr_toname of a receive's
BEGIN record, are copied in from userland as they are, so a caller can
fill one to the end with no NUL. Only zc_name is terminated by the
kernel; the others are read as C strings that run on into whatever
follows them.
Add libzfs_unterminated_strings and its helper ioctl_unterminated:
- ZFS_IOC_VDEV_SETFRU with an unterminated zc_value and a marker in
zc_string: the FRU in the vdev label must be zc_value less its last
byte, before and after an export and import. Today it is zc_value
followed by the marker.
- A resumable receive of a truncated stream whose drr_toname is
unterminated: the resume token must name drr_toname less its last
byte. Today drr_toname is read past the end of the field, and on a
Linux kernel built with CONFIG_FORTIFY_SOURCE that panics txg_sync.
Then abort the receive and receive the whole stream.
[4 lines not shown]
textproc/groff-pdfmark. Updated Makefile to set the default "groff" in
the "pdfroff" shell script. "make" will also now build "pdfroff" rather
than just copying from the distribution.
[AMDGPU] Insert s_nop 0 for cross-wave VALU co-execution on gfx942/gfx950
On subtargets with FeatureGFX9CrossWaveVALUCoexecution, a SIMD can
co-issue VALUs of two waves, depending on both VALUs. While an older
wave issues a sequence of VALUs, a younger wave's VALU that cannot
be co-issued with them stalls, and so do the VALUs that follow it.
Inserting s_nop 0 in the older wave lets the younger wave issue that
VALU.
SIPreEmitPeephole now inserts s_nop 0 where this lets the younger wave
co-issue a sequence of VALUs. It does so only in small loops that
consist mostly of such VALUs, outside MFMA shadows, and when the
occupancy is not known to be 1.
-amdgpu-gfx9-cross-wave-valu-coexec-opt-threshold=0 disables the
transformation.
Assisted-by: Claude Opus 5.5
[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.