[SimplifyCFG] Use check-globals=smart for test
Instead of manually writing out check lines for the test. This makes the
test more standard and easier to update.
Reviewers: akuegel, mtrofin
Pull Request: https://github.com/llvm/llvm-project/pull/234826
[bazel][compiler-rt] Introduce source exporting for ASan, UBSan, and LSan (#234492)
This exports the source files, headers, textual sources, and compile
flags for building the AddressSanitizer, UndefinedBehaviorSanitizer, and
LeakSanitizer runtime libraries on demand or via Bazel.
Also exports ignore lists and the basics needed for syms files. The
groups are decomposed in a way that allows us to build equivalent
runtimes to how CMake works. This is the basis that Carbon is building
on to support on-demand sanitizer runtimes.
Assisted-by: Antigravity with Gemini
[bazel][libcxx][libcxxabi] Introduce basic sources and copts exporting for libcxx and libcxxabi (#234489)
This exports the source files directly so that they can be used to build
a libcxx runtime library on demand. It also differentiates between
normal sources and textual sources in necessary places.
It also exports `.in` template files along with the source and headers.
And lastly, it exports `copts` to use when building both libcxx and
libcxxabi.
Assisted-by: Antigravity with Gemini
[AArch64][GlobalISel] Run shift_immed_chain in the post-legalizer combiner (#234727)
The legalizer can create chains of shifts by constants that the
pre-legalizer combiner never sees. Adding `shift_immed_chain` to the
post-legalizer combiner merges them.
```llvm
define i16 @test(i16 %a) {
%r = sdiv i16 %a, 7
ret i16 %r
}
```
Before (7 instructions):
```
sxth w8, w0
mov w9, #18725
mul w8, w8, w9
asr w8, w8, #16
[18 lines not shown]
[IR] Remove -use-dereferenceable-at-point-semantics option (#218428)
This was a temporary migration option, remove it now that the migration
is complete.
[bazel][compiler-rt] Exclude more libc-backed builtins (#234486)
Follows the pattern of #214779 and excludes new builtins added by
#207543 and #209900.
Assisted-by: Antigravity with Gemini
[bazel][libunwind] Introduce basic source and copts exporting for libunwind (#234485)
This exports the source files and copts directly so that they can be
used to build this runtime library on demand. This is used by Carbon's
toolchain to package and build `libunwind`.
Assisted-by: Antigravity with Gemini
[bazel][compiler-rt] Add `libfuzzer` target to `compiler-rt` (#234482)
This lets Bazel users of LLVM to also use `libfuzzer` directly to build
fuzz tests, including the `main`-function it provides. This is a simple
and uncomplicated approach to leveraging `libfuzzer`, and seems useful
to include. Carbon has been using it for the last several years
successfully.
One tricky part is that we have to carefully manage the compiler flags
when compiling with Clang.
Assisted-by: Antigravity with Gemini
Report TrueSearch in usage statistics services
## Problem
TrueSearch has no "Start Automatically" flag and no row in the services table, so it never shows up in the `services` list of the usage statistics and there is no way to tell how many systems use it.
## Solution
Append a `truesearch` entry to `services`, with `enabled` coming from `truesearch.enabled`, the same check middleware uses to decide whether to start the daemon (licensed, and SMB Spotlight or WebShare search have shares to index).
[Clang][ABI][X86] Do not emit zeroext/signext for return values (#232729)
This stops emitting the zeroext/signext attributes for return values on
X86, except for `bool` (which stays zeroext, as it requires
zero-extension to 8 bits) and Darwin.
The `getTypeForExtReturn()` in the X86 backend already ignores
zeroext/signext for i8 and i16 types on non-Darwin platforms. For these
cases, this change has no impact on codegen: The intent is merely to
clarify the used psABI. Using zeroext/signext when no actual extension
takes place is highly confusing, esp. when the behavior is different
between return values and arguments.
However, this *does* change behavior for non-i8/i16 types. Specifically,
it changes `_BitInt` types to have unspecified high bits, instead of
performing a partial sign/zero extension to 8, 16 or 32 bits. This makes
`_BitInt` comply with the Linux psABI, the previous behavior was
incorrect. MSVC does not support `_BitInt`, so there is no correct ABI
there.
[5 lines not shown]
[DenseMap] Skip TrivialCopyable Test on FreeBSD (#234853)
FreeBSD currently does not provide a trivially copyable std::pair to
avoid an ABI break. Consequently, the isRelocatableBucket check fails,
so we disable this static_assert on FreeBSD.
[CodeGenPrepare] Drop poison-generating flags on extensions in optimizeExtUses (#234134)
`optimizeExtUses` rewrites uses of an extension's source in other blocks
to read `trunc` of the extension, which is only correct where the
extension isn't `poison`. A `zext nneg` can be valid only where it was
originally used, like behind a check that its source isn't negative. If
that check is one of the rewritten uses, it ends up reading `poison`,
and on `x86_64-pc-windows-msvc`, InstSimplify in WinEHPrepare's cleanup
folds it to true and causes a miscompile.
Drop the extension's poison-generating flags once a use has been
rewritten, like #72103 and #90382 did for similar cases in
`CodeGenPrepare`.
Fixes #234098.
(cherry picked from commit 93fccabb4ebc82695475eaaa279ea5fbb2265450)
[debuginfod] Abort cached file stream if request fails (#232038)
When an HTTP request fails while it already received some data, the
cached file stream is never committed. Destroying it in that state
raises a fatal error, crashing the program (see #184728).
This PR adds an `abort` method that should be called in this situation
before destroying the stream. For the default implementation, only the
output stream is closed. For the `CacheStream` in `llvm::localCache`,
the temporary file is discarded as well.
The test is based on David's reproducer. Since WinHttp seems to discard
the content-length header, I switched to timing out the response
instead.
Fixes #184728. This is still a bug for the symstore locator in lldb, but
I'll fix that in a followup.
fix: disable test partial-response.test on system-windows
[flang][OpenMP] Ignore DECLARE_SIMD and warn about missing implementa… (#232712)
…tion
Currently DECLARE_SIMD emits a "not yet implemented" error in the MLIR
to LLVM IR translation.
DECLARE_SIMD is a hint to the compiler and ignoring it is technically
speaking a conforming implementation (although obviously not desirable).
Do not abort compilation when DECLARE_SIMD is encountered, but emit a
warning that it's currently ignored.
(cherry picked from commit 5ca62fdee645ec253263e41a45fe626c6b66be22)
Fixes: https://github.com/llvm/llvm-project/issues/234108
[lldb] Preserve the siginfo when running syscalls in the inferior (#234153)
NativeProcessLinux::Syscall (used to implement the _M and _m packets)
runs a syscall instruction in the current thread. It restores the
registers and memory afterwards, but not the siginfo, which ends up
describing the SIGTRAP from the syscall instead of the signal that the
thread originally stopped with.
lldb allocates memory quite often, even when evaluating expressions
which don't run any code in the inferior (e.g. "expr 1+1"). Afterwards,
"thread siginfo" shows the wrong data. More importantly, the inferior
doesn't get the original siginfo when lldb resumes it with the signal it
stopped with: the kernel sees that the signal does not match the
siginfo, and makes up a new one (with si_code=SI_USER and the pid of
lldb-server). This means that e.g. a SIGSEGV handler does not get the
fault address.
This patch makes Syscall save the siginfo before running the syscall,
and restore it (with PTRACE_SETSIGINFO) afterwards.
Assisted-by: Claude
[flang] Fix wrong result for exponentiation when denormal is expected (#205262)
Fixes #192639
Root cause:
Negative integer exponents used exponentiation-by-squaring that divides
by successively squared bases; for |base| > 1 intermediates overflow
before the final divide.
Fix
- Constant folding: After the direct path, retry with (1/base)^|n| only
when overflow was flagged, so ordinary negative powers stay accurate and
extreme cases still get subnormals. Handle INT_MIN via the original
exponent on retry (forceMultiply).
- Runtime FPowI: Same idea—invert after base^|n|; retry from 1/base only
when the quotient is exactly zero and base != 0, avoiding unnecessary
reciprocal-first rounding loss.
Scope - What changed
[7 lines not shown]
[lld-macho] Build the export trie by edges, not bytes (NFC)
Emit singleton suffixes directly and scan common prefixes in one pass,
avoiding repeated byte-wise partitioning. Preserve radix traversal,
node allocation order, and terminal encoding.
On a Ryzen 7 7700, a rust-analyzer debug link with 248,607 exports
changes from 2079 to 1948 ms at one thread and 1269 to 1185 ms at
eight threads (median wall times over four interleaved pairs).
nuageinit: fix support on OpenStack
Change added in 90a7728cd8905cd26b90d06f7873df8bad43ae9a contained a
lot of bugs:
- If all network interfaces correctly respond to DHCP, then pwait was
waiting forever.
- If there was more than 1 interface, then "cat
/tmp/ephemeraldhcp.*.pid" joined pid numbers into one long string.
- "for iface in $left; do kill -15 $left; done" is not using $iface.
Tested by: adam.mizerski at ovhcloud.com
Sponsored by: OVHcloud
Pull Request: https://github.com/freebsd/freebsd-src/pull/2436
(cherry picked from commit 13d5f20e5b9ecb42ecf7de4e98d5af0bd5d63c82)