[RISCV] Add subtarget feature to disable use of vector avgceil/floor nodes. (#231609)
The cost of the vxrm write makes using these instruction not profitable
on 525.x264_r on current SiFive OoO cores.
[Clang] Avoid assertions for unevaluatable object size kinds (#231793)
Constant-evaluated calls to __builtin_object_size and
__builtin_dynamic_object_size may have a second argument that cannot be
evaluated. The legacy evaluator incorrectly assumed it was a known
constant integer, which could trigger an assertion.
Evaluate the argument through the current evaluator and propagate
evaluation failures instead of calling EvaluateKnownConstInt.
Add regression coverage for division by zero, function calls, runtime
parameters, volatile reads, and null pointer dereferences. The tests
cover both object-size builtins and both constant evaluators.
AI assistance was used to generate additional regression test cases,
which I reviewed and adapted.
Fixes https://github.com/llvm/llvm-project/issues/231108
[2 lines not shown]
[RISCV][P-ext] Use ISD::AVGSUBFLOOR(S/U) for (p)asub(u).
This replaces RISCVISD::ASUB(U) with ISD::AVGSUBFLOOR(S/U).
Co-Authored-By: Claude Sonnet 5.5 <noreply at anthropic.com>
[SelectionDAG] Add AVGSUBFLOORS/AVGSUBFLOORU opcodes
These represent a halving subtract: trunc(shr(sub(ext(X), ext(Y)), 1)),
rounding towards negative infinity. They correspond to AArch64 shsub/uhsub
and RISC-V P extension asub/asubu.
Includes some legalization, known bits, constant folding, and
a DAGCombiner fold from (sr[al] (sub nsw/nuw x, y), 1).
The operation is not legal any target yet. That will be done in
follow ups.
Co-Authored-By: Claude Sonnet 5.5 <noreply at anthropic.com>
[AMDGPU][SwLowerLDS] Rebase flat to LDS addrspacecasts to buffer offsets (#227985)
**Issue:**
In `amdgpu-sw-lower-lds` pass:
- LDS is moved/lowered into an `__asan_malloc_impl` buffer. AS3 pointers
hold offsets into it, and each LDS access is rewritten to `buf +
offset`.
- LDS to flat casts produce `buf + offset`. Casting that back to AS3
kept the full address, so the next access went out of bounds.
**Fix:**
- Collect flat to LDS casts and rewrite them as
`inttoptr(trunc(ptrtoaddr(flat) - ptrtoaddr(buf)))` to get the offset
back. The existing translation handles the users.
- Covers kernels and already-lowered non-kernels.
**Note :**
- Non-kernels that only take a flat pointer are handled in a follow-up
#228043.
Assisted by: claude opus 5.5
[compiler-rt] Remove dlsym interceptor and support `-shared-libsan` for CSan
Summary:
Follow the UBSan offload runtime. Offload now resolves HSA through the
global scope, so the `dlsym` interceptor is no longer needed. The real
HSA entry points are still taken from the loaded HSA library rather than
`RTLD_NEXT`, since every DSO with a static runtime exports the same
wrappers and they would otherwise chain back into each other.
Build `libclang_rt.csan.so` with the offload objects folded in. The
exported HSA wrappers report failure when HSA is absent and warn when HSA
was loaded ahead of the runtime. The preinit hook moves to a separate
`csan_offload-preinit` archive for executables.
[compiler-rt] Add 'csan' library for the concurrency sanitizer
Summary:
Adds the runtime for the concurrency sanitizer, both CPU and GPU.
Fundamentally, this works using the following pseudocode:
```c
static u64 watchpoints[N]; // Hash-indexed, zero is empty.
// Emitted before the access, so we never trip on our own write.
void check_access(volatile void *addr, u32 size, u32 type) {
// Every access probes. A read conflicts only with a watched write, a
// write conflicts with either.
if (u64 *wp = find_watchpoint(addr, size, type))
consume(wp, this_pc()); // Hand our location to the owner.
if (!should_sample()) // Wave-uniform, 1-in-N chance.
return;
[17 lines not shown]
[Clang] Support `-shared-libsan` for offload CSan
Summary:
Follow the UBSan handling. The shared runtime embeds the HSA
interceptors, so `csan_offload` is only linked with static runtimes and
executables pull in `csan_offload-preinit` to initialize early.
[Clang] Add support for the `-fsanitize=concurrency` runtime
Summary:
Add the frontend sanitizer kind, function attributes, pass pipeline
integration, predefined macro, driver handling, and documentation for
ConcurrencySanitizer.
[ClangIR] Support bool-returning await_suspend (#227527)
Support bool-returning `await_suspend` in ClangIR:
- Add an optional boolean condition operand to `cir.coro.suspend_point`
to signal whether suspension takes effect or is vetoed.
- In CIRGen, evaluate the `await_suspend` expression as boolean when
`SuspendReturnType::SuspendBool` and pass the condition to
`cir.coro.suspend_point`.
- Update control flow and successor regions for `cir.await` accordingly.
- Add MLIR and CodeGen test coverage.
Closes #227404
[libc++] Extract running the benchmarks into reusable workflows (#232168)
This patch moves the jobs that actually run the benchmarks into their
own workflows and defines the full "benchmarking pipeline" in a
dedicated workflow as well. This allows seeing the full set of steps in
the pipeline in a concise way, and removes most of the remaining
duplication of logic.
[DAG] Handle widened step vectors in expandGetActiveLaneMask
On AVX512 getLegalMaskAndStepVector will need to widen the step vector type. Handle this in expandGetActiveLaneMask, so we don't crash on AVX512 which widens e.g. v8i1 -> v16i1. We don't actually use Mask, it's just a dummy poison value to work out what type the final mask result should be.
[mlir][bufferization] Skip read collection when no writes exist (#231771)
Collect aliasing writes before reads in the One-Shot Bufferization RaW
interference check. When there are no in-place writes, return without
collecting aliasing reads.
This avoids unnecessary read scans during pre-bufferization checks and
other cases without writes.