[LegalizeTypes] Don't pad cttz_elts_zero_poison with ones when widening op (#206705)
We only need to pad the widened lanes with ones to handle the case for
an all zeroes input. But for cttz_elts_zero_poison, this is already
poison.
The RISC-V scalable vector test can't be precomitted because it crashes
otherwise trying to lower a get_active_lane_mask from
getMaskFromElementCount.
Also while we're here, switch to using TLI.getTypeToTransformTo to be
consistent with other `WidenVecOp_*` implementations.
[flang][OpenMP] Compute the set of loop directives in parser, NFC
Use the constexpr functions for association and source language
to compute the set of loop-associated directives instead of listing
them individually.
[Offload][OpenMP] Accept `omp_initial_device` for runtime calls (#205290)
In OpenMP v5.2, the constant `omp_initial_device` was introduced, which
was defined as a value of `-1`.
Support for this value was added to Clang and Flang in
09cd2944821fa43d97d8259194b9a0c4fa22de16 and
3c14034c55a296306ad0ea4990f0f1b34e9e5d6e.
However, runtime calls are not aware of this constant. As such,
execution of a runtime function, passing `omp_initial_device` as the
`device_num`, would abort with e.g.,:
```
omptarget fatal error -1: "invalid value" device number '-1' out of range, only 1 devices available
```
To fix this issue, also extend the host device checks in the API
functions to also check for `omp_initial_device`.
For testing, extend API tests using `omp_get_initial_device()` to also
[10 lines not shown]
[lldb] Add a GitHub bug reporter (#206607)
Add a BugReporter plugin that files a diagnostics bundle as an
llvm/llvm-project GitHub issue. File() renders a short Markdown body
from the Diagnostics::Report (version, host, invocation, and a pointer
to the bundle directory to attach), truncates it under a GET-safe URL
length on a UTF-8 character boundary, and opens a pre-filled issues/new
page with Host::OpenURL.
It is gated by LLDB_ENABLE_GITHUB_BUG_REPORTER (default on) and
registers ahead of the no-op fallback, so it is the default destination
for "diagnostics report" while a downstream tree can still register its
own reporter ahead of it.
[Dexter] Avoid incorrect state matching against frames below main (#206732)
This patch fixes an error that caused some Dexter test failures, driven
by two separate causes. The first issue is that frames below main were
appearing in the program stacktrace; while Dexter tries to filter frames
below main during the stacktrace collection step based on a pre-written
list, this list may not be comprehensive enough, as the symbol
"___lldb_unnamed_symbol_2a150" has also appeared. In order to guard
against this and future cases that might appear, this patch adds a check
to Dexter for "presentationHint: deemphasize" in the DAP response; this
is added by LLDB (and other dap-based debuggers) as a hint that the
frame is not user source, and should be a generally useful way of
avoiding evaluating frames that are not wanted.
The second issue is a mismatch between the breakpoint-setting logic and
the state-matching logic: the former allows root !where nodes to omit
the "file" field, using the script file as a default file. The state
matching logic does not perform any checking for an omitted file.
Together, this means that we may correctly set breakpoints for e.g.
[4 lines not shown]
compiler-rt: intercept fortified read/pread wrappers (#206228)
Add TSAN/common interceptors for glibc fortified read/pread calls, so
that they follow the same blocking and signal-handling path as the plain
libc symbols.
The regression test from https://github.com/llvm/llvm-project/pull/77789
for `read`, when compiled with `-D_FORTIFY_SOURCE=3` fails without the
new interceptors.
I have a regression test for pread(64) as well, but I am not sure if
there is much value in adding it.
I've added a read smoke test in sanitizer common.
---------
Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^_ at 721217.xyz>
[NFC][analyzer] Improve code quality in VisitBinaryOperator (#205151)
I started out to remove the `NodeBuilder` in
`ExprEngine::VisitBinaryOperator` (as a part of my commit series that
removes `NodeBuilder`s), but I noticed that this method is full of
technical debt, so I decided to do a through clean-up (which includes
the removal of the trivial `NodeBuilder`).
[PGO] Fix malformed raw profile test (#206738)
A hand-written raw profile test still wrote one extra word in the data
record after the raw profile format changed.
Remove the extra word so the name section starts at the offset expected
by the reader. This keeps the test focused on the trailing garbage that
should report that there is not enough space for another header.
Buildbot failure:
https://github.com/llvm/llvm-project/pull/190708#issuecomment-4839831651
[OffloadBundler] Bound compressed bundles by header size, not magic scan
When multiple offload bundles are concatenated, the unbundler
(clang-offload-bundler) and llvm-objdump --offloading located the end of a
compressed bundle, and the start of the next one, by scanning for the next
"CCOB" magic string starting right after the current header.
A zstd/zlib-compressed payload can legally contain those four bytes, so the
scan could stop in the middle of the compressed data and truncate the
bundle, corrupting the embedded code object. In practice this produced a
"decomposition" failure for hipBLASLt bf16 GEMMs on gfx942.
Use the authoritative total-size field recorded in the compressed bundle
header (format V2/V3) to compute the exact bundle boundary, and only scan
for the next magic past that point. Legacy bundles without a recorded size
(V1) keep the previous magic-scan fallback.
A skippable-frame fixture that embeds "CCOB" inside the compressed payload
is added to exercise the boundary logic from both clang-offload-bundler and
llvm-objdump --offloading.
[Offload] Make compressed offload bundle header little-endian
The compressed offload bundle (CCOB) header integer fields (Magic,
Version, Method, FileSize, UncompressedFileSize, Hash) were serialized
and read in host-native byte order. The on-disk format is little-endian,
so on big-endian hosts these fields were byte-swapped: writing produced a
malformed header and reading misparsed the size, making
llvm-objdump --offloading crash/misbehave on s390x.
Use support::ulittleN_t for the header fields on the read side and
support::endian::Writer on the write side, so the header is always
little-endian regardless of host endianness.
Co-authored-by: Nikita Popov <npopov at redhat.com>
[Offload][NFC] Deduplicate CompressedOffloadBundle into llvm::object
The compressed offload bundle (CCOB) format had two byte-for-byte
identical implementations: one in clang/lib/Driver/OffloadBundler.cpp and
the canonical one in llvm/lib/Object/OffloadBundle.cpp (already used by
llvm-objdump, comgr and others).
Remove the Clang-side copy (class declaration, compress/decompress/
tryParse, the RawCompressedBundleHeader union, getHeaderSize, the
formatWithCommas helper and the private timer group) and route the driver
through llvm::object::CompressedOffloadBundle, which is already linked via
the Object component.
The only API difference is the verbose-reporting channel (bool Verbose vs.
raw_ostream *VerboseStream); the driver now passes &llvm::errs() when
verbose output is requested, preserving the previous behavior.
No functional change intended.
[Dexter] Require lldb-dap for Dexter and log when Dexter is disabled (#206734)
For some time, Dexter tests have been run using lldb-dap when it is
available rather than just lldb/lldb-server. However, the cross project
test dependencies have not been updated since then, meaning that
lldb-dap is not automatically built by check-cross-project. The
Dexter-specific lit config then skips the Dexter tests if lldb-dap is
unavailable, which leads to some check-cross-project builds never
running the Dexter tests. This patch adds lldb-dap to the build
dependencies, and also adds a small log message to inform when the
Dexter tests are skipped; most cases where we skip the Dexter test were
already logged, and this addition expands that to cover all cases.
[PGO][NFC] Avoid floating-point block uniformity check (#206547)
Use an integer threshold when deciding whether a block is mostly
uniform.
This keeps the 90% rule exact and avoids relying on floating-point
arithmetic in profile merging.