[NFC][SLP] Add a mixed-reassoc bundle to the operand-1 fma test (#216594)
One lane carries reassoc and the other three do not, so the bundle is
only partly reassociative. Also add a second threshold to the run lines.
[SandboxVectorizer] Fix out-of-bounds SeedBundle access on cross-bundle erasure
SeedCollection::runOnFunction() indexed a SeedBundle at
Seeds.getFirstUnusedElementIdx() (and, separately, at a hardcoded 0) without
first checking whether the bundle was already fully used.
getFirstUnusedElementIdx() returns Seeds.size() -- one past the end -- once
everything is used, so indexing there reads out of bounds.
This was always a latent bug, but -sbvec-collect-seeds=stores,loads is what
actually exposes it: store and load seeds share one erase-instruction
callback (SeedContainer::erase()), so when vectorizing a store chain erases
a load it packed as an operand, that erase also marks the same load "used"
in its *independent* LoadSeeds bundle. Store seeds are processed first, so
by the time the outer loop reaches that LoadSeeds bundle, it can already be
fully consumed -- or, since cross-bundle erasure can mark any index used
(not just sequentially from the front), have its element 0 specifically
erased while other elements remain live, which broke the hardcoded Seeds[0]
address-space lookup the same way.
[12 lines not shown]
[Clang] Support friend declarations with a dependent nested-name-specifier (#216555)
Fixes https://github.com/llvm/llvm-project/issues/104057
---
This patch adds support for friend declarations with a dependent NNS
PowerPC: Fix FMA reassociation crash on an undef multiply operand
Make sure getVRegDef succeeded.
Found by AI while working on something else.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
GlobalISel: Use MIPatternMatch in GIMatchTableExecutor
Replace the getVRegDef + opcode-check idiom in isBaseWithConstantOffset with
mi_match using m_GPtrAdd and m_GConstant.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
GlobalISel: Introduce m_GPtrAdd flags matcher in CombinerHelper
Add an optional MIFlags output operand to the binary-op matcher and a
m_GPtrAdd(L, R, m_MIFlags(F)) overload, and use it to replace getVRegDef +
opcode checks.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
[SSAF][UnsafeBufferAnalysis] Do not create entries for empty contributors (follow-up change on #209354) (#216526)
Address follow up questions after the approval.
- The analysis should not create entries for empty contributors, which
otherwise is non-empty in the serialized format.
- use std IO instead of a tmp file for regex-ing FileCheck queries.
rdar://179151541 and rdar://179151882
[CIR] Allow non-power-of-2-popcount (#216440)
Found in running a test suite, _BitInt of a non-power of 2 wasn't
allowed in our cir.popcount operation, despite it lowering perfectly
fine into the LLVM instruction. This patch relaxes the limitation to any
size integer, and adds tests.
Note we have no tests >128 because we can't lay those out yet in memory,
and the tests use local variables instead of arguments because _BitInt
calling convention work isn't in place yet either.
CodeGen: Fix lookThruCopyLike crash on an undef register
Found by AI while working on something else.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
CodeGen: Fix lookThruCopyLike crash on an undef register
Found by AI while working on something else.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
AArch64: Fix optimizeCondBranch crash on an undef register
Found by AI while working on something else.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
[clang][Lex] Preserve physical line start after comments in -C mode (#216556)
When comments are preserved with -C, a comment at the start of a
physical line consumes the PhysicalStartOfLine state. As a result, a
preprocessor directive following the comment is not recognized.
Preserve the PhysicalStartOfLine state when returning a comment token so
that directives following comments are still handled correctly.
Fixes: #48361
[APFloat][SelectionDAG] Support Float8E5M3FNU in convert.{to,from}.arbitrary.fp
Float8E5M3FNU was already accepted by the IR verifier, because
isValidArbitraryFPFormat is defined in terms of
getArbitraryFPFormatSizeInBits and that table covers it. It was missing
from getArbitraryFPSemantics, so SelectionDAGBuilder rejected
it with "not implemented format" and the verifier-clean IR failed to
compile. Add the mapping and the corresponding entries in the
expandCONVERT_{TO,FROM}_ARBITRARY_FP format allowlists.
Unlike every other format the expansions handle so far, Float8E5M3FNU is
unsigned: it has no sign bit, so all 8 bits go to a 5-bit exponent and a
3-bit significand.
Since an unsigned format cannot represent a negative value, a negative
input now saturates to zero when the saturate flag is set, and is poison
otherwise. -0.0 is excluded from that and still converts to +0, and the
check is ordered before the NaN case so a negative NaN still produces the
NaN encoding. APFloat treats constructing a negative value in an unsigned
[7 lines not shown]
[libc] Remove (weak) __cxa_thread_finalize (#216081)
Unlike __cxa_thread_atexit(_impl), this function is not a part of the
ABI as the process of calling the thread exit callbacks is an
implementation detail. Additionally, the weak definition gets in the way
of refactoring the thread code as the linker will not extract an object
from the archive if the dependency is already satisfied by a weak
definition.
Instead of a weak definition, I use a preprocessor macro to determine
whether we need to call the thread cleanup function (i.e., whether the
target supports threads).
[dyndbg][Clang] Implement nested-ELF dynamic debugging support (#216307)
Re-land https://github.com/llvm/llvm-project/pull/194860
A clone of the module is compiled without optimisations and embedded into the
to-be-optimised module using `embedBufferInModule`, similarly to how
`-ffat-lto-objects` and `-fembed-offload-object` work.
That unoptimised-code object is embedded in the optimised-code object in a
section called `.debug_llvm_dyndbg`.
The optimised ELF/module may be referred to as the "outer" ELF/module, and the
unoptimized one the "inner" ELF/module.
The outer module holds global data referred to by both modules and all calls in
the inner module are to outer module functions. To facilitate this the outer
module is modified, adding external-linkage aliases for local symbols.
For more detail see RFC https://discourse.llvm.org/t/90113 and documentation at
llvm/docs/DynamicDebugging.md.
[Clang] Diagnose conflict between always_inline/noinline attributes (#215173)
This PR aims to diagnose `always_inline` and `noinline` conflicts which
currently could pass silently through `Sema` or cause a crash (with
assertions enabled). Changes include:
- Added `MutualExclusions<[AlwaysInline, NoInline]>` in `Attr.td`
- Prevent `always_inline` and `noinline` from being propagated from
generic to specialized templates in `SemaDecl.cpp`
- Prevent inner attributes from clobbering unrelated outer attributes
(e.g. `noinline` and `nomerge`) in both `CGStmt.cpp` and
`CIRGenStmt.cpp`
Something to consider though: Should we prevent propagating conflicting
attributes when doing explicit template specializations in general, not
just `inline`, e.g. `hot`/`cold`, `convergent`/`noconvergent`, etc.
Fixes #214764
[2 lines not shown]
[ADT] Remove bucket_begin, bucket_end, and FoldingSetBucketIterator (NFC) (#216548)
This patch removes bucket_begin, bucket_end, and the underlying
FoldingSetBucketIterator and FoldingSetBucketIteratorImpl classes in
FoldingSet.
These were added on February 4, 2008 in commit
e2887863563fe5d2fdd8e1219b76fdc1ee9ec37d for ImutAVLTree in
ImmutableSet.h. The last use was removed on November 30, 2010 in commit
dbd89971ffb3a222dc91513585e8d6b5bc7882db when ImmutableSet switched
from FoldingSet to DenseSet.
Assisted-by: Antigravity
[MLIR][NVVM] Spell strict assembly properties directly
Bind every NVVM inherent property in its operation assembly format and
re-enable strict property parsing for the dialect. Use direct named clauses
for declarative formats and custom MMA parsers while retaining dictionaries
for discardable attributes.
Assisted-by: Codex
[DAG] expandPEXT/PDEP - scalarize vector instructions if the scalar type is legal (#216567)
If the scalar instruction is legal, just unroll (scalarize) - similar to
what a lot of other generic expansions already do.
Helps x86/BMI2 targets at least for vXi32/i64 types - there's more we
can do to address vXi8/i16 types and slow-PDEP/PEXT cases (znver1/2
etc.) but they can be addressed later with x86 specific lowering after
we have the generic base in place.
Fixes #214508
[CIR] Fold load from constant alloca slots (#212284)
This patch folds non-volatile non-atomic `cir.load` operation that loads
from a constant alloca slot into the initial value stored into that
slot, if the initialization dominates the load.
This effectively enables "constant folding" at the C/C++ language level.
Consider the following C/C++ source program:
```cpp
int g();
void use(int);
void h(const int *); // <-- The body of h is external.
void f() {
const int x = g();
h(&x);
use(x);
}
[8 lines not shown]
[SandboxVec][DAG][NFC] Replace UnscheduledSuccs/Preds with a single variable (#215364)
This is a cleanup patch that replaces the two DAG node unscheduled
dependency counters (that is UnscheduledSuccs and UnscheduledPreds) with
a single one named UnscheduledDeps.
The reasoning is that scheduling operates on one direction at a time so
if we are scheduling bottom-up then we only need the unscheduled
successors, and if we schedule top-down then we only need the
unscheduled predecessors.
[Sparc][NFC] test sparc variadic aggregate handling (#216521)
equivalent of https://github.com/llvm/llvm-project/pull/216509 for
sparc. It similarly has some bugs passing aggregates with floats.
[Clang] Accept auto casts pre-C++23 as an extension (#200675)
GCC already supports this as an extension pre-C++23. It is also useful
for libc++ to replace `_LIBCPP_AUTO_CAST`.
Fixes #115609
[libc++] Simplify the implementation of std::make_from_tuple (#215067)
This does two major things:
1) It removes conditionals for C++20/pre-C++20. I don't understand why
this has ever been done. This made the implementation significantly more
complicated without any indication that it actually improved anything.
2) std::apply is used for expanding the tuple