[KnownFPClass] Refine `KnownFPClass::bitcast` deductions for `x86_fp80` (#224072)
Improves `KnownFPClass` deductions `i80` to `x86_fp80` bitcasts.
Non-canonical NaN's are treated as `fcSNan` if the quiet bit is known
clear, and `fcQNan` if the quiet bit is known set.
AI Disclosure:
I used ChatGPT Codex (5.6 sol and Astra-6) and Claude (Sonnet/Opus 5) to
help generate the tests and to review the code.
[libc++] Suppress unsigned-integer-overflow warning in <charconv> (#225801)
Invoking __complement with 0 as parameter triggers the unsigned integer
overflow UBSan.
[lldb][minidump][test] Disable test_size_of_image... when remote testing (#231498)
The test assumes that the program can load the shared library, which it
cannot unless we copy it to the remote.
The shared library is also built outside of the usual build process, so
it's using the host compiler and possibly other host things.
[X86] Don't form (FM)ADDSUB for bf16, or for narrow f16 vectors without VLX (#231445)
The shuffle combines that form (FM)ADDSUB only check for FMA, and only
exclude f16 from ADDSUB. There are no bf16 (FM)ADDSUB instructions, and
the AVX512-FP16 FMADDSUB needs VLX for 128/256-bit vectors. So an
add/sub shuffle of `<8 x half>` with `+avx512fp16` but no VLX, or of `<8
x bfloat>` (from FSUB/FADD or from FMA/FMSUB) with `+avx10.2`, fails to
select:
```
LLVM ERROR: Cannot select: t16: v8f16 = X86ISD::FMADDSUB t2, t4, t6
LLVM ERROR: Cannot select: t20: v8bf16 = X86ISD::FMADDSUB t7, t8, t9
```
Check the element type in both combines: reject bf16, and accept f16
only where f16 FMA is legal for the vector type (512-bit with
AVX512-FP16, 128/256-bit also with VLX). The new tests cover
128/256/512-bit f16 with and without VLX, and bf16 with and without
`contract` and from FMAs; the f16 no-VLX and bf16 RUN lines crash
[6 lines not shown]
[flang] Fix null pointer dereference in OUT_OF_RANGE folding (#224270)
Folding `OUT_OF_RANGE` could crash when the default logical kind is
8:`CompareUnsigned` assumed intrinsic comparisons always yield
`LogicalResult`(LOGICAL(4)). Unwrap as `SomeLogical` and convert to
`LogicalResult`.
Add a `fold-out_of_range.f90` RUN line with `-fdefault-integer-8` and
a`test_kind` check.
Fixes #212392
[AMDGPU] Widen scalar bf16 minimumnum and maximumnum to packed ops (#230467)
Promote scalar bf16 minimumnum and maximumnum to v2bf16 on targets with
packed BF16 instructions. This uses the existing scalar-to-vector
legalization and selects a single packed min/max instruction on gfx1250.
Add gfx1250 coverage in both register modes to the existing BF16 min/max
tests.
Fixes #230156
Assisted by GPT 6.1 Sol
[orc-rt] Add connectors for tcp:connect and tcp:listen. (#231473)
registerTCPConnect registers a "tcp" connector that supports only
"connect". registerTCPConnectAndListen registers one that also supports
"listen", and is used instead of it. A process that should be reachable
only by the controller it names never links the code to listen.
Descriptors are "<host>:<port>" or "[<IPv6 address>]:<port>". The host
for "listen" must be a numeric address. A listening executor accepts one
controller and then stops listening. It must name its port, since
nothing would report one the system chose. TCP does not identify the
peer, so both actions trust it as VettedPeer::unchecked.
On Windows, the TCP primitives and the socket CA are stubs that report
the transport as not yet supported.
ogre now registers registerTCPConnectAndListen, so it accepts
"tcp:connect" and "tcp:listen" specs as well as "socket:adopt".
Assisted-by: Claude
[examples] Set target triple on modules in examples. (#231480)
If no triple is set then the object format component of the Module's
triple will be set by getDefaultFormat in Triple.cpp, typically to ELF.
In AArch64AsmPrinter::emitStartOfAsmFile, the "ELF" default will cause
control to fall through the following check:
if (!TT.isOSBinFormatELF())
return;
and into a region that assumes an MCTargetStreamer. On Darwin/arm64,
which does not set an MCTargetStreamer, this will cause a nullptr
access.
Fix the issue by setting the Module's triple to the host triple.
Updates examples not fixed earlier by commit 9b989cbefc7.
rdar://189532634
[SLP]Recalc deps for copyable scalars of cancelled bundles
Only the non-copyable members of a cancelled bundle of a trimmed node
were marked for the dependency recalculation. Copyable scalars kept
stale dependencies, were never picked by the final scheduling and
stayed far from their users, extending live ranges. This regressed
709.cactus_r by 2% on Grace.
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/231499
[libc++] Optimize basic_string::operator=(const value_type*) (#227622)
This refactors `__assign_no_alias` to accept aliased strings and uses it
in `assign(const value_type*)` (which `operator=` forwards to).
[lldb][test] Attempt to fix flakyness of TestEmptyThreadList.py (#231486)
Has failed in CI and our buildbots, on AArch64 and x86_64.
```
FAIL: test_thread_list_goes_empty (TestEmptyThreadList.TestEmptyThreadList.test_thread_list_goes_empty) ---------------------------------------------------------------------- Traceback (most recent call last):
File "/home/buildbot/workspace/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/gdb_remote_client/TestEmptyThreadList.py", line 61, in test_thread_list_goes_empty
self.assertState(process.GetState(), lldb.eStateStopped)
File "/home/buildbot/workspace/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 3117, in assertState
self.fail(self._formatMessage(msg, error))
AssertionError: exited (10) != stopped (5)
Config=aarch64-/home/buildbot/workspace/lldb-aarch64-ubuntu/build/bin/clang ----------------------------------------------------------------------
```
My theory is that "S13" is being mapped to 19 aka SIGCONT in the base
UnixSignals list. This has stop=False, so when the test passes, the
empty thread path wins and we stop. When it is failing, it's because
that auto resume executed first.
To fix this use SIGTRAP which has stop=True. Fixes #227396.
[clang] Fix failed assertion crash when initializing compound literal pointer at file scope with error value (#229940)
e.g.
```C
x y; // error: unknown type name 'x'
constexpr int *p = (int*){y}; // failed assert
```
The fix was: before attempting to check if the pointer is null, first
make sure its not value dependent.
Fixes #229888
---------
Co-authored-by: aalmkainzi <aa.almkainzi at wakeb.tech>
[clang][ThreadSafety] Support lock_returned on function pointers (#226561)
d1e84bb9ad3b allowed the thread safety function attributes on function
pointers, but not lock_returned, so a call through a function pointer
could not return a known capability:
struct Ops {
struct Mutex *(*lock_of)(struct Dev *d) LOCK_RETURNED(&d->lock);
};
Handle lock_returned like the other attributes:
- Allow it on variables and fields of function pointer or function
reference type, rechecked after template instantiation.
- Parse its argument in the prototype's scope, so it can name the
pointee's parameters.
- Look it up on the callee declaration rather than only a direct callee,
substituting the call's arguments for the pointee's parameters.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[mlir] Avoid rewriting unreachable blocks in the greedy driver
A rewrite can disconnect a block after the iteration's initial CFG
sweep. Queued operations can develop self-referential SSA uses in
unreachable code, causing crashes or repeated rewrites that prevent the
worklist pass from returning. Track reachability through rewriter
notifications and skip these operations until the next iteration removes
their blocks.
The reproducer in #221152 exposes this gap in the initial sweep added by
#153957 for #153732. #154038 similarly skips unreachable blocks in the
walk-based driver. Reachable graph-region self-cycles in #194824 and
#205064 remain separate; #207185 proposes a fold-specific fix for them.
A forwarding ReachabilityListener sits between the rewriter and the
worklist driver and records, per region, which blocks changed their
terminator and which blocks were removed. Queries happen between
rewrites, once per popped operation, and update a per-region cache of
reachable blocks and their successors incrementally: added edges extend
[47 lines not shown]
[InstCombine] Mark profiles unknown in foldSelectOfSymmetricSelect (#231346)
We cannot infer the new weights without additional information, so mark
them unknown.
This finishes the profcheck fixes for InstCombine.
[X86] Add PFM Counters for GraniteRapids (#231329)
Just alias to SapphireRapids for now given it does not have its own
scheduling model. This is mainly useful for having a cycles counter when
running llvm-exegesis for benchmarking.
[libcxx] Don't use #define __unused in libcxx-03 for glibc (#230209)
Ports 3c16a8b183693e8df2e2173764e10c33c33ab06a to the cxx-03 headers.
This pops up when trying to bump the container version due to the ubuntu
26.04 update.
[libcxx] Fix -Wshift-counter-overfliw in cxx03 bitset (#230208)
I thought 83ec4c471b462cb650ce947d7d6554df3256140a fixed this, but it
turns out the gcc disablement was a red herring and clang was actually
warning in a different spot. This commit reverts that commit and applies
the disablement in the correct spot. I've actually tested that this
fixes the frozen-cxx-03 headers job.
[NFC][LV] Tests for parallel def-use chains (#225405)
This patch is an extension of the work in #198300 by adding a test for
vectorization of parallel def-use chains in loops.
Assisted-by: Codex
[InstCombine] Fold fpto[su]i of llvm.trunc
fptoui and fptosi already round toward zero, so a preceding llvm.trunc
is redundant and the conversion can take the untruncated value. NaN,
infinity, and out of range inputs produce poison in both forms.
```llvm
%t = call float @llvm.trunc.f32(float %x)
%r = fptosi float %t to i32
-->
%r = fptosi float %x to i32
```
The trunc may have other users; only the conversion operand is replaced.
[InstCombine] Add tests for fpto[su]i of llvm.trunc. NFC
fpto[su]i rounds toward zero, so a preceding llvm.trunc is redundant.
Cover scalar, vector, and multi use cases.
Reland "[lldb][minidump][test] Enable more minidump tests on AArch64 (#231467)" (#231474)
This reverts commit d9823582cb13b0dd493dd7162457683b24f54e5e.
Some tests were failing when on a Windows host because they tried to
delete the minidump file without deleting the target first. On Windows
you cannot unlink a file that something still has open, that something
being lldb here.
test_save_linux_mini_dump_thread_options cannot work remotely due to a
bug in the save routine. See
https://github.com/llvm/llvm-project/issues/231472.
[clang] Fixed auto type inference failing when the rhs is a bit-field expression (#226784)
e.g.
```C
void f()
{
struct S { unsigned i : 2; };
struct S s = {};
auto x = s.i; // previously failed. now accepted and x is an `unsigned int`
}
```
Fixes #226280
[Clang][Driver] Name unbundled non-RDC HIP SPIR-V images .spv
An amdgcnspirv device-only compile without -o wrote a SPIR-V binary
with a .out suffix. Use .spv for that case.