[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
[Reassociate] Compute value ranks iteratively (NFC) (#204952)
ReassociatePass::getRank recursively walks operand def-use chains before
memoizing ranks. For a very deep acyclic chain whose tail feeds a
reassociable operation, this can recurse once per chain element and
overflow the native stack.
Compute ranks with an explicit post-order worklist instead. The worklist
preserves the existing rank calculation and memoization behavior while
bounding native stack use.
Co-authored-by: Justin Fargnoli <jfargnoli at nvidia.com>
[lldb] Tighten interface for TypeCategoryImpl::AnyMatches (#208321)
The last 2 parameters are never actually used by any caller so they can
be removed. `only_enabled` defaults to `true` but all callers explicitly
set this to false. I removed that and rewrote the body to assume it will
always be false.
[Support] Optimize signal handling file removal code (#173586)
clangd/clangd#1787 describes how LLVM's code for removing partially
written files when taking a fatal signal is slower than it should be.
This code was substantially rewritten by JF Bastien in
aa1333a91f8d8a060bcf5 to make it (more) signal-safe.
As written in 2018, the logic always allocates a new node for every file
we attempt to protect, and those nodes are added to a global singly
linked list and never removed. If you open a lot of output files,
suddenly output file opening becomes O(n^2), which is what happened
during clangd indexing.
Removing files on signals in a multi-threaded environment is really
complicated! We can use locks to synchronize between threads that are
writing to the list, but we cannot use locks to synchronize against
re-entrant signals, and we don't have any great tools for masking or
delaying things like SIGTERM. This makes it difficult to assert that we
have the one and only reference to a node, even after removing it from
[18 lines not shown]
[Sema] Properly space namespace comments (#208561)
// namespace instead of //namespace.
This is consistent with the LLVM coding standards. We took focus on this
specific case as it was tripping up some of our internal tooling.