TableGen: Allow IsTruncStore predicates on atomic PatFrags (#229687)
Atomic stores can be truncating in the same way as regular stores. Allow
IsTruncStore and IsNonTruncStore to be set on atomic store PatFrags so
patterns can check the store is not truncating without needing to specify
a fixed memory size.
I still find the hierarchy of load/store PatFrags frustrating. This would be
easier if we fixed the legacy mistake of treating atomic store as an
"atomic" rather than a store.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[clangd] Extract to function: Do not reject unconditionally in C files
If the parameters can be passed by value, extraction in C files works
the same way as for C++. Otherwise, due to the lack of references, a
pointer parameter is used instead, with the call site taking its address
and every use inside the extracted body rewritten into a dereference.
Assisted-by: Claude Code
Closes https://github.com/clangd/clangd/issues/1810
[lldb] Avoid UB in ansi::TrimAtWordBoundary() (#229324)
`UtilityTest` fails on Windows in the debug configuration when
`AnsiTerminal.TrimAtWordBoundary()` calls `ansi::TrimAtWordBoundary()`
with Unicode strings containing bytes with the high bit set, which leads
to `std::isspace()` being called with a negative value. C11 §7.4
paragraph 1 requires the argument to be representable as unsigned char
or equal to EOF. Passing any other value is UB.
[clang][OpenMP] Fix assertion in vtable registration for incomplete types (#229521)
Assertion failure, "queried property of class with no definition", when
mapping a pointer to incomplete type. Function 'emitAndRegisterVTable()'
assumed types would always be complete when mapped. When it's not (as in
it has no definition), there is no vtable to emit/register, so it should
just be skipped rather than assert fail.
[libcxx] Fix indirect includes for nolocale (#229601)
The indirect include tests for several headers were failing when turning
on filesystem for LLVM-libc. This turned out to be because the nolocale
header was leaking ctime and other headers when building outside of
library mode. This PR just moves all the includes under the library
guard.
[InstCombine] Move sext(trunc(lshr(...))) combine before same type combine (#227322)
The same type sext(trunc(...)) combine will fire on the lshr case, but
the lshr produces one less shift. Move it afterwards to give the lshr
combine a chance to fire first.
Doing this fold early improves codegen for this pattern seen in x264:
```c
int f(short x) {
x = (x + 32) >> 6;
return x;
}
```
- RISC-V: https://godbolt.org/z/djWza678o
- AArch64: https://godbolt.org/z/adbv49Yx5
- X86: https://godbolt.org/z/azsWKW9bq
[2 lines not shown]
[InstCombine] Move sext(trunc(...)) combines before EvaluateInDifferentType (#227321)
EvaluateInDifferentType loses some of the sign bit information which the
sext(trunc(...)) combines can use to remove intermediate casts, so run
the latter earlier. This helps towards fixing a codegen pattern in x264
Tests written with opus 5.5
[InstCombine] Generalize sext (trunc (lshr Y, C)) -> sext/trunc (ashr Y, C) to other shift amounts (#227320)
This existing combine removed an intermediate truncate when a lshr
shifted exactly by the number of bits truncated, as the sign bit was
guaranteed to be in the MSB of the truncated type:
b7 b6 b5 b4 b3 b2 b1 b0
Y s y6 y5 y4 : y3 y2 y1 y0
lshr Y, 4 0 0 0 0 : s y6 y5 y4
trunc to i4 - - - - : s y6 y5 y4
sext s* s* s* s* : s y6 y5 y4
ashr Y, 4 s s s s : s y6 y5 y4
This generalizes it to any shift amount that's known to put a sign bit
in the MSB, i.e. `numSignBits(Y) + ShiftAmt > numBitsTruncated`:
b7 b6 b5 b4 b3 b2 b1 b0
Y s s s y4 : y3 y2 y1 y0
lshr Y, 2 0 0 s s : s y4 y3 y2
[5 lines not shown]
[Offload][OMPT] Drop device lifecycle handling from OmptProfilerTy
Since #221726, libomptarget emits the device_initialize,
device_finalize and device_load callbacks itself, and GenericProfilerTy
no longer has the hooks the plugins used to report these events. The
overrides were left without callers and still used
GenericPluginTy::getUserId(), which #221726 removed, so the file would
not compile once it is built. Remove them together with the per-profiler
callback copies and the initialization flag only they used.
Assisted-by: Claude Code
[Offload][OMPT] Call device tracing entry points directly
The plugin-side tracing code reached the libomptarget-side entry points by
dlopen'ing "libomptarget.so" and dlsym'ing each libomptarget_ompt_* symbol
on first use. That indirection dates back to when libomptarget and the
plugins were separate shared objects. They are not: PluginOmpt is linked
into omptarget itself, so the library was dlopen'ing itself to look up its
own symbols. The callback path was already converted to direct calls; the
tracing path should never have reintroduced the pattern.
Declare the entry points in OmptCommonDefs.h and call them directly. This
removes ParentLibrary, ensureFuncPtrLoaded(), the generated function
pointers, and the libomptarget_ompt_*_t typedefs (two of which were
duplicates, and three of which were never used).
Calling directly also means the symbols no longer have to be exported, so
no version script entry is needed for them.
The per-entry-point mutexes are left untouched here: they currently wrap
[4 lines not shown]
[Offload][OMPT] Replace generic profiler data hooks with OMPT API
GenericProfilerTy no longer exposes getProfilerSpecificData() or
getTraceRecordManager(), so OmptProfilerTy provides the OMPT-specific
entry points directly: trackAsyncRecord() creates the event info that
carries a trace record into the plugins, and getOmptProfiler() gives
libomptarget typed access to the process-wide profiler. Keeping the
OMPT types out of the generic interface lets the plugins stay agnostic
of the profiling backend.
The buffer manager member moves back out until the tracing buffer
infrastructure exists later in the series.
Assisted-by: Claude Code
[Offload][OMPT] Add OMPT profiler implementation
Add the OMPT-specific profiler types and plugin tracing implementation without compiling or activating them yet. The existing callback path remains authoritative until the tracing interface and orchestration dependencies are available.
Assisted-by: Claude Code
[Offload][AMDGPU] Wire HSA profiling into GenericProfiler abstraction
Add device profiling infrastructure to the AMDGPU plugin so that the
GenericProfiler can receive nanosecond-accurate kernel execution and
data transfer timestamps from the HSA runtime.
Key changes:
- Add ProfilingInfoTy struct to transport HSA profiling data
- Add timeKernelInNsAsync/timeDataTransferInNsAsync callbacks that
extract dispatch/copy times from HSA signals and call
handleKernelCompletion/handleDataTransfer on the profiler
- Add getOrNullProfilerSpecificData helper to extract ProfilerData
from AsyncInfoWrapperTy
- Add getDeviceTimeStamp() override using hsa_system_get_info
- Add getSystemTimestampInNs() for HSA system timestamp queries
- Add schedProfilerKernelTiming/schedProfilerDataTransferTiming to
StreamSlotTy for scheduling profiler callbacks on stream slots
- Thread ProfilerSpecificData through pushKernelLaunch,
pushMemoryCopyH2DAsync, pushMemoryCopyD2HAsync, pushMemoryCopyD2DAsync
[6 lines not shown]
[Offload] Add GenericProfilerTy abstraction and APITypes extensions (#225639)
Introduce GenericProfilerTy alongside the existing OMPT callback
dispatch.
The weak profiler factory returns a no-op implementation, so the new
hooks are silent while the established callback path continues to handle OMPT
device events.
Co-Authored-By: Dhruva Chakrabarti <dhruva.chakrabarti at amd.com>
Co-Authored-By: Michael Halkenhauser
<michaelgerald.halkenhauser at amd.com>
Assisted-by: Claude Code
---
<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
[CIR][SYCL] Local Generic Addrspace (#229281)
CIR resolved the default address space of stack allocas to `AS0`, so on
`SPIR` targets `&local` in SYCL device code was a private pointer while
default pointer types are generic (`addrspace(4)`), leading to private
pointers being stored into generic slots.
Resolve it through `getTargetAddressSpace` as classic CodeGen does, and
also store parameters through the cast address and keep the destination
address space in `emitArrayInit`
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply at anthropic.com>