[CIR] Add x86_64 scalar calling-convention lowering (#209636)
CallConvLowering can already classify a function through the MLIR test
target or through a classification injected as an attribute, but it has
no
path to a real target ABI. This adds a `target=x86_64` mode that runs
the
LLVM ABI Lowering Library's System V x86_64 classifier: it maps CIR
types to
`llvm::abi` types, calls the classifier, and converts the result back
into
the `mlir::abi::FunctionClassification` that `CIRABIRewriteContext`
already
consumes.
To keep the first step small this handles scalar signatures only --
integer
up to 64 bits, pointer, bool, `f32`, and `f64`. Anything else (records,
arrays, vectors, `_Complex`, wide or uncommon floats, `_BitInt`,
[9 lines not shown]
[SCEV][NFCI] Refactor LoopGuards range check matching (#210362)
Parameterize MatchRangeCheckIdiom over (Predicate, LHS, RHS) so it can
be reused for other predicates discovered during guard collection.
Hoist AddRewrite / GetMaybeRewritten above it and use them in place of
the inline try_emplace, so range-check rewrites chain onto existing ones
the same way other rewrites do.
[mlir][acc] Preserve section bounds on acc.reduction_init (#210443)
When `acc.reduction_init` is created from `acc.reduction`, its bounds
are lost because they only live as values folded into the init region's
body. Those bounds describe the legal indexing of the section: the
produced view of a (possibly base-adjusted, compact) reduction temporary
must be indexed with the same bounds as the original array.
Carry the acc.bounds as optional operands on acc.reduction_init so this
indexing information is directly available. The operands are optional,
so scalar/whole-array reductions and existing IR are unaffected.
[Coroutines] Fix CoroElide resume fallthrough cleanup
Fixes https://github.com/llvm/llvm-project/issues/188230
A CoroElide noalloc variant stores the cleanup clone in the frame destroy
slot, while ordinary ramp entry stores the destroy clone. A resume clone
that falls through to coro.end previously loaded that slot after running
user cleanup and tail-called the selected clone. The continuation can free
the enclosing frame before that late load, producing an ASan use-after-free.
Moreover, both the destroy and cleanup clones repeat the promise cleanup
already performed by the resume clone, so heap entry double-destroys the
promise.
Cache the destroy slot on resume entry, before user code can resume a
continuation. Use the cached value only to distinguish an elided frame from
a heap frame and make the existing coro.free result null for the elided case.
The resume clone then performs shared cleanup once and directly frees only a
heap frame. This is enabled only when CoroElide creates a noalloc variant,
since other switch coroutines cannot receive an elided frame. Register the
[7 lines not shown]
[lldb] Contribute the GDB-remote packet history to diagnostics bundles
Register a Diagnostics artifact provider from ProcessGDBRemote so a
diagnostics bundle captures the GDB-remote packet history, the same data
"process plugin packet history" prints.
[AArch64] Add lowering for fixed-vector bf16 masked gather/scatter. (#210273)
Similar to #208744, this makes sure that bf16 masked gather and scatter
work with fixed-length sve enabled. Without +bf16 the operations are
currently expanded pre-isel, but that will not be fixed in this patch as
it is a larger change and this patch is intended to be ported to the
branch.
[Clang] Fixed auto parsing regression with brace initialization (#210347)
The PR #208552 has introduced a regression where brace initialization
was not taken into account `auto foo{12}`. It was also breaking
`dcl.type.general` p2 rules, which is also now tested.
[lldb] Contribute the GDB-remote packet history to diagnostics bundles
Register a Diagnostics artifact provider from ProcessGDBRemote so a
diagnostics bundle captures the GDB-remote packet history, the same data
"process plugin packet history" prints.
[lldb] Add an artifact provider mechanism to Diagnostics (#210417)
Add a hook that lets a subsystem contribute a file to the diagnostics
bundle, without breaking layering and making Core depend on it. A plugin
registers an ArtifactProvider callback and a file name via AddArtifactProvider.
Providers run when a bundle is collected, and each one that yields
content is written into the bundle and recorded in the report's
attachments.
This restores, in a simpler form, the collection point that the removed
Diagnostics callback mechanism offered. The motivating consumer is the
downstream Swift health check, which registers a provider to write its
"swift-healthcheck.log" into the bundle. Unlike the old callback, a
provider does not open or write its own file: it just returns the
contents as a string and Diagnostics handles the rest.
[LFI][AArch64] Fix Segfault due to infinite recursion in LFI rewriter (#210267)
When emitting a deferred LR guard, if debug info is enabled, the
emission of the guard instruction can trigger temporary labels (e.g. for
DWARF line entries), which recursively calls onLabel. Since
DeferredLRGuard was only set to false after emission, the nested call
would re-emit the guard, causing infinite recursion which leads to a
SegFault due to stack overflow. This was detected compiling
ubsan_minimal_handlers.cpp in compiler-rt. I fixed it by using the
existing recursion guard (Guard).
[LLDB] Enable SBTypeSynthetic manipulation for SBValue instances (#209056)
Allow manipulating the scripted synthetic children frontend selection
process for individual `SBValue` instances.
The motivating use-case is supporting custom data structures, type
erasure systems, and facilitating debugging handle based C APIs. Below
is an example of such a use-case of an anonymized 3rd party C library:
```C
using ErrorCode = int;
using Handle = void*;
using FooHandle = Handle;
using BarHandle = Handle;
struct ArrayOfHandles {
int size;
Handle* data;
};
[12 lines not shown]
[SSAF] Add EntitySourceLocationExtractor (#210201)
Walks every entity-producing decl in the TU and emits
SourceLocationRecord(s) per entity-kind anchor:
* Identifier-bearing decls (FunctionDecl/VarDecl/FieldDecl/ RecordDecl):
Decl::getLocation().
* Synthetic function return-slot entity:
FD->getReturnTypeSourceRange().getBegin().
* ParmVarDecl (named or unnamed): P->getTypeSpecStartLoc().
Skips compiler-synthesized implicits and builtins via the getEntityName
gate, system-header decls via SourceManager, and silently drops records
whose location is invalid or whose file path cannot be canonicalized via
real_path.
Assisted-By: Claude Opus 4.7
[VPlan] Move EVL-based transforms to VPlanEVLTransforms.cpp (NFC) (#209883)
VPlanTransforms.cpp has become quite big and is one of the top 20 most
expensive files in terms of compile-time.
https://llvm-compile-time-tracker.com/compare_clang.php?from=b8ba3c2b72cb53268129bbecfeb4ba7ec5b8d831&to=96a722a0ace661626d071166635728def97f6820&stat=instructions%3Au
Split off the mostly self-contained EVL related transforms and move them
to a new VPlanEVLTransforms.cpp.
This moves simplifyKnownEVL, optimizeEVLMasks, addExplicitVectorLength,
convertToVariableLengthStep and convertEVLExitCond together with their
EVL-specific static helpers.
Shared helpers used by the moved code (isDeadRecipe,
collectUsersRecursively, recursivelyDeleteDeadRecipes,
getOpcodeOrIntrinsicID and tryToFoldLiveIns, pullOutPermutations) are
promoted to vputils.
PR: https://github.com/llvm/llvm-project/pull/209883
[llvm-libtool-darwin] Ensure filelist buffer is null-terminated (#205115)
[llvm-libtool-darwin] Ensure filelist buffer is null-terminated
In llvm-libtool-darwin.cpp, `MemoryBuffer::getFileOrSTDIN` was
previously called to load the filelist with `RequiresNullTerminator` set
to `false`. However, the retrieved buffer is subsequently passed to
`llvm::line_iterator`.
Since `llvm::line_iterator` explicitly requires its underlying buffer to
be null-terminated, omitting this requirement can result in an
out-of-bounds read/buffer overrun when parsing the file list.
This change fixes the issue by requesting a null-terminated buffer
(`RequiresNullTerminator=true`).
Co-authored-by: Alexander Shaposhnikov <ashaposhnikov at google.com>