[orc-rt] Use StringOutputStream in executor error messages (#217167)
Replace std::ostringstream and std::to_string in the executor's
error-message construction with orc_rt::StringOutputStream, dropping
<sstream> (and its iostreams + locale machinery) from the executor,
which runs on-target including on freestanding platforms.
Converted SimpleNativeMemoryMap.cpp, ExecutorProcessInfo.cpp, and
Unix/NativeDylibAPIs.inc; NativeDylibManager.cpp no longer needs to
include <sstream> for the latter. Messages that only feed an error are
built from a StringOutputStream temporary; one all-literal message drops
the stream entirely.
Hex values now carry a "0x" prefix (StringOutputStream::hex always emits
one), where the old std::hex produced bare digits. No test depends on
the exact message text.
[flang][Lower] Rewrite present of device variable to deviceptr (#217164)
A cuda device variable is always "present" on the device. Rewrite such
occurrences to deviceptr in the front end while we still have the
information about which variable is a cuda device variable.
[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]