[flang][AliasAnalysis] Add opt-in getSource memoization cache (#208319)
Add an opt-in cache to fir::AliasAnalysis that memoizes getSource()
results keyed on (value, flags). Caching is off by default and turned on
via enableSourceCache(); getSource() becomes a thin wrapper over the
uncached getSourceImpl(). The cache is a frozen snapshot with no
automatic invalidation and lives no longer than the AliasAnalysis
instance, so a client enables it only for a region in which it does not
mutate IR in a way that would change a source.
Flang's LICM enables the cache on its fir::AliasAnalysis before adding
it to the mlir::AliasAnalysis aggregate: LICM only moves operations, so
getSource()'s inputs are unchanged across the hoists, and the pass
manager drops the analysis (and its cache) after the pass.
Add a unit test covering the default-off behavior, cache fill/hit, and
that disableSourceCache() clears and bypasses the cache.
Assisted-by: Cursor
[orc-rt] Apply orc_rt_log_* naming convention to Logging.h. NFC. (#208599)
orc_rt_ is the top-level C namespace and orc_rt_log_ a nested namespace
for logging. Following the C API convention, types, values, and
variables are PascalCase and functions are camelCase (as in LLVM).
[webkit.NoUncountedMemberChecker] Improve the warning text (#204557)
This PR aligns NoUncountedMemberChecker and its variant's warning
message with the new warning format in
https://github.com/llvm/llvm-project/pull/202724.
[clang] fix typo-correction for template name lookup (#208586)
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] Expand 'extern "C"' guard coverage in Logging.h. NFC. (#208596)
We'll be adding more APIs here soon -- the 'extern "C"' guards should
cover the whole header.
[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.