[NFC][BOLT] Clean up brstack wording (#238358)
BOLT documentation and comments currently use LBR in non-x86 specific
contexts to refer to branch stack information. This can be misleading as
other targets use similar technologies, such as AArch64's BRBE. This
patch updates these non-x86 specific usages to the term `brstack`, which
is target independent.
[lldb-dap] Fix an overflow in the modules request (#243064)
For example with args {"startModule": 1, "moduleCount": 4294967295} This
would hit the assertion that start_module <= end_module. Without the
assert it would try to allocate 4 billion + modules and crash.
Limit the possible reserved modules to maximium the total number of
modules in the target.
[lldb-dap] Respect the type summary option of a variable. (#241385)
Some variable's TypeSummary may chose to hide its value when it shows a
summary. Respect the option.
Fixes https://github.com/llvm/llvm-project/issues/240891
[libc] Retry interrupted netlink dumps in if_nameindex (#243069)
If the interface list changes while the kernel is sending us the dump,
it marks the following datagram with NLM_F_DUMP_INTR, and the result may
be inconsistent. Before 6.9, the kernel resumes each datagram from a
position within a hash bucket, so a concurrent removal can make it skip
a live interface (and an addition can make it repeat one). Since 6.9, it
resumes from the next ifindex, which avoids duplicates, but we can still
get stale entries.
Deduplicating the entries (as the TODO suggested) would only fix some of
that, so instead I'm throwing the result away and repeating the dump.
The kernel won't start a new dump on a socket while the old one is still
running, so we still read the interrupted dump until NLMSG_DONE, and
then send a new request on the same socket. After three interrupted
attempts, we give up and return EAGAIN.
For the retries, I'm switching to a larger (32K) heap buffer. The kernel
sizes the dump datagrams according to the largest buffer we've passed to
[15 lines not shown]
[lldb-dap] Don't repeat the type in a variable's value (#240897)
When a value had neither a value nor a summary, lldb-dap used its type
name as the value. The type is already sent in
the `type` field, so clients that show variable types displayed it
twice.
Move setting the types to the VS Code extension, It is only enabled if
the setting `debug.showVariableTypes` is true.
Fixes #240886
[ARM] allow hlt on all A and R profile architectures (#239909)
The Arm semihosting specification v2.0 requires implementations to
support hlt as a semihosting trap on all A/R-profile architecture
versions, including Armv7 and earlier where hlt is not defined.
https://github.com/ARM-software/abi-aa/blob/2026Q3/semihosting/semihosting.rst#the-semihosting-interface
GNU binutils supports hlt on pre-Armv8 A/R-profile since version 2.33
for the same reason.
[AArch64] Fix missed-optimization problem because of DBG_VALUE at successor entry. (#241736)
Use skipDebugInstructionForward(CurMBB->begin(),CurMBB->end()) for
skipping DBG_VALUE at sucessor entry,so it won't prevent post-index
store formation.And the test indicates it works.
This fixes #229307
[flang] Only fuse the first operand of a chained concatenation
Fusing a concatenation that is not the first operand of its user reads
the user's preceding operands first, which reorders volatile accesses.
Lowering creates left-nested chains, so nothing is lost.
Move the scalar chain test from an LLVM IR integration test, whose
alloca checks depended on the target index width, to the FIR storage
test, and keep the unfused -O0 expectations for the array case.
[libc] Implement statx in sys/stat (#240031)
This PR implements `statx` in `<sys/stat.h>`.
- Connects public `statx` entrypoint to internal Linux syscall wrapper.
- Adds `struct statx` and `struct statx_timestamp` definitions to
`llvm-libc-types` and `hdr/types`.
- Registers public declaration in `libc/include/sys/stat.yaml`.
- Registers entrypoints across Linux targets (`x86_64`, `aarch64`,
`riscv`).
- Adds unit tests in `libc/test/src/sys/stat/statx_test.cpp`.
Fixes #240022.
[X86] Mark vXi64 int to fp undesirable without AVX512DQ
Without avx512dq there is no vector conversion from i64 elements to f32
or f64, so widening the conversion of a source truncated with nsw or nuw
back to i64 makes it slower.
avx512fp16 converts i64 elements to f16 directly, so the widening folds
now pass the node and the check sees the result type.
Assisted-by: Claude Code Opus 5.5
[DAGCombiner] Mark uint_to_fp widened through trunc nuw as nneg
The source of a trunc nuw fits in a strictly narrower type, so it is
non-negative. Without nneg x86 lowers the widened conversion through the
unsigned i64 expansion.
Assisted-by: Claude Code Opus 5.5
[NFC][X86] Add tests for int to fp of a trunc nuw or nsw source (#242913)
Without avx512dq a vector i64 source truncated with nsw or nuw is
converted one element at a time or through the unsigned i64 expansion.
A scalar source truncated with nuw takes the expansion without avx512f.
avx512fp16 converts i64 to half directly even without avx512dq.
Assisted-by: Claude Code Opus 5.5
[lld-link] Fix use-after-free in --time-trace with type server PDBs (#242726)
LinkerDriver::enqueuePath() used to capture its `StringRef path`
parameter. For type server PDBs, `path` is a local in
ObjFile::enqueuePdbFile() and the StringRef dangles and points to
garbage (which in assert-enabled builds usually isn't valid UTF-8,
making the trace assert with "Invalid UTF-8 in value used as JSON").
Instead, use the already-existing std::string copy of the path.
[clang] Fix encoding handling of asm strings (#169803)
This patch builds upon https://github.com/llvm/llvm-project/pull/138895
and introduces a new ConversionAction parameter to
ParseStringLiteralExpression to allow asm strings to be, for z/OS,
initially evaluated in IBM-1047 (so that numeric escape sequences denote
IBM-1047 code points) before being converted to UTF-8 for further
processing (e.g., parsing for operand references).
For example, on z/OS we want \174 to map to the '@' character in
IBM-1047 regardless of fexec-charset.
`__asm__("\174asm_sym")` This is required because there are variant
characters in the ebcdic family and it is common on the z/OS platform to
compile with an fexec-charset set to an ebcdic (non-IBM-1047) codepage.
This would result in different values for ("@asm_sym")
If there is a constexpr in place of the asm string, the sequence of char
values produced will be converted (for all targets, not only for z/OS)
from the literal encoding to UTF-8 for further processing, except when
the literal encoding is UTF-8.
[Xtensa] Move emergency spill slot near SP and reserve it for SP adjustments (#237791)
Functions with a frame pointer adjust SP around calls with stack
arguments. That needs a scratch register at a point where all outgoing
arguments are live. If none is free, the register scavenger aborts with
"Cannot scavenge register without an emergency spill slot".
Reserve the slot in functions that adjust SP around a call.
The slot also has to be in reach. With a frame pointer, PEI allocated it
next to the incoming SP, at the top of the frame. That default assumes
that the frame pointer points there, but on Xtensa it is equal to SP
after the prologue. In large frames, saving a register to the slot then
needed another scratch register, and the register scavenger aborted with
"Incomplete scavenging after 2nd pass".
Allocate the slot close to SP, as Mips and SystemZ do.
Fixes #195412.
Assisted-by: Claude
[OpenMP] [NFC] Use setHelperExprs in OMPTargetGenericLoopDirective::Create. (#242023)
`OMPTargetGenericLoopDirective::Create` was added in #238448 before
`OMPLoopDirective::setHelperExprs` was introduced in #238950, so it
still sets each helper expression by hand. Use `setHelperExprs` like the
other loop directives.
[BOLT] Gadget scanner: prevent false positives due to jump tables
As part of PAuth hardening, AArch64 LLVM backend can use a special
BR_JumpTable pseudo (enabled by -faarch64-jump-table-hardening
Clang option) which is expanded in the AsmPrinter into a contiguous
sequence without unsafe instructions in the middle.
This commit adds another target-specific callback to MCPlusBuilder
to make it possible to inhibit false positives for known-safe jump
table dispatch sequences. Without special handling, the branch
instruction is likely to be reported as a non-protected call (as its
destination is not produced by an auth instruction, PC-relative address
materialization, etc.) and possibly as a tail call being performed with
unsafe link register (as the detection whether the branch instruction
is a tail call is an heuristic).
For now, only the specific instruction sequence used by the AArch64
LLVM backend is matched.
[TableGen] Fix depfile escaping test on MinGW (#242919)
The test assumed that native Windows paths use backslashes.
LLVM_WINDOWS_PREFER_FORWARD_SLASH=ON, the default for MinGW builds,
converts separators to forward slashes before escaping, causing the
depfile check to fail.
Run the test with both separator preferences explicitly selected. Check
forward-slash output on Windows while retaining literal backslash checks
on other platforms, independently of the configured default.
Addresses
https://github.com/llvm/llvm-project/pull/160834#issuecomment-6902350571
[AArch64] Restore STI after emitting a PAuth IRELATIVE resolver (#242420)
The resolver can be emitted while emitting a function, whose
instructions then used the subtarget freed at the end of
emitPAuthRelocationAsIRelative. Found by -Wlifetime-safety.
Assisted-by: Claude Opus 5.5
Co-authored-by: Gabor Horvath <gaborh at apple.com>
release/23.x: [LV] Have ExtractValue match the shape of the operand. (#229927)
Previously, BuildStructVector would create a vector of a wide struct
type, where each element is widened.
This can cause issues, if a transform turns an extractvalue of a wide
call into a single-scalar (e.g. makeScalarizationDecisions), because we
currently cannot extract lane 0 from a struct of vectors.
Instead of relying on BuildStructVector, we can instead have the
ExtractValue match the shape of its operand (either widen if the operand
is wide, or replicated if the operand is scalar). If a vector value is
needed, we can directly use the existing BuildVector.
This fixes a number of crashes in the newly added tests, including
https://github.com/llvm/llvm-project/issues/229609.
Depends on https://github.com/llvm/llvm-project/pull/229925
PR: https://github.com/llvm/llvm-project/pull/229927