[AMDGPU] [NFC] Init pointers, widen mask complements (#208469)
- Initialize local pointers before use, silencing uninitialized local
pointer warnings.
- Compute mask complements at 64 bits to avoid zero-extending the result
from a type to a type of greater size and dropping high bits.
[flang][OpenMP] Support lowering of metadirective (part 3)
Enable lowering of metadirectives that resolve to a loop-associated
variant such as `do`, `simd`, `parallel do`, and `do simd`. The
associated DO construct is made available to the selected variant so the
existing OpenMP loop lowering can process it. A standalone metadirective
uses the following sibling DO, and a begin/end metadirective uses the
first substantive evaluation nested in its block.
For example, when the `vendor(llvm)` selector matches, the `parallel do`
variant is lowered together with the DO loop that follows it:
```fortran
!$omp metadirective when(implementation={vendor(llvm)}: parallel do)
do i = 1, n
y(i) = a*x(i) + y(i)
end do
```
[33 lines not shown]
[lldb] Add an MCP client and asynchronous request binding (#208371)
This PR contains the groundwork to convert lldb-mcp from a naive
forwarder into a multiplexer. This requires acting both an MCP server
and MCP client.
This PR adds a new MCP Client abstraction, a thin wrapper over
MCPTransport and MCPBinder exposing the protocol's requests as typed
asynchronous calls. BindAsync hands an incoming-request handler a Reply
it may invoke later.
This PR also makes fromJSON symmetric with toJSON for
ServerCapabilities. The former only restored supportsToolsList and
silently dropped the resources, completions and logging capabilities, so
a client parsing an initialize result never saw them.
Assisted-by: Claude
[clang] fix typo-correction for template name lookup
Only consider candidates which are templates.
Disable spell checking for a DR test in order to not introduce noise,
as spell checking is never helpful in those.
Fixes #207498
[orc_rt] adding a very simple CLI flags parser in (#172987)
Adds orc_rt::CommandLineParser, a small header-only option parser in
orc-rt-utils for use by orc-rt tools that need argument handling.
Features:
- Long (--name, --name=value) and short (-n, -nvalue) options.
- Short-flag clustering (e.g. -vp9999) and "--" to terminate option
parsing, with remaining tokens collected as positionals.
- Typed values, with parse failures returning an orc_rt::Error.
- printHelp() with aligned, optionally short-name-aware output.
Values are bound to caller-owned storage supplied at registration time and
reset to their defaults on each parse().
Also adds CommandLineTest.cpp to the CoreTests unittest and fixes the
indentation of the docs subdirectory guard in orc-rt/CMakeLists.txt.
[libc++] Enable missing allocator constructors in C++11 (#204845)
LWG2210 was a patch to N2554 (C++11) which added missing
allocator-extended constructors to various containers. When LWG2210 was
implemented, the constructors were gated with C++14. However, we
normally apply LWG issue resolutions as DRs.
This patch enables these constructors in C++11 mode too.
Fixes #204843
---------
Co-authored-by: Louis Dionne <ldionne.2 at gmail.com>
Co-authored-by: A. Jiang <de34 at live.cn>
[mlir][xegpu] Support subgroup layout assignment for scatter stores (#205955)
Add getStoreSubgroupLayouts() to derive the subgroup (sg_layout/sg_data)
anchor layout for store_scatter and store_matrix. It factorizes numSg
into the most balanced sg_layout that divides the workgroup tile with
sg_data a multiple of inst_data (lane_layout * lane_data).
Co-authored-by: Claude Opus 4.8 (1M context) <noreply at anthropic.com>
[AIX] diagnose invalid feature strings on the target attribute (#208059)
Currently, Sema calls `getTargetInfo().isValidFeatureName(S)` to
validate string inputs on the `target` attribute. `PPCTargetInfo`
doesn't override the function and the base class implementation returns
true unconditionally. This results in the FE accepting invalid feature
strings on `target` attribute, and generates invalid target-feature
values in the IR.
Co-authored-by: Wael Yehia <wyehia at ca.ibm.com>
[Clang][AMDGPU] Add __builtin_amdgcn_s_buffer_load_<T> (#203352)
Expose `llvm.amdgcn.s.buffer.load` intrinsic overloads for OpenCL via
`__builtin_amdgcn_s_buffer_load_*` builtins.
Function prototypes:
```
<return-type>
__builtin_amdgcn_s_buffer_load_<suffix>(
v4i32 rsrc, // 4-dword buffer resource in SGPRs
int offset, // byte offset from the base of the buffer
int aux); // cache-policy, control flags. Must be compile-time const.
```
Where:
```
return-type suffix
---------------- ------
char i8
unsigned char u8
[25 lines not shown]
[clang] fix typo-correction for template name lookup
Only consider candidates which are templates.
Disable spell checking for a DR test in order to not introduce noise,
as spell checking is never helpful in those.
Fixes #207498
[libc] Disable baremetal modular printf (#208576)
This reverts commit a14d084bbb1a7261d8a71c56120159abb6af330b.
Though the modular printf works as intented, we noticed a few challenges
using this feature. Without diagnostic help it is difficult to
understand which "modules" got linked in and why. Disabling this to be
the default setting until this is sorted.
[Docs] Migrate LLVM docs to furo (#184440)
Implements the proposal at
https://discourse.llvm.org/t/rfc-update-llvm-docs-to-furo-theme/90053
Furo output at https://nigham.github.io/llvm_docs_furo/LangRef.html
- Switched theme to Furo
- Removed `:content` directives from RSTs, since Furo always has a TOC
on the side.
Credits for various pieces of feedback and improvements: @Pierre-vh
@aengelke @slinder1 @jhuber6 @fmayer @llvm/infrastructure-area-team
@petrhosek @rnk @boomanaiden154 (see discussions in the RFC)
[mlir][xegpu] Fix expandDim distribution for shape_cast layout inference (#205987)
The expanded dims of a shape_cast collapse are row-major (innermost is
fastest-varying), so sg_layout/lane_layout must be distributed
inner-to-outer rather than outer-to-inner, and jointly with the data
component: distribute sg_data/lane_data first, then stride
sg_layout/lane_layout over the per-dim leftover.
Example — shape_cast [8,32,32] -> [256,32] (consumer lane_layout=[8,4],
lane_data=[2,1], order=[0,1]),
inferred source layout:
before: inst_data=[8,2,4], lane_layout=[8,1,4], lane_data=[1,2,1],
order=[1,0,2] # lanes on slow dim
after: inst_data=[1,16,4], lane_layout=[1,8,4], lane_data=[1,2,1],
order=[1,0,2] # lanes wrap to fast dim
This also fixes wrap-around, e.g. [2,16]->[32] with sg_layout=[4],
sg_data=[4] → sg_layout=[1,4], sg_data=[1,4].
[2 lines not shown]
[flang][cuda] Fix atomicCAS to return the old value (#208558)
atomicCAS returned cmpxchg's success flag instead of the old value,
breaking spinlock idioms. Extract element 0 (bitcast back for floats).
[Attributor] Add remarks when UB is optimized to unreachable (#207864)
These often bite LTO users in surprising and hard-to-debug ways. Adding
remarks to give at least a small bread-crumb as to 'why' we're
optimizing out chunks of code.
[mlir][xegpu] Fix crash on 0D vector in vector-to-xegpu transfer lowering (#205812)
`transferPreconditions` accepted rank-0 vectors, which then reached
`computeOffsets` and indexed an empty `SmallVector` (`broadcasted[0]`),
asserting `idx < size()` and crashing. For example:
```mlir
vector.transfer_write %arg0, %arg1[%1] : vector<f32>, memref<3xf32>
```
This is valid IR (the verifier accepts it; 0D vector transfers are part
of the vector dialect spec), so the conversion pass should not crash on
it.
Bail out via `notifyMatchFailure` for 0D vectors in the shared
`transferPreconditions`, so both `transfer_read` and `transfer_write`
are left unconverted instead of crashing. This matches how the core
vector lowering already treats 0D transfers as an unsupported corner
case (see `mlir/lib/Dialect/Vector/Transforms/LowerVectorTransfer.cpp`).
[3 lines not shown]
[SSAF][PinnedPointers] Add pointer parameters of 'main' as pinned pointers
Similar to some pointer entities of operator new/delete overload
functions, pointer type parameters of the main function shall also
retain its type during clang-reforge transformation.
rdar://179151882
[SSAF][NFC] Rename operator new/delete pointers analysis to pinned pointers
Other pointer entities, such as the pointer parameters of the main
function, must also retain their type during the clang-reforge
transformation. Since they are extracted and processed similarly,
combining them into a single analysis simplifies maintenance.
[HLSL] Reject unbounded resource array and noinline function resource parameters (#208111)
Fixes #180808.
This issue involved two bugs:
- `noinline` functions accepted resource parameters in the frontend,
which crashed the backend since valid DXIL cannot be generated for
resources passed across a function call. This change adds a new check in
`SemaDecl.cpp` that rejects resource parameters on `noinline` functions,
as well as a new `resource_params_noinline.hlsl` test.
- The check for incomplete resource array parameters queried the array's
element type to decide if it was a resource. When the parameter was the
first use of the resource type, the element was still incomplete and
wouldn't register as a resource, so the check would be skipped and the
compiler would later crash. This change fixes the check to now force
element completion with `isCompleteType` before querying the type, and
updates `unbounded_resource_arrays.hlsl` to test this.
This change also fixes the `unbounded_resource_arrays.hlsl` test in
[4 lines not shown]
[lldb] Don't add the same module to a target twice (#208472)
`Target::GetOrCreateModule` uses `Append`, so a module already in the
target could be added again. Then `RemoveModule` dropped only one,
keeping the module (and its memory-mapped file) alive.
On Windows that mapped file can't be deleted, causing
`TestReplaceDLL.py` to fail with `LLDB_USE_LLDB_SERVER=1`.
This patch uses `AppendIfNeeded` instead.
rdar://181797592
[lldb] Use `llvm::APInt` for `VariantMember` Discriminants (#188487)
resolves #177812
It currently uses a `uint32_t` even though Rust can output 64- and
128-bit discriminants. This became a more obvious issue when Rust
started niche-optimizing based on the capacity of strings (which are
`NoHighBit` values, guaranteed to be less than `u64::MAX / 2`), rather
than the `NonNull` heap pointer. With this optimization, the `None`
variant of strings is 9223372036854775808, which LLDB truncates to 0.
This means whenever the capacity is 0 (e.g. `Some(String::new())`, LLDB
will mistakenly read it as the `None` variant. Additionally, when trying
to determine the `None` variant, lldb will read the discr from memory
correctly (9223372036854775808), and the visualizer scripts will compare
that to the value in the variant name (`$variant$0`), see that it
doesn't match, and incorrectly decides that it must not be the `None`
variant.
This patch simply swaps the `uint32_t` with an `llvm::APInt`.
[104 lines not shown]
[clang][ssaf] Add SARIF transformation-report format (#208327)
Adds the built-in `TransformationReportFormat`, registered under the
file extension `sarif`. The writer drives clang's existing
`SarifDocumentWriter` (`clang/Basic/Sarif.h`) to produce a SARIF 2.1.0
JSON document. The tool driver name is `clang-ssaf`; the long `fullName`
carries the transformation's name.
Token-range `CharSourceRange`s are canonicalized to char ranges via
`clang::Lexer::getAsCharRange` before being attached to results; invalid
ranges (including default-constructed ones) are treated as "no location"
— the writer omits the result's `locations` key rather than fabricating
one. Source edits are not embedded in the report; the writer never emits
a `fix` or `fixes` key.
Anchored via `SSAFSARIFTransformationReportFormatAnchorSource` so static
builds keep the registration.
Assisted-By: Claude Opus 4.7