[clang-tidy] Correct `std::has_one_bit` to `std::has_single_bit` in `modernize-use-std-bit` (#196721)
There isn't `std::has_one_bit` in standard library, the function checks
if a number is an integral power of 2 is `std::has_single_bit`.
https://en.cppreference.com/cpp/header/bit
[VectorCombine] foldShuffleChainsToReduce - add support for partial vector reductions (#195119)
Extend foldShuffleChainsToReduce to recognize partial reduction patterns where only a subvector of the full vector is being reduced.
For example, a <16 x i16> vector where the shuffle chain only reduces the lower 8 elements can now be folded into:
shufflevector (extract lower <8 x i16>) + vector.reduce.smax
The detection works by noticing when the bottom-up walk through the
shuffle/op chain ends before consuming the full vector. The number of
levels visited determines the subvector size (2^levels), and an
extract_subvector + scalar reduction replaces the original chain when
profitable.
Fixes #194617
[BPF] Support Stack Arguments (#189060)
Currently, bpf program and kfunc only support 5 register parameters. As
bpf community and use cases keep expanding, there are some need to
extend 5 register parameters by allocating additional parameters on
stack. There are two main use cases here:
1. Currently kfunc is limited to 5 register parameters. In some special
situation, people may want to have more than 5 parameters. One of
example is for sched_ext.
2. Allowing more stack parameters can make bpf prog writer easier since
they do not need to carefully limit the number of parameters for their
programs.
The following is the high-level design:
- Use bpf register R11 as the frame pointer to stack parameters. This is
to avoid mixing stacks due to R10.
- Stack parameters must be after 5 register parameters.
- All parameters should be at most 16 bytes as ByVal parameters are not
supported.
[43 lines not shown]
[RISCV][NFC] Rename `Zvvmm` instruction file to `Zvvm` (#196692)
Renames `RISCVInstrInfoZvvmm.td` to `RISCVInstrInfoZvvm.td` so `Zvvmm`
and `Zvvfmm` share the same IME instruction file according to the spec.
And all future instructions from the `Zvvm family` will be placed here
too.
This PR is required for reviewing #196486 in order to make GitHub show
the diff correcrly.
[CI] Ignore TidyFastChecks.inc for formatter CI. NFC. (#196682)
`TidyFastChecks.inc` is generated and its contents should not be checked
by clang-format CI workflow. Add a local `.clang-format-ignore` entry so
the PR formatting check does not report diffs for this file.
Related run:
https://github.com/llvm/llvm-project/pull/194516#issuecomment-4332061836
[clang-tidy] Avoid `use-nodiscard` false positives for class templates (#196661)
Do not suggest adding `[[nodiscard]]` to functions returning a class
template specialization whose primary template is already marked
`[[nodiscard]]`.
Class template specializations do not carry the `[[nodiscard]]`
attribute on their own declarations, so `modernize-use-nodiscard`
previously missed this case and emitted redundant diagnostics for return
types such as:
```cpp
template <class T>
struct [[nodiscard]] Result;
Result<int> f() const;
```
Fixes #163425.
[ObjectYAML][NFC] Extract BBAddrMap YAML types into shared namespace (#196019)
Move BBAddrMapEntry and PGOAnalysisMapEntry out of namespace ELFYAML
into a new format-agnostic namespace BBAddrMapYAML so that COFF
YAML support can reuse the same schema and MappingTraits.
[AArch64][NFC] Remove unused TRI member from class (#184363)
I’ve removed the TRI member and its initialization, leaving only MRI and
TII as the stored pointers.
---------
Co-authored-by: Benjamin Maxwell <benjamin.maxwell at arm.com>
[AArch64][GlobalISel] Enable BF16 legalization for fadd and friends. (#196081)
This enabled bf16 promotion for the following operations in GISel,
promoting them to f32 and truncating the result back:
G_FADD, G_FSUB, G_FMUL, G_FDIV, G_FMA, G_FSQRT, G_FMAXNUM, G_FMINNUM,
G_FMAXIMUM, G_FMINIMUM, G_FCEIL, G_FFLOOR, G_FRINT, G_FNEARBYINT,
G_INTRINSIC_TRUNC, G_INTRINSIC_ROUND, G_INTRINSIC_ROUNDEVEN
[clang][AMDGPU] Reject malformed target IDs with empty components (#196140)
Fixes #196078
An extra colon in `-mcpu` (e.g. `gfx900::xnack+`) produced an empty
feature component and triggered an assertion in `StringRef::back()`.
Return `std::nullopt` for malformed target IDs instead.
[RISCV][GISel] Add test coverage for the srliw+shXadd patterns. NFC (#196676)
GISel isn't canonicalizing the shift pair to an AND the same way
SelectionDAG does so the patterns weren't firing. Add more directed
tests that use an And explicitly.
[DAGTypeLegalizer] Add missing BR_CC handler for soft-promoted half operands (#196214)
`SoftPromoteHalfOperand` had no case for `ISD::BR_CC`, causing a crash
when a half-typed `fcmp` result fed directly into a conditional branch.
All other comparison-related nodes (`SETCC, SELECT_CC`) were already
handled. Add `SoftPromoteHalfOp_BR_CC` following the same pattern as
`SoftPromoteHalfOp_SELECT_CC`.
Fixes #195562
---------
Co-authored-by: Tony Varghese <tony.varghese at ibm.com>
[Utils] Fix duplicate DomTree updates in SplitIndirectBrCriticalEdges (#196475)
SplitIndirectBrCriticalEdges generates DomTree Insert/Delete pairs for
each predecessor in OtherPreds. However, OtherPreds can contain
duplicate entries when a conditional branch has both targets pointing to
the same block (e.g., `br i1 %c, label %X, label %X`). This produces
duplicate DomTree updates for the same edge, triggering the assertion
`std::abs(NumInsertions) <= 1 && "Unbalanced operations!"` in
LegalizeUpdates.
Fix by tracking which source blocks have already had DomTree updates
emitted, and skipping duplicates.
[Clang] Do not eat SFINAE diagnostics for explicit template arguments (#139066)
Instead of merely suggesting the template arguments are invalid, we now
provide an explanation of why the explicit template argument is invalid.
[clang] Don't warn on __COUNTER__ in system macros
The introduction of extension and compatibility warnings means
that __COUNTER__ has started causing warnings (and -Werror= build
failures) due to use of system APIs.
This PR simply ensures that these diagnostics don't get reported
for system macro expansions as well.