[AMDGPU] Re-implement splat scalar handling for packed 64-bit ops (#216896)
In instruction selection, we identify the splat scalar pattern and set opsel to 0.
The legalizer is responsible for moving SGPRs to VGPRs if opsel is not 0.
A future optimization could save SGPR copies for upper lanes since hardware
only reads the first SGPR.
This new implementation fixes the issue when an uniform value has to be
computed by a VALU-only instruction, and thus the result is in a VGPR. This will
lead to the missing data in the upper lane with the previous approach.
[docs] Parallelize Sphinx builds by default
Sphinx supports building documents in parallel with -j. Default LLVM_PARALLEL_SPHINX_JOBS to half the logical cores, rounded up, using CMake's native host system information query, and pass it to sphinx-build. If LLVM_PARALLEL_SPHINX_JOBS is explicitly set empty, omit the -j flag.
3-run hyperfine comparison for clean docs-llvm-html builds, removing the html output and doctree cache before each timing run:
before (no sphinx -j): 97.897 s +/- 1.231 s
after (-j 8): 52.334 s +/- 15.348 s
speedup: 1.87x +/- 0.55x
Validation:
- cmake -S llvm -B build-docs-preview-all
- ninja -C build-docs-preview-all docs-llvm-html
- hyperfine --runs 3 comparing docs-llvm-html before/after
- git diff --check
- scanned touched file for internal-only markers
[GISel][NewPM] Note we always modify MIR in IRTranslator
It turns out IRTranslatorImpl::runOnMachineFunction always returns
false, so we would fail to invalidate some analyses (like
GISelCSEAnalysis) that we should have.
Test coverage will be in a future commit that also ports the Legalizer,
which asserts that we correctly preserve/invalidate GISelCSEAnalysis.
Reviewers: vikramRH, arsenm
Pull Request: https://github.com/llvm/llvm-project/pull/217045
[SLP] Support vectorizing ptrtoaddr (#216902)
Currently, SLP Vectorizer handles ptrtoint but not ptrtoaddr (as
observed in an ASan test:
https://github.com/llvm/llvm-project/pull/216827#issuecomment-5322231318).
ptrtoaddr “is different from ptrtoint in that it only operates on the
index bits of the pointer and ignores all other bits, and does not
capture the provenance of the pointer"
(https://llvm.org/docs/LangRef.html#i-ptrtoaddr), which is immaterial to
its vectorizability.
This patch handles ptrtoaddr in a similar way to ptrtoint.
[orc-rt] Add StringOutputStream for <sstream>-free messages (#217022)
Add orc_rt::StringOutputStream to StringExtras.h: a minimal, output-only
stream that appends formatted values to a std::string via operator<<,
for building diagnostic/error strings without <sstream>.
<sstream> pulls in the iostreams + locale machinery, which is not in the
freestanding subset and is undesirable in the executor (which runs
on-target, including bare-metal). It is also locale-sensitive and built
around exceptions. StringOutputStream formats integers and pointers with
std::to_chars, so it has no locale dependence, allocates only to grow
the result string, and needs neither <sstream> nor <iostream>.
Integers and pointers are formatted with std::to_chars, so there is no
locale dependence and allocation only to grow the result string.
- Overloads for char, bool, const char*, std::string_view, const void*
(hex), and any built-in integer (decimal via to_chars).
- A free hex() helper prints an integer as "0x"-prefixed lowercase hex
[7 lines not shown]
[BOLT] Page out .dwo files
Split-DWARF inputs at big binaries scale ship 100+ GiB of .dwo
files. BOLT opened a fair number of them during readDebugInfo, putting
a lot of pressure on the OS memory management: mmap'd reads always
populate the page cache; with every .dwo mapped at once those pages
accumulated, refaulted, and registered as memory pressure that got the
process oomd-killed.
Now, .dwo page-cache pages are reclaimed as soon as BOLT is done with
each file: madvise(MADV_PAGEOUT) on the live mapping, then
posix_fadvise(POSIX_FADV_DONTNEED) once it is unmapped. Controlled by
-drop-dwo-page-cache, OFF by default, as it is unlikely upstream
will be processing gigantic sets of dwo files.
[BOLT] Create and release .dwo DWARF contexts incrementally
BOLT opened a DWARFContext for every .dwo during
readDebugInfo and kept them all alive until teardown. On large
split-DWARF targets that is tens of GiB held resident through
emission, the point of peak RSS.
Make the DWOCUs map a lazily-populated cache instead:
* Use the newly added DWARFUnit::clearDWO()/hasDWO() to directly
manage DWARFUnit's DIE caching mechanism.
* BinaryContext::getDWOCU() opens a context on demand (keyed off a
stable DWOId -> skeleton CU map).
* Release contexts as soon as they are done with: all of them at the
end of readDebugInfo, and per-bucket at the DWARF rewrite merge
point.
* Remove DWOCUs map, which became redundant and whose purpose can
now be served by the new id-to-skeleton map, and then fetching
the split CU from the skeleton via getNonSkeletonUnitDIE().
[5 lines not shown]
[DebugInfo] Add DWARFUnit::clearDWO()
Add DWARFUnit::clearDWO() so a skeleton unit can drop the DWO context
it owns without being destroyed itself. Also add DWARFUnit::hasDWO()
to answer if that skeleton CU is currently caching a DWO context, so
users can easily look it up.
For example, BOLT opened a DWARFContext for every .dwo during
readDebugInfo and kept them all alive until teardown. On large
split-DWARF targets that is tens of GiB held
resident. clearDWO()/hasDWO() expose to users DWARFUnit's caching
capacity, allowing them to spontaneously drop the cache/look it
up/re-load it for memory management.
[NFC][MemProf] Replace memprofraw with YAML in memprof.ll test (#216878)
Replace `.memprofraw` with a `.yaml` file using `split-file`. This
allows us to delete `update_memprof_inputs.sh` and the binary blobs
that it generates.
[CIR][NFC] Say "access unit" where the code says "unit"
`makeMemberKind` took a bool called `isUnit`, which does not say what the
member is a unit of, and the `isBitFieldUnit` predicate feeding it had the same
gap. Both become `isBitFieldAccessUnit`, matching the term classic uses, and
the helper picks up a short comment adapted from `CGRecordLayoutBuilder.cpp` so
a reader meets the definition where the parameter is read.
Assisted-by: Cursor / claude-opus-5