[NVPTX] Fuse abs into min/max
Fold absolute-value operands into existing three-input f32 min/max
instructions on SM100 with PTX 8.8 or newer. This replaces separate
absolute-value instructions with the min/max .abs modifier.
[SLP] More accurately cost RISCV scalar splats (#213104)
Backends may have a fast path for splatting scalar operands (i.e. rather
than generating the splat vector, the vector instruction may be able to
take a scalar operand), for example RISCV `vfoo.vx` instructions. Pass a
hint to the TTI when costing the insert/shuffle sequence in such cases.
Fixes #212413.
Assisted By: Codex
[ORC] Add ConnectionSpec for connection string parsing (#224000)
A ConnectionSpec is the parsed form of a string describing one
connection a process should establish with its peer:
<transport>[:<action>]=<descriptor>
E.g. "fd=3" or "tcp:connect=localhost:20000". The parser only checks
punctuation: transport and action names are opaque tokens, and the
descriptor's syntax is left to the transport, which lets a descriptor
contain ':' and '=' unescaped (e.g. "tcp:listen=[::1]:0").
This will be used by llvm-jitlink and llvm-jitlink-executor to
generalize out-of-process executor connection setup beyond the current
fd/TCP-only options.
[clang][flang][OpenMP] Correct OpenMP context selector matching and scoring
Context selector ranking is shared by DECLARE VARIANT and metadirective
lowering. Incorrect construct matches, context-dependent device weights, or
overflowing scores can select a different variant and cause Flang to skip
required loop diagnostics.
Preserve the highest-scoring ordered construct matches and derive device
weights from the enclosing context. Widen score arithmetic as needed, and
retain selector identity and scores for unknown properties so MATCH_ANY and
MATCH_NONE handle dynamic conditions and implicit NOTHING correctly. Bound
lowering contexts at TARGET and include SIMD traits so Clang and Flang use
the same context for selection.
Assisted with codex.
[SPARC] Fix SelectForceADDRrr for global addresses and non-reg operands (#220013)
When lowering byte-swapped memory operations on SPARC V9, LLVM emits
ASI-tagged memory instructions (such as STHArr, STArr, LDArr, etc.) that
require register+register addressing modes matched via ForceADDRrr.
SelectForceADDRrr previously forwarded 2-operand address nodes directly
to SelectADDRrr. However, SelectADDRrr explicitly returns false when
encountering SPISD::Lo (used in %hi/%lo global address calculations) or
small constant offsets in order to allow standard ADDRri patterns to
match. Because SelectForceADDRrr returned the result of SelectADDRrr
directly instead of falling back to Base = Addr, Disp = %g0, any
endian-adjusted load or store targeting a global variable failed to
select and caused a backend compiler crash:
"Cannot select: SPISD::STORE_LITTLE ..."
Fix SelectForceADDRrr so that if SelectADDRrr fails to match, it falls
back to evaluating the full address into a base register and using %g0
as the offset register. Also add tests for global variable byte-swapped
[7 lines not shown]
[libc++] Don't assume a valid range in find_if for empty inputs (#213752)
Iterators for empty ranges are sometimes implemented using a
non-aligned sentinel value. Requiring proper alignment in that
case (which is part of the valid range assumption) causes a
hardening failure. Instead, don't make the assumption of a
valid range when the input range is empty in find_if.
(cherry picked from commit 83290d61f6ead40a5c38297a0442b63291ce7a48)
[libc++] Opt `std::*set` out of map key extraction optimization (#220452)
PR #154512 (relanded by #155565) removed `__can_extract_map_key`, which
had a blanket opt-out for `std::*set`s. The new logic does not have that
opt-out, leading to `std::set`s being incorrectly constructed.
The new regression tests demonstrate this, but essentially the idea is:
1. Have `std::set<T> foo;`
2. Call `foo.emplace(some_t,
arg_that_influences_comparisons_or_hashes);`
3. The emplace will internally search using `some_t` as the key, *not*
`T(some_t, arg_that_influences_comparisons_or_hashes);`
This opts out `std::*set` from this optimization to match previous
behavior.
Tests and fix were produced by an LLM. I reviewed them and they seem
reasonable to me, though I don't have a strong background in libc++
testing conventions.
[7 lines not shown]
[DirectX] Make DXILOpLowering split vector coordinates, offsets, and gradient operands (#223091)
Fixes https://github.com/llvm/llvm-project/issues/217777
DXILOpLowering didn't split vector coordinates, offsets, and gradient
operands into scalars for textureLoad, textureStore, and sample
intrinsics like it did for store data. This PR fixes that.
This PR also removes inconsistencies where the DXILOpLowering pass
emitted a mix of i64 and i32 indices for `extractelement`. It now just
emits i32 indices.
Assisted by: Claude Opus 5
[test][bazel][libc] Allow LLVM-libc tests to be run in full-build mode
This PR makes the required changes to run LLVM-libc full build tests in Bazel. After this PR, most tests pass:
```
bazel test @llvm-project//libc/test/... --config=ci --@llvm-project//libc:build_mode=full --keep_going
Executed 680 out of 853 tests: 681 tests pass and 172 fail to build.
```
Follow on PRs will fix specific tests that are failing (lots of missing deps etc).
This PR mostly involves propagating the correct dependencies and compiler/linker options from [`add_libc_hermetic`](https://github.com/llvm/llvm-project/blob/4098f568c46e06b6df470111868b4c165dd80f4d/libc/cmake/modules/LLVMLibCTestRules.cmake#L750). Slightly more involved changes:
- `BazelFilePath.cpp` also had to be fixed so that it doesn't depend on the non-namespaced `getenv` function. This PR models after https://github.com/llvm/llvm-project/commit/ee407f7e7069cccfdc1815de07e17cebf83d19f9 in order to conditionally use LLVM-libc's getenv under full-build mode.
- All tests have a dependency against `crt1.o` when run under full-build. This PR updates `merge_relocatable_object` so it also exposes a `CcInfo` with the merged object file and its transitive deps. In order to do so, this PR also makes the logic a little more careful about PIC vs non-PIC deps.