Changes

Summary

  1. [MLIR][Sparse] Move `buildLattices` into Merger (details)
  2. [RISCV] Add DAG combine to detect opportunities to replace (i64 (any_extend (i32 X)) with sign_extend. (details)
  3. [Docs] Minor fixes with language extension docs (details)
  4. [RISCV][NFC] Combine the control flow for different RetOp of interrupt function (details)
  5. [clang][tests] Specify unwindlib in aix-ld tests (details)
  6. [JITLink][ELF] Add generic ELFLinkGraphBuilder template. (details)
  7. [gn build] Port aff57ff24aca (details)
  8. [LV] Adjust trip count based on IsOrdered in widenPHIInstruction (NFC). (details)
  9. [ARM] Regenerate big-endian-vector-caller.ll test checks. NFC (details)
  10. [clang-format] PR50525 doesn't handle AlignConsecutiveAssignments correctly in some situations (details)
  11. [clang-format] [PR50702] Lamdba processing does not respect AfterClass and AfterNamespace (details)
  12. [clang-format] Add basic support for formatting JSON (details)
  13. [gn build] Port 8b7881a084d0 (details)
  14. [Verifier] Support masked load/store with opaque pointers (details)
  15. [ISel] Port AArch64 SABD and UABD to DAGCombine (details)
  16. [ARM] MVE vabd (details)
  17. [RISCV] Use zexti32/sexti32 in srliw/sraiw isel patterns to improve usage of those instructions. (details)
  18. [ARM] Introduce MVETRUNC ISel lowering (details)
  19. [clang] add C++ feature test macro for P2266 simpler implicit move (details)
  20. [ARM] Lower MVETRUNC to stack operations (details)
  21. [Driver] do not link _p libs for -pg on FreeBSD 14 and later (details)
  22. [X86] Correct the conversion of VALIGND/Q intrinsics to shufflevector. (details)
  23. [docs][llvm-strip] Fix documentation for -s/-S (details)
Commit 043ce4e6bdd376ff460d78446d1a6b94c6e0f18c by gusss
[MLIR][Sparse] Move `buildLattices` into Merger

This allows us to use `buildLattices` in the `Merger` unittests.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D104879
The file was modifiedmlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
The file was modifiedmlir/include/mlir/Dialect/SparseTensor/Utils/Merger.h
The file was modifiedmlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
Commit d4f4a1ba626d7c3e4442d6f68feb79d56eba9601 by craig.topper
[RISCV] Add DAG combine to detect opportunities to replace (i64 (any_extend (i32 X)) with sign_extend.

If type legalization is going to insert a sign_extend for other users
of X and we can fold the sign_extend into ADDW/MULW/SUBW, it is
better to replace the ANY_EXTEND so we don't end up with a separate
ADD/MUL/SUB instruction for the users of the ANY_EXTEND.

I'm only handling setcc uses right now, but there are other
instructions that force sign_extends like ashr.

There are probably other *W instructions we could use in addition
to ADDW/SUBW/MULW.

My motivating case was a loop terminating compare and a phi use
as seen in the new test file.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D104581
The file was modifiedllvm/test/CodeGen/RISCV/rv64zbb.ll
The file was addedllvm/test/CodeGen/RISCV/aext-to-sext.ll
The file was modifiedllvm/lib/Target/RISCV/RISCVISelLowering.cpp
Commit c8f3f46c6983b5a87a0a6fc9d9bb476883bee801 by saurabh.jhaa
[Docs] Minor fixes with language extension docs

There were some issues in the patch https://reviews.llvm.org/D104198. I also forgot to address one comment. This patch addresses these.

Reviewed By: xgupta

Differential Revision: https://reviews.llvm.org/D104971
The file was modifiedclang/docs/LanguageExtensions.rst
Commit 779d2b0a427316e9f425b0854ed4465791a4d98c by jim
[RISCV][NFC] Combine the control flow for different RetOp of interrupt function

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D104838
The file was modifiedllvm/lib/Target/RISCV/RISCVISelLowering.cpp
Commit 3255db4919f1b06736f391a0ae670f273c0ba09e by tbaeder
[clang][tests] Specify unwindlib in aix-ld tests

Clang can be configured with a different default unwindlib, for example
gcc. In that case, -lunwind will not be present in the output.

Fix this by explicitly specifying libunwind as the unwindlib.

Differential Revision: https://reviews.llvm.org/D104899
The file was modifiedclang/test/Driver/aix-ld.c
Commit aff57ff24aca5074b427d6bbc2f3246aa97910c5 by Lang Hames
[JITLink][ELF] Add generic ELFLinkGraphBuilder template.

ELFLinkGraphBuilder<ELFT> will hold generic parsing and LinkGraph-building code
that can be shared between JITLink ELF backends for different architectures.

For now it's just a stub. The plan is to incrementally move functionality down
from ELFLinkGraphBuilder_x86_64 into the new template.
The file was modifiedllvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
The file was addedllvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.h
The file was addedllvm/lib/ExecutionEngine/JITLink/ELFLinkGraphBuilder.cpp
The file was modifiedllvm/lib/ExecutionEngine/JITLink/CMakeLists.txt
Commit 2b9016745d091385f4b41615c171988b527b1939 by llvmgnsyncbot
[gn build] Port aff57ff24aca
The file was modifiedllvm/utils/gn/secondary/llvm/lib/ExecutionEngine/JITLink/BUILD.gn
Commit 7f369819774d376f043200220f1a2d36d53487a2 by flo
[LV] Adjust trip count based on IsOrdered in widenPHIInstruction (NFC).

Suggested in D104197, avoids the early exit.
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Commit 991a88b177311822fa89e6257911be95f3c07c45 by david.green
[ARM] Regenerate big-endian-vector-caller.ll test checks. NFC
The file was modifiedllvm/test/CodeGen/ARM/big-endian-vector-caller.ll
Commit ee3b2c47ce41aeabede85d96e43bee33be73aa2f by mydeveloperday
[clang-format] PR50525 doesn't handle AlignConsecutiveAssignments correctly in some situations

https://bugs.llvm.org/show_bug.cgi?id=50525

AlignConsecutiveAssignments/Declarations cause incorrect alignment in the presence of a DesignatedInitializerPeriod (https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html)

```
static NTSTATUS stg(PLW_STREAM Stream, int identity)
{
     NTSTATUS             status;
     BYTE                 payload[256] = {'l', 'h', 'o', 't', 's', 'e'};
     struct dm_rpc_header header       = {.drh_magic        = DRH_MAGIC,
                                    .drh_op_code      = RPC_OP_ECHO,
                                    .drh_payload_size = sizeof(payload),
                                    .drh_body_size    = sizeof(payload),
                                    .drh_request_id   = 1};
     header.drh_version                = identity;
```

This fix addresses that by ensuring the period isn't ignored

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D104900
The file was modifiedclang/unittests/Format/FormatTest.cpp
The file was modifiedclang/lib/Format/WhitespaceManager.cpp
Commit 37c2233097ac44697b87228d86eef1fce10ea5c1 by mydeveloperday
[clang-format] [PR50702] Lamdba processing does not respect AfterClass and AfterNamespace

https://bugs.llvm.org/show_bug.cgi?id=50702

I believe {D44609} may be too aggressive with brace wrapping rules which doesn't always apply to Lamdbas

The introduction of BeforeLambdaBody and AllowShortLambdasOnASingleLine has impact on brace handling on other block types, which I suspect we didn't see before as people may not be using the BeforeLambdaBody  style

From what I can tell this can be seen by the unit test I change as its not honouring the orginal LLVM brace wrapping style for the `Fct()` function

I added a unit test from PR50702 and have removed some of the code (which has zero impact on the unit test, which kind of suggests its unnecessary), some additional attempt has been made to try and ensure we'll only break on what is actually a LamdbaLBrace

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D104222
The file was modifiedclang/lib/Format/TokenAnnotator.cpp
The file was modifiedclang/unittests/Format/FormatTest.cpp
Commit 8b7881a084d0bc26499cf93e4ac45b59257a03b3 by mydeveloperday
[clang-format] Add basic support for formatting JSON

I find as I develop I'm moving between many different languages C++,C#,JavaScript all the time. As I move between the file types I like to keep `clang-format` as my formatting tool of choice. (hence why I initially added C# support  in {D58404}) I know those other languages have their own tools but I have to learn them all, and I have to work out how to configure them, and they may or may not have integration into my IDE or my source code integration.

I am increasingly finding that I'm editing additional JSON files as part of my daily work and my editor and git commit hooks are just not setup to go and run [[ https://stedolan.github.io/jq/ | jq ]], So I tend to go to  [[ https://jsonformatter.curiousconcept.com/ | JSON Formatter ]] and copy and paste back and forth. To get nicely formatted JSON. This is a painful process and I'd like a new one that causes me much less friction.

This has come up from time to time:

{D10543}
https://stackoverflow.com/questions/35856565/clang-format-a-json-file
https://bugs.llvm.org/show_bug.cgi?id=18699

I would like to stop having to do that and have formatting JSON as a first class clang-format support `Language` (even if it has minimal style settings at present).

This revision adds support for formatting JSON using the inbuilt JSON serialization library of LLVM, With limited control at present only over the indentation level

This adds an additional Language into the .clang-format file to separate the settings from your other supported languages.

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D93528
The file was modifiedclang/tools/clang-format/git-clang-format
The file was modifiedclang/tools/clang-format/clang-format-diff.py
The file was modifiedclang/lib/Format/ContinuationIndenter.cpp
The file was modifiedclang/lib/Format/TokenAnnotator.cpp
The file was modifiedclang/include/clang/Format/Format.h
The file was modifiedclang/docs/ClangFormatStyleOptions.rst
The file was modifiedclang/lib/Format/Format.cpp
The file was modifiedclang/tools/clang-format/ClangFormat.cpp
The file was addedclang/unittests/Format/FormatTestJson.cpp
The file was modifiedclang/unittests/Format/CMakeLists.txt
The file was modifiedclang/docs/ReleaseNotes.rst
The file was modifiedclang/docs/ClangFormat.rst
Commit b62de201902d7a0924f8d09e2909634a6d3d403d by llvmgnsyncbot
[gn build] Port 8b7881a084d0
The file was modifiedllvm/utils/gn/secondary/clang/unittests/Format/BUILD.gn
Commit 8c2d4621d94ede43fd2309249556b96bf7400fe7 by nikita.ppv
[Verifier] Support masked load/store with opaque pointers
The file was modifiedllvm/lib/IR/Verifier.cpp
The file was modifiedllvm/test/Verifier/opaque-ptr.ll
Commit 2887f1463930044a6093f111dc8eba5594144c33 by david.green
[ISel] Port AArch64 SABD and UABD to DAGCombine

This ports the AArch64 SABD and USBD over to DAG Combine, where they can be
used by more backends (notably MVE in a follow-up patch). The matching code
has changed very little, just to handle legal operations and types
differently. It selects from (ABS (SUB (EXTEND a), (EXTEND b))), producing
a ubds/abdu which is zexted to the original type.

Differential Revision: https://reviews.llvm.org/D91937
The file was modifiedllvm/lib/Target/AArch64/AArch64ISelLowering.h
The file was modifiedllvm/lib/CodeGen/TargetLoweringBase.cpp
The file was modifiedllvm/include/llvm/Target/TargetSelectionDAG.td
The file was modifiedllvm/lib/Target/AArch64/AArch64InstrInfo.td
The file was modifiedllvm/include/llvm/CodeGen/ISDOpcodes.h
The file was modifiedllvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
The file was modifiedllvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
The file was modifiedllvm/lib/Target/AArch64/AArch64ISelLowering.cpp
Commit 0f83d37a144ad4a9e530703d80e02e18b3b84c02 by david.green
[ARM] MVE vabd

This adds MVE lowering for VABDS/VABDU, using the code parted from
AArch64 in D91937.

Differential Revision: https://reviews.llvm.org/D91938
The file was modifiedllvm/lib/Target/ARM/ARMISelLowering.cpp
The file was modifiedllvm/lib/Target/ARM/ARMInstrMVE.td
The file was modifiedllvm/test/CodeGen/Thumb2/mve-vabdus.ll
Commit 81b2f95971edd47a0057ac4a77b674d7ea620c01 by craig.topper
[RISCV] Use zexti32/sexti32 in srliw/sraiw isel patterns to improve usage of those instructions.
The file was modifiedllvm/test/CodeGen/RISCV/rv64zbb.ll
The file was modifiedllvm/lib/Target/RISCV/RISCVInstrInfo.td
The file was modifiedllvm/test/CodeGen/RISCV/urem-lkk.ll
The file was modifiedllvm/test/CodeGen/RISCV/copysign-casts.ll
The file was modifiedllvm/test/CodeGen/RISCV/alu8.ll
The file was modifiedllvm/test/CodeGen/RISCV/rvv/fixed-vectors-ctlz.ll
The file was modifiedllvm/test/CodeGen/RISCV/urem-seteq-illegal-types.ll
The file was modifiedllvm/test/CodeGen/RISCV/bswap-ctlz-cttz-ctpop.ll
The file was modifiedllvm/test/CodeGen/RISCV/urem-vector-lkk.ll
The file was modifiedllvm/test/CodeGen/RISCV/rv64zbp.ll
The file was modifiedllvm/test/CodeGen/RISCV/rv64zbb-zbp.ll
The file was modifiedllvm/test/CodeGen/RISCV/vec3-setcc-crash.ll
The file was modifiedllvm/test/CodeGen/RISCV/div.ll
The file was modifiedllvm/test/CodeGen/RISCV/rv64i-exhaustive-w-insts.ll
Commit 59558129276098d62046c8cda92240d292cbfb1c by david.green
[ARM] Introduce MVETRUNC ISel lowering

Currently, when encountering store(trunc(..)) where the trunc is double
a legal vector lenth in MVE, we spilt the node into two different stores
each performing half of the trunc from the wider type. This works well
for efficiently lowering wider than legal types, else the trunc becomes
a series of individual lane moves. Unfortunately this splitting is
currently one of the first combines attempted, so can happen before any
other combines which might be more preferable.

This patch instead introduces the concept of a MVETRUNC ISel node that
the trunk is initially lowered to, to keep it intact as a single item as
opposed to splitting it up. This allows us to push the store(trunc(..))
combine later, allowing other optimisations to potentially happen on the
trunc first. The store(trunc(..)) splitting can then be done later in
the legalisation period if needed, or else fall back to a buildvector as
before.

This can also be used in the future to lower to loads/stores, as opposed
to the more expensive lane extracts/inserts. Some extra combines are
added to keep all the existing tests happy.

Differential Revision: https://reviews.llvm.org/D91921
The file was modifiedllvm/test/CodeGen/Thumb2/mve-vabdus.ll
The file was modifiedllvm/test/CodeGen/Thumb2/mve-satmul-loops.ll
The file was modifiedllvm/lib/Target/ARM/ARMISelLowering.h
The file was modifiedllvm/lib/Target/ARM/ARMISelLowering.cpp
Commit d6144c30fb6ae7ac15c82d512f8da7572577c2d2 by mizvekov
[clang] add C++ feature test macro for P2266 simpler implicit move

The feature was implemented in D99005, but we forgot to add the test
macro.

Reviewed By: Quuxplusone

Differential Revision: https://reviews.llvm.org/D104984
The file was modifiedclang/test/Lexer/cxx-features.cpp
The file was modifiedclang/lib/Frontend/InitPreprocessor.cpp
Commit 41d8149ee972b8498288b5051a6966cc9e89d57c by david.green
[ARM] Lower MVETRUNC to stack operations

The MVETRUNC node truncates two wide vectors to a single vector with
narrower elements. This is usually lowered to a series of extract/insert
elements, going via GPR registers. This patch changes that to instead
use a pair of truncating stores and a stack reload. This cuts down the
number of instructions at the expense of some stack space.

Differential Revision: https://reviews.llvm.org/D104515
The file was modifiedllvm/test/CodeGen/Thumb2/mve-laneinterleaving.ll
The file was modifiedllvm/test/CodeGen/Thumb2/mve-sext.ll
The file was modifiedllvm/test/CodeGen/Thumb2/mve-scatter-ind16-unscaled.ll
The file was modifiedllvm/lib/Target/ARM/ARMISelLowering.cpp
The file was modifiedllvm/test/CodeGen/Thumb2/mve-scatter-ind8-unscaled.ll
Commit 699d47472c3f7c5799fe75486689545179cfba03 by emaste
[Driver] do not link _p libs for -pg on FreeBSD 14 and later

In FreeBSD 14 the project will deprecate the _p special profiling
libraries.

Support for -pg (i.e., mcount) still exists but libraries compiled
with -pg will not be built by default, so stop linking against them.

Reviewed by: Dimitry Andric
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.llvm.org/D104753
The file was modifiedclang/test/Driver/freebsd.cpp
The file was modifiedclang/lib/Driver/ToolChains/FreeBSD.cpp
Commit 7a112356e4a19c0e63f533548fa95a03a5537fb9 by craig.topper
[X86] Correct the conversion of VALIGND/Q intrinsics to shufflevector.

We need to mask the immediate to the width of a single vector
rather than 2 vectors. If we use the width of 2 vectors then
any shift larger than the length of 1 vector is going to overflow
the shuffle indices.

Fixes PR50895.
The file was modifiedclang/test/CodeGen/X86/avx512vl-builtins.c
The file was modifiedclang/lib/CodeGen/CGBuiltin.cpp
Commit d8678246fcd9fe3a33646afab4251706e2506c51 by alexshap
[docs][llvm-strip] Fix documentation for -s/-S

Fix the command line guide for -g/-s/-S.
In particular, previously it was incorrectly stating that -S is an alias for --strip-all.

Differential revision: https://reviews.llvm.org/D104888
The file was modifiedllvm/docs/CommandGuide/llvm-strip.rst