[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.
[DAG] Explicitly truncate splat operand in get_active_lane_mask expansion
x86 can't handle the implicit truncation of build_vector operands so the whilewr_8 test case crashes after expanding get_active_lane_mask (stemming from llvm.loop.dependence.war.mask). Fix it by explicitly truncating it.
[DAG] Use getLegalMaskAndStepVector in expandGetActiveLaneMask
Currently we will either use the mask vector type if it's big enough to fit the elements, or promote the element width to the scalar operand type.
In the latter case we will end up with a vector element type larger than strictly necessary, which means a v32i1 mask will get promoted to v32i64 on RISC-V, which isn't a legal type, and expansion fails.
We can use a legal vector type that's just small enough via getLegalMaskAndStepVector, which is already used by expandVectorFindLastActive, expandCttzElts etc. This fixes crashes on RISC-V and also uses a more compact step vector. It also means we can handle scalable vectors.
We need to move the function into TargetLowering.cpp to use the getLegalMaskAndStepVector, but this brings it inline with the other expansions.
[orc-rt] Merge split target_link_libraries calls. NFC. (#232166)
Each shipped library set its PUBLIC and PRIVATE link libraries in
separate target_link_libraries calls. Use one call per library.
[LoongArch] Support memcmp expansion for vectors and combine for i128/i256 setcc
This commit enables memcmp expansion for lsx/lasx. After doing
this, i128 and i256 loads which are illegal types on LoongArch
will be generated. Without process, they will be splited to
legal scalar type.
So this commit also enable combination for `setcc` to bitcast
i128/i256 types to vector types before type legalization and
generate vector instructions.
Inspired by x86 and riscv.
[CIR] Lay out allocas in the order classic codegen does (#231974)
At -O0 the order of a function's entry-block allocas is its stack frame
layout. CIR now creates the return value's alloca before the
parameters', and keeps hoisted block-scope allocas after the function's
own, matching classic codegen.
CIRGen creates `__retval` before the parameters, as classic's
StartFunction does, and the implicit `return 0` store for `main` moves
into emitFunctionProlog, where classic emits it. HoistAllocas places
each hoisted alloca after the allocas already at the start of the
destination block instead of in front of them.
Assisted-by: Cursor / claude-opus-5.5
---------
Co-authored-by: Andy Kaylor <akaylor at nvidia.com>
[libc++] Make usage of python3 work as intended on macOS benchmark runners (#232151)
Homebrew stops providing unversionned commands like `python3` in their
versionned formulae (`python at 3.14`) whenever it stops being the default.
As a result, the `python3` symlink moved from `<...>/bin` to
`<...>/libexec/bin` when the Python 3.15 formula was introduced,
displacing Python 3.14.
As a result, the macOS jobs started falling back to the system Python
3.9. Since llvm-lnt does not support Python 3.9 (which is EOL'd), that
failed the macOS benchmarking jobs (see for example [1]).
Fix this by adding <...>/libexec/bin to the path instead of just <...>/bin.
[1]: https://github.com/llvm/llvm-project/actions/runs/38039547247/job/114176935620
[PowerPC] Prefix option names with ppc-, turn disable- to positive options (#230393)
Rename the PowerPC CodeGen options so that they start with ppc-, and
turn the -disable-* options into positive options with the default
flipped. -enable-ppc-gen-scalar-mass becomes -ppc-scalar-mass and
-disable-ppc-ctrloops becomes -ppc-ctr-loops, since -ppc-gen-scalar-mass
and -ppc-ctrloops are pass names.
Preparatory for migrating to LibraryOptions.
Aided by Opus 5.5