[CodeGen] Avoid sinking EH pad blocks (#224812)
EH pad blocks should not be sinkable since the control flow comes from
the unwinder instead of the predecessor.
This exclusion also matches the behavior of other sinkers.
Fixes #224802.
[lldb] Don't run code for CanJIT() while creating the ObjC runtime (#227555)
When libobjc lacks class_getMethodImplementation, the ObjC trampoline
handler calls CanJIT() to decide whether to warn. Without the _M
packet, CanJIT() allocated memory by calling mmap in the inferior.
Setting up that call unwinds the stack, which asks for the ObjC
runtime. The runtime isn't registered yet, so LLDB creates another one
and recurses until the stack overflows.
Ask the process plugin whether it can allocate memory instead of
trying it. ProcessGDBRemote probes the _M packet and otherwise checks
for an mmap symbol, neither of which runs code in the inferior.
rdar://188335027
[lldb][FreeBSDKernel] Find .debug files using pseudo sysroot (#224845)
Unlike userspace processes, it is common to obtain kernel dump from a
machine (e.g. QEMU) which different from the machine debugging the dump.
In this case users need to run `target symbols add foo.debug` for the
kernel and each kernel object, which becomes quite inconvenient when the
machine had dozens of kernel modules loaded during the dump.
This patch adds functionality to the dynamic loader so that it loads
symbol files automatically when kernel or kenrel modules are loaded. It
assumes a pseudo sysroot. When kernel is located at
`/foo/boot/kernel/kernel`, it will look for
`foo/usr/lib/debug/boot/kernel/kernel.debug` and same for kernel
modules. In this case, the only thing users need to do is copying the
dumped machine's `/usr/lib/debug/boot` relative to `/boot` that is being
debugged.
Assisted-by: GPT
[CASPlugin] Move CASPluginTest next to the CAS unit tests (#227546)
Set up the CAS test plugin like CGTestPlugin: move it from
llvm/tools/libCASPluginTest to llvm/unittests/CAS/CASPluginTest and
build it as CASPluginTest${LLVM_PLUGIN_EXT}, without the lib prefix or
a version, so its name is the same on all platforms. The lit tests now
find it via %llvmshlibdir/CASPluginTest%pluginext instead of a
configured LLVM_CAS_PLUGIN_TEST_PATH, and CASTests gets its path from
the build system through the CAS_PLUGIN_PATH definition.
[llvm-objcopy][MachO] Fix use-after-free when stripping (#228607)
We must preserve symbols referenced by the indirect symbol table even
with strip all, and we must preserve symbols referenced by relocations
without strip all.
Fixes: https://github.com/llvm/llvm-project/issues/228595
Assisted-by: codex
[lldb] Search both visionOS and XROS DeviceSupport directories (#228573)
Xcode now downloads visionOS shared cache symbols into
~/Library/Developer/Xcode/visionOS DeviceSupport, but
PlatformRemoteAppleXR only looked in "XROS DeviceSupport". As a result,
LLDB never found the expanded shared cache for visionOS devices and
failed to resolve symbols like `memcpy`, which breaks expression
evaluation and loading images into the inferior.
This makes `GetDeviceSupportDirectoryName` return a list of directory
names (renamed to `GetDeviceSupportDirectoryNames`) and have
`PlatformDarwinDevice` search each of them. visionOS returns both the
current and the legacy name; all other platforms keep their single name
for now.
rdar://189049149
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
[OpenMP] Do not GEP 'inbounds' for multi-dimensional OpenMP device maps (#218436)
The C standard treats array subscripts as inbounds of the object, but
OpenMP section maps intentionally index from a host-relative base that
is not the mapped allocation. Drop inbounds on those GEPs so later
passes do not assume the slice lives inside the object.
---------
Co-authored-by: Alexey Bataev <a.bataev at gmx.com>
ntp(9): Avoid more left shift of negative UB.
This logic is, presumably, intended to compute integer arithmetic, so
just write it as *16 instead of <<4. If there's an advantage to
using a machine shift instruction to get the same semantics, the
compiler can do that for us.
Also avoid arithmetic overflow. If set a few lines above,
time_monitor can lie anywhere in the interval [-MAXPHASE,MAXPHASE] =
[-500e6,500e6]. Multiplying by sixteen can therefore overflow the
bounds [-2.2e9,2.2e9] of long on LP32 platforms by a factor of four.
But mtemp >= 256 here, so even if time_monitor*16 overflows the
signed 32-bit range, the result (time_monitor*16)/mtemp will not.
Hence: cast to int64_t for the intermediate computation of
time_monitor*16.
This isn't the end of the analysis: time_monitor can also be set in
hardpps(9) to something else whose bounds aren't as clear to me, but
that only applies under `options PPS_SYNC' which is usually not set.
[4 lines not shown]
[VPlan] Remove NDEBUG and LLVM_ENABLE_DUMP guards around VPBlockBase::printOperand (#228326)
DominatorTreeBase::print calls the printOperand function of its NodeT
type unconditionally and the VPDominatorTree class is derrived from
DominatorTreeBase<VPBlockBase, false>.
This fixes the link with MSVC and LLVM_BUILD_LLVM_DYLIB_VIS=ON.
[libc++][docs] Use project-local links in release notes
Replace absolute libc++ homepage links with Sphinx document references in
release notes 20 through 24 and the release-note template.
I would leave these historical documents alone, but I have to fix these,
or the doc build will fail with warnings when I enable the absolute
self-link Sphinx doc build warning.
Validation: docs-libcxx-html, followed by a fresh Sphinx rebuild (-E), on
a merge of the three independent self-link fixes with the checker enabled
and warnings-as-errors disabled. No self-link warnings or new warning
messages compared with the audit baseline.
Part of #214861
Assisted-by: Codex
[LLDB] Make PythonRuntimeLoader a posix platform library (#228598)
The symbol ForEachPythonRuntimeCandidate is required when python is
enabled on LLDB. However, it is only provided by Linux platform now.
Make such soure code be compiled under all Posix platform other than
Darwin or it causes link error.
[docs] Repair remaining absolute self-documentation links
Replace same-project absolute URLs with relative source links or Sphinx
cross-references in LLVM, Flang, libc, clang-tools-extra, and OpenMP.
Use the explicit LangRef label for atomic.ignore.denormal.mode metadata.
This lets Sphinx validate the targets and keeps local and archived
documentation self-contained.
Validation: docs-llvm-html, docs-llvm-man, docs-llvm-dwarfdump-man,
docs-dsymutil-man, docs-flang-html, docs-flang-man, docs-clang-tools-html,
docs-clang-tools-man, docs-libc-html, docs-openmp-html, and docs-openmp-man,
followed by fresh Sphinx rebuilds (-E), on a merge of the three independent
self-link fixes with the checker enabled and warnings-as-errors disabled.
No self-link warnings or new warning messages compared with the audit
baseline.
Part of #214861
Assisted-by: Codex
[lldb][docs] Use project-local documentation links
Replace same-project absolute URLs with relative Markdown links and Sphinx
cross-references so local and archived documentation stays self-contained.
Update generated Python API docstrings at their header and SWIG inputs,
and repair stale Python and frame-recognizer destinations.
Validation: docs-lldb-html and docs-lldb-man, followed by fresh Sphinx
rebuilds (-E), on a merge of the three independent self-link fixes with
the checker enabled and warnings-as-errors disabled. No self-link warnings
or new warning messages compared with the audit baseline.
C/C++ formatting: git-clang-format --diff against main for the three
modified API headers reported no changes.
Part of #214861
Assisted-by: Codex
[AMDGPU][NFC] Extract GCNDownwardRPTracker::retireVirtReg (#228289)
Pull the per-register retirement logic out of advanceBeforeNext() into a
helper. The operand reference is replaced by the register argument.
A follow-up change needs to retire dying uses and dead defs at different
points in the walk, which requires this logic to be callable from more
than one place.
https://github.com/llvm/llvm-project/pull/228294 depends on this patch.
Assisted-by: Cursor/Claude Opus
ORC: Fix flaky OrcLazy tests
I've seen this fail a few too many times so just let AI deal with it. I don't
know anything about orc, but extend lifetime of lock_guard seems plausible.
Notify lookupInitSymbols CV while holding the mutex
The init-symbol lookup completion callback decremented Count under
LookupMutex but called CV.notify_one() after releasing it. The waiting
thread could observe Count == 0, return from lookupInitSymbols, and
destroy the stack-allocated mutex and condition variable before the
callback signalled it. With concurrent compile threads the callback runs
on a dispatcher thread, so the late notify wrote into reused stack
memory, e.g. during endSession right after deinitialize.
This caused intermittent crashes in
ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll on macOS
(#50408, #126982). MachOPlatform and ELFNixPlatform already notify their
bootstrap condition variables under the mutex for the same reason.
[2 lines not shown]