[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>
X86: Add pattern for optimized BLSIC IR form (#209814)
Add DAG pattern to recognize the optimized IR form of BLSIC: (xor (and
x, -x), -1)
Fixes #209718 - matches the IR form produced after InstCombine
optimizations
Added tests for both 32-bit and 64-bit BLSIC patterns
Assisted by: Claude Code, helped me understand
pattern-matching/intrinsics, and some file structure. As well as how
testing for LLVM works.
LinuxKPI: 802.11: stop ieee80211_start_tx_ba_session() if no HT supported
rtw89(4) would constantly try to start a TX BlockACK session even if no
HT or higher was available. The only way to stop this (currently) is
to return -EINVAL instead of any other error.
Note: we should investigate if/when to call (*set_tid_config)() as that
will also offer the ability to forbid BA.
Sponsored by: The FreeBSD Foundation
Reported by: arved, bnovkov
Tested by: bnovkov
MFC after: 3 days
[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
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.
I have a follow-up PR that takes advantage of this new mechanism
upstream to collect the GDB remote packet log.
[lit] Delete the external shell (#209571)
This was deprecated in LLVM 23 and slated for removal in LLVM 24. Now
that we have branched and everything has been updated to not set
execute_external, we can remove it.
[DAGCombiner] Fix APInt truncation assertion (#209914)
getConstant() would create an APInt with ImplicitTrunc = false, but the
constant here can really be anything.
Fixes #209884.
[CIR] Terminate conditional regions after creation; fix glvalue conditional with a throw arm (#210384)
Follow-up to #208850: @andykaylor's comments about
`CIRGenFunction::emitConditionalBlocks` also have a similar
insertion-point problem.
The PR addresses the two related problems found while looking into the
conditional branch emission path:
**1. Terminate conditional regions after creation instead of patching
yields**
`CIRGenFunction::emitConditionalBlocks` still had the save-and-patch
insertion-point machinery removed from the scalar path in #208850. The
path is unreachable, and its guard is saved only after
`cir.unreachable`, where a patched yield would generate the dead code.
The machinery is removed; regions are closed with
`terminateStructuredRegionBody` after creation.
The aggregate emitter had the reverse problem: an unconditional
[49 lines not shown]
filesystems/pjdfstest: fix the build in vanilla RISCV
Patch the port to update libc to a version that will work on RISCV
without COMPAT11.
Sponsored by: ConnectWise
[clang][sema] Fix crash on decomposition decl missing initializer (#210151)
ActOnUninitializedDecl dereferenced the std::optional<Token> from
Lexer::findNextToken() unconditionally when diagnosing a structured
binding with no initializer. Guard the optional and fall back to the
declaration's location.
[lldb] Truncate an over-wide symbol address in the IR interpreter (#210372)
IRInterpreter::ResolveConstantValue built a pointer-width APInt directly
from the address returned by FindSymbol. That address can be wider than
a target pointer, because lldb records extra information in the high
bits on some targets, such as the code/memory address-space tag on
WebAssembly.
A 32-bit pointer then cannot hold the tagged address and the APInt
constructor asserts, aborting the debugger when a function-valued
expression is evaluated (for example `expr main`).
Truncate to the pointer width instead of asserting, matching the idiom
already used in DWARFExpression. On targets whose addresses fit in a
pointer this is a no-op.
[lldb] Collect the executable, symbol file, and core in diagnostics (#210391)
The diagnostics bundle already gathers logs, statistics, and a snapshot
of the first triage commands, but sometimes the binaries are required to
reproduce an issue. Collect the main executable, its symbol file, and
the core file into the bundle.
Gate this on a new global setting, diagnostics.collect-binaries, which
defaults to false: these files can be large and privacy sensitive, so
including them is opt-in.
Assisted-by: Claude
[AMDGPU] Remove unnecessary and broken sign/zero extension in fastdiv (#210348)
Remove unnecessary and broken sign/zero-extension when using float-point
reciprocal to implement division/remainder. This change is analogous to
the change done in https://github.com/llvm/llvm-project/pull/203436 but
in AMDGPUISelLowering.cpp.
Signed-off-by: John Lu <John.Lu at amd.com>