[HashRecognize] Recognize trunc-to-i1 little-endian bit check (#213883)
InstCombine may rewrite `icmp ne (X & 1), 0` to `trunc X to i1`
(#178977). Accept that spelling in the CRC significant-bit matcher.
Fixes: #213881
Assisted-by: AI
[lldb] Add MSVC STL formatter for vector iterators (#217247)
`std::_Vector_iterator` and `std::_Vector_const_iterator` store the
element pointer in `_Ptr`. Reuse the existing vector-iterator frontend
(same pattern as libc++ / libstdc++).
Tests: generic iterator suite's MSVC STL category (Windows).
Part of #24834
Assisted-by: Grok 4.6
Assisted-by: codex-5.6-high
---------
Co-authored-by: Bjorn Schobben <bjorn.schobben at aimsport.com>
[Clang] use TemplateName in AutoType / TypeConstraint to store a concept (#217637)
This is in preparation of implementing P3670 - ie we are going to have
pack indexing to model a concept, so a TemplateDecl* is not sufficient.
This is fairly mechanical.
There are still some places, especially in tooling & json dumping where
we reach to the underlying TemplateDecl - which will have to change
later.
But I think we need to have pack indexing first to update these places
(and I wanted to minimize change to tooling here).
The serialization of AutoType was changed to work around a weirdness
of TemplateName which makes serialization of an null TemplateName
impossible.
Assisted-by: Opus 5
[PAC][ELF] Support R_AARCH64_AUTH_TLSDESC_CALL relocation
The R_AARCH64_AUTH_TLSDESC_CALL is introduced to allow linker relaxation of
AUTH TLSDESC call sequences for non-preemptible undefined weak symbols.
The lld patch introducing the relaxation: #194636
Corresponding ARM docs PR: https://github.com/ARM-software/abi-aa/pull/395
[clang-tidy] New portability-avoid-pragma-comment (#215239)
Finds uses of `#pragma comment` and, for `lib` or `linker` comments,
suggests using the build system for improved portability.
`#pragma comment` is not widely supported outside of MSVC. Clang
supports the use of `#pragma comment` to link libraries on both Windows
and Linux, but other kinds are only supported on Windows. Using `pragma
comment` to change link flags may be unexpected in projects that prefer
to set these flags in the build system.
Co-authored-by: Tom James <tom.james at siemens.com>
[PeepholeOpt] Erase optimized compare from LocalMIs earlier (#217848)
We need to drop the compare instruction that was optimized away from
LocalMIs before the LocalMIs-based load folding optimization a few lines
below. Addresses a regression from #194662.
Fixes https://github.com/llvm/llvm-project/issues/208746.
---------
Co-authored-by: woruyu <1214539920 at qq.com>
ARM: Use divmod type signatures from RuntimeLibcallsInfo
Start moving towards an API to emit calls from RuntimeLibcallsInfo's
knowledge about the type signature of a function instead of manually
computing an IR type from the EVT of the operation.
Also change the swap of arguments to be based on the libcall impl,
rather than the ABI since it's logically a property of the function
itself.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[Analysis] Use usub_sat during SCEV expansion in some cases (#216975)
When expanding code in visitAddExpr we can look for the pattern
-C + umax(X, C)
and transform this into
--> usub.sat(X, C)
which simplifies the IR in some tests.
Please see https://github.com/llvm/llvm-project/pull/118195 for the
original instcombine that this PR copies from. It contains the alive
link: https://alive2.llvm.org/ce/z/oSWe5S
[AArch64][GlobalISel] Select integer vector reductions into GPRs (#212976)
Prototyping a new minimal type-based approach to RegBankSelect (#199040)
for compile-time purposes exposed various gaps in instruction selection
when not using the existing RegBankSelect pass. These manifested as new
fallbacks when compiling CTMark and the IR dataset from [1].
Imported patterns require an FPR result. This patch teaches instruction
selection to handle vector reductions with GPR results by using a
temporary FPR and inserting a cross-bank copy.
Assisted-by: codex
[1] https://davemgreen.github.io/gisel.html
[clang][AST] Add ASTContext::hasLayout() (#216541)
Whenever we add a new call to e.g. `ASTContext::getASTRecordLayout()`,
we inevitably cause a problem because that function has quite a few
prerequisites:
```c++
D = D->getDefinition();
assert(D && "Cannot get layout of forward declarations!");
assert(!D->isInvalidDecl() && "Cannot get layout of invalid decl!");
assert(D->isCompleteDefinition() && "Cannot layout type before complete!");
```
Add a function to check whether a record decl can be pased to
`getASTRecordLayout()` and update a few callers.
[ELF] Emit synthetic local in symbol table for non-preemptible IFUNC (#210616)
Currently we create an internal alias of the original symbol and then
rewrite the latter to point to the IPLT entry, which means we lose
symbol table information for the actual resolver. In practice compilers
also emit a normal function symbol for the resolver due to how IFUNCs
are represented in GNU C so that at least shows up, but we shouldn't be
relying on it. By emitting a synthetic local we can keep having a symbol
for the resolver whilst still redirecting references to the IPLT entry.
[NFC][ELF] Remove Symbol's unused copy constructor (#210615)
Now that we are no longer copying symbols via the copy constructor we
can remove it. Given we track symbol pointers in various data structures
it can be dangerous to have multiple objects for the same symbol that
would risk being viewed inconsistently, or even moved and the original
lost, though no such cases exist upstream that I'm aware of.
Copying a symbol entirely is also a weird thing to do, and can be
inefficient, so when copies are being made it's best to be explicit
about the members to copy. This also makes it clearer to understand what
members are relevant, rather than implicitly copying all the members,
most of which aren't relevant in practice.
Whilst the copy/move constructors/assignment operators are currently
implicitly deleted due to the atomic flags member, explicitly delete
them all so they remain deleted in case that ever changes.
[NFC][ELF] Only create alias in handleNonPreemptibleIfunc if needed (#210613)
In the no direct relocations case, the original IFUNC symbol keeps its
value, and so there's no need to create a separate alias; it's only
needed when the original symbol is being redirected to the IPLT as a
normal function symbol.
This change also shifts the isInIplt assignment to be explicit and
mirror the allocateAux/pltIdx uses, rather than relying on makeDefined
copying it, and to be clear that this is in fact deliberately and
consistently being copied like them.
A future commit will also change the exact way in which we create this
alias, and will rely on it only existing for the direct relocations
case.
[NFC][ELF] Create fresh alias in handleNonPreemptibleIfunc (#210614)
We don't need to copy the full symbol here, we just want an internal
alias to use for the IPLT and IGOTPLT entries and IRELATIVE relocation's
addend.
[DAG] Expand vp.*rem and vp.cttz.elts with non-vp nodes.
Trivial VP SDNodes will be removed in an upcoming patch. The division is still predicated so we avoid UB.
[DAG] Remove trivial VP SDNodes. NFC
This removes the codegen parts of the trivial VP intrinsics. It's quite far reaching, but the general categories of code removed are:
- Removing definitions from VPIntrinsics.def
- Legalization and expansion code
- MatchContext used to match over both VP and non-VP nodes
- Some dead DAGCombines and folds in SelectionDAGBuilder
There are still more things to be cleaned up after this, e.g. removing more of the VPIntrinsic class hierarchy, removing ExpandVectorPredication/moving expansion into other places, removing MatchContext from SDPatternMatch