LLVM/project eb8c189llvm/lib/CodeGen/SelectionDAG TargetLowering.cpp, llvm/lib/Target/AArch64 AArch64ISelLowering.cpp

[AArch64] Fold four and eight way partial reductions with [SU]ADDLP (#214636)

#214691 lowers two-way partial reductions to [SU]ADALP, which adds each
pair of lanes together and widens the result. This adds the four-way and
eight-way folds, which are two and three of those steps.

Each is lowered by folding one step and re-entering, with [us]mull
widening the products first when there is a multiply.

Registrations added:
```
  (v4i32, v16i8)   four way    without dotprod
  (v2i64, v16i8)   eight way   without dotprod
  (v2i32, v16i8)   eight way   without dotprod
  (v2i64, v8i16)   four way    always, no neon dot product takes i16
```

Example:
```llvm

    [36 lines not shown]
DeltaFile
+297-144llvm/test/CodeGen/AArch64/neon-partial-reduce-dot-product.ll
+32-50llvm/test/CodeGen/AArch64/sve-fixed-length-partial-reduce.ll
+44-0llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+14-0llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+387-1944 files

LLVM/project a54901eclang/lib/Sema SemaConcept.cpp

[Clang][NFC] Clean up ConstraintSatisfactionChecker (#220161)

We had duplicated cache lookup/insertion logic and we could combine them
together.
DeltaFile
+84-82clang/lib/Sema/SemaConcept.cpp
+84-821 files

LLVM/project d40c2e1llvm/test/CodeGen/AMDGPU scalar-float-sop1.ll, llvm/test/CodeGen/AMDGPU/GlobalISel llvm.amdgcn.raw.buffer.store.format.f16.ll fma.bf16.ll

AMDGPU/GlobalISel: Bitcasting G_TRUNC combine

Creating the G_TRUNC that changes type as well. This is really
the LLT::scalar trunc style that we inherited from switching to
extended LLTs, very common on non-true16 targets.
Affects inst-select pattern matching that were blocked by bitcast.
DeltaFile
+99-115llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.tbuffer.store.f16.ll
+65-139llvm/test/CodeGen/AMDGPU/GlobalISel/fptrunc.bf16.ll
+6-22llvm/test/CodeGen/AMDGPU/scalar-float-sop1.ll
+10-12llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.struct.buffer.store.format.f16.ll
+6-10llvm/test/CodeGen/AMDGPU/GlobalISel/fma.bf16.ll
+5-9llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.raw.buffer.store.format.f16.ll
+191-3078 files not shown
+216-34314 files

LLVM/project 685abd0llvm/test/CodeGen/AMDGPU load-atomic-flat.ll dagcombine-fmul-sel.ll, llvm/test/CodeGen/AMDGPU/GlobalISel fshr.ll fptrunc.bf16.ll

AMDGPU/GlobalISel: Fold (trunc (lshr x, 16)) to unmerge high half

Huge performance impact in some shaders with high register pressure.
What this really does is selects _hi16 register classes, and true16
machinery takes over later. Trunc + shift ends up in _lo16!
This requires allocating an extra register when the _lo16 half of the
original real 32-bit VGPR is still live.
DeltaFile
+566-304llvm/test/CodeGen/AMDGPU/load-atomic-global.ll
+558-300llvm/test/CodeGen/AMDGPU/load-atomic-local.ll
+387-222llvm/test/CodeGen/AMDGPU/dagcombine-fmul-sel.ll
+275-158llvm/test/CodeGen/AMDGPU/GlobalISel/fptrunc.bf16.ll
+231-126llvm/test/CodeGen/AMDGPU/load-atomic-flat.ll
+182-133llvm/test/CodeGen/AMDGPU/GlobalISel/fshr.ll
+2,199-1,24324 files not shown
+3,228-2,28630 files

LLVM/project 88d2598llvm/test/CodeGen/SPIRV/debug-info debug-typedef-namespace-scope.ll

It isn't an NFC in the end, it fixes an issue for typedef
DeltaFile
+1-1llvm/test/CodeGen/SPIRV/debug-info/debug-typedef-namespace-scope.ll
+1-11 files

LLVM/project 7a199bdllvm/test/CodeGen/AMDGPU wmma-trans-multi-shadow-hazard.mir perm-uniform-bytes.ll

AMDGPU: Fix using legacy triples in more tests (#220220)

Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
DeltaFile
+2-2llvm/test/CodeGen/AMDGPU/perm-uniform-bytes.ll
+2-2llvm/test/CodeGen/AMDGPU/coexec-hazardrec-preRA.mir
+1-1llvm/test/CodeGen/AMDGPU/wmma-trans-multi-shadow-hazard.mir
+5-53 files

LLVM/project bd736b0clang/lib/CodeGen CGCall.cpp

Silence an MSVC diagnostic; NFC (#220219)

This was emitting a "not all control paths return" diagnostic in MSVC
DeltaFile
+1-0clang/lib/CodeGen/CGCall.cpp
+1-01 files

LLVM/project ff4f356llvm/lib/Analysis LoopAccessAnalysis.cpp, llvm/test/Analysis/LoopAccessAnalysis non-affine-monotonic-bounds.ll

[LAA] Bound non-affine monotonic pointer expressions for runtime checks. (#210626)

We currently refuse to generate runtime checks for non-affine AddRecs (
e.g. std::bitset-style addresses involving unsigned divides, like
words[i/N])

This patch adds getNonAffineMonotonicBounds, whic h , which forms a
tight bound for such accesses, if the offset is provably monotonic and
non-decreasing over the loop.

It uses the offset value at the first iteration
(SplitIntoInitAndPostInc) and at the last iteration (getSCEVAtScope).

Initially this just supports divides of affine AddRecs, to be extended
in the follow-ups.

First step towards fixing
https://github.com/llvm/llvm-project/issues/207882.

PR: https://github.com/llvm/llvm-project/pull/210626
DeltaFile
+242-4llvm/test/Analysis/LoopAccessAnalysis/non-affine-monotonic-bounds.ll
+115-9llvm/test/Transforms/LoopVectorize/non-affine-monotonic-bounds.ll
+77-4llvm/lib/Analysis/LoopAccessAnalysis.cpp
+434-173 files

LLVM/project 4f711dbllvm/lib/Transforms/Scalar LoopInterchange.cpp, llvm/test/Transforms/LoopInterchange reduction-seed-relocation.ll

[LoopInterchange] Swap preheader contents before rebuilding LCSSA (#218468)

adjustLoopLinks() swapped the inner/outer preheader bodies only after
adjustLoopBranches() had already moved the reduction PHIs and rebuilt
LCSSA via formLCSSAForInstructions(). A reduction init defined in the
inner preheader was therefore still stranded below its use on the seed
edge when LCSSA was rebuilt, so formLCSSAForInstructions() was handed
dominance-broken IR.

Move the swapBBContents() call into adjustLoopBranches(), after the
replacePhiUsesWith() relabeling and before the LCSSA rebuild, so the
reduction init is relocated into the new outer preheader and dominates
the seed edge. With the swap moved, adjustLoopLinks() only forwarded to
adjustLoopBranches(), so it is inlined into its sole caller and removed.

Fixes #215511

AI tools have been used to generate portions of this patch
DeltaFile
+129-0llvm/test/Transforms/LoopInterchange/reduction-seed-relocation.ll
+15-15llvm/lib/Transforms/Scalar/LoopInterchange.cpp
+144-152 files

LLVM/project 14cdf0cmlir/lib/Tools/mlir-pdll-lsp-server CMakeLists.txt

[mlir] Fix mlir-pdll-lsp-server link. (#220123)

This is the same fix TableGenLspServerLib got in 9e469ced42cd. This
addresses the mlir-pdll-lsp-server instance of #152371.

MLIRPdllLspServerLib transitively needs LLVMTableGen, which is not part
of libLLVM.so, so MLIRPDLLParser already brings in static LLVMSupport.
Linking the dylib here as well gives mlir-pdll-lsp-server two copies of
LLVMSupport. Linking still succeeds, but with assertions
view-output.test fails. The test trips over the two copies having
different Hashing.h seeds, which is a separate defect to be addressed in
another PR.

It has not shown up in CI because it needs the dylib and assertions at
the same time, which rarely coincide. It also only became reachable once
a3a25996b114 moved the LSP transport into libLLVM.so.

Assisted-By: Claude Opus 5
DeltaFile
+3-0mlir/lib/Tools/mlir-pdll-lsp-server/CMakeLists.txt
+3-01 files

LLVM/project 105b437llvm/test/CodeGen/AMDGPU wmma-trans-multi-shadow-hazard.mir perm-uniform-bytes.ll

AMDGPU: Fix using legacy triples in more tests

Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
DeltaFile
+2-2llvm/test/CodeGen/AMDGPU/perm-uniform-bytes.ll
+2-2llvm/test/CodeGen/AMDGPU/coexec-hazardrec-preRA.mir
+1-1llvm/test/CodeGen/AMDGPU/wmma-trans-multi-shadow-hazard.mir
+5-53 files

LLVM/project 73a46d2llvm/lib/Target/SPIRV SPIRVNonSemanticDebugHandler.cpp

[Review] remove asserts
DeltaFile
+3-4llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.cpp
+3-41 files

LLVM/project f256291llvm/lib/Target/SPIRV SPIRVNonSemanticDebugHandler.h SPIRVNonSemanticDebugHandler.cpp

[NFC][SPIRV] Converge different resolveDebugParentScope versions into a single one
DeltaFile
+23-87llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.cpp
+13-34llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.h
+36-1212 files

LLVM/project 8c6e077llvm/lib/CodeGen RegisterCoalescer.cpp, llvm/test/CodeGen/AArch64 regcoalesce-preserve-valid-lanes-implicit-def.mir

[CodeGen][RegCoalescer] Preserve valid lanes when keeping IMPLICIT_DEF (#215272)

A subregister definition without the undef flag is a read-modify-write,
including when it is defined by IMPLICIT_DEF. When the IMPLICIT_DEF cannot be
erased, retain the lanes carrying values from the preceding definition.
Otherwise the coalescer can miss the interference between %src and %dst and
turn the first two copies below into a destructive in-place permutation.
DeltaFile
+36-0llvm/test/CodeGen/AArch64/regcoalesce-preserve-valid-lanes-implicit-def.mir
+2-1llvm/lib/CodeGen/RegisterCoalescer.cpp
+38-12 files

LLVM/project d326c16clang/lib/CodeGen/TargetBuiltins RISCV.cpp, cross-project-tests/intrinsic-header-tests riscv_packed_simd.c

[RISCV] Support Packed Multiplication with Horizontal Addition (#218430)

See also
https://github.com/riscv/riscv-p-spec/blob/master/P-ext-intrinsics.adoc#packed-multiplication-with-horizontal-addition.
DeltaFile
+375-0llvm/test/CodeGen/RISCV/rvp-simd-64.ll
+285-0cross-project-tests/intrinsic-header-tests/riscv_packed_simd.c
+168-0llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+117-0llvm/test/CodeGen/RISCV/rvp-simd-32.ll
+110-0clang/lib/CodeGen/TargetBuiltins/RISCV.cpp
+106-0llvm/lib/Target/RISCV/RISCVInstrInfoP.td
+1,161-03 files not shown
+1,262-09 files

LLVM/project 982507fmlir/include/mlir/Dialect/Tosa/IR TosaComplianceData.h.inc, mlir/test/Dialect/Tosa tosa-validation-version-1p1-valid.mlir tosa-validation-version-1p0-invalid.mlir

[mlir][tosa] Add support for MXFP TILE op (#217908)

Adds support for MXFP types in TILE according to
https://github.com/arm/tosa-specification/pull/74.
DeltaFile
+25-1mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc
+9-0mlir/test/Dialect/Tosa/tosa-validation-version-1p1-valid.mlir
+9-0mlir/test/Dialect/Tosa/tosa-validation-version-1p0-invalid.mlir
+9-0mlir/test/Dialect/Tosa/ops.mlir
+52-14 files

LLVM/project d91b98cllvm/test/CodeGen/AMDGPU fma-mad-f16-hi16.ll

[AMDGPU] Add tests for scalar hi-half f16 fma and mad on GFX9 (#219432)

v_fma_f16 and v_mad_legacy_f16 both support op_sel on GFX9, so a 16-bit
ternary
whose sources come from the high halves of packed registers could be a
single
instruction. SelectVOP3OpSel() does not set op_sel yet, so the high
halves are
extracted and re-inserted with explicit shifts instead. Add tests for
both SDAG
and GlobalISel so that the improvement is visible if this is ever fixed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply at anthropic.com>

Co-authored-by: Claude Opus 5 (1M context) <noreply at anthropic.com>
DeltaFile
+176-0llvm/test/CodeGen/AMDGPU/fma-mad-f16-hi16.ll
+176-01 files

LLVM/project e4c5f0fllvm/lib/Target/SPIRV SPIRVNonSemanticDebugHandler.cpp, llvm/test/CodeGen/SPIRV/debug-info debug-scope-same-line.ll debug-scope-block.ll

Add support for NSDI DebugScope, DebugNoScope and DebugInlinedAt
DeltaFile
+127-18llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.cpp
+83-0llvm/test/CodeGen/SPIRV/debug-info/debug-inlined-at-recursive.ll
+68-0llvm/test/CodeGen/SPIRV/debug-info/debug-inlined-at.ll
+67-0llvm/test/CodeGen/SPIRV/debug-info/debug-scope.ll
+66-0llvm/test/CodeGen/SPIRV/debug-info/debug-scope-block.ll
+63-0llvm/test/CodeGen/SPIRV/debug-info/debug-scope-same-line.ll
+474-1815 files not shown
+658-2121 files

LLVM/project ea7bcf3llvm/test/Transforms/LoopVectorize smax-idx.ll

[LV] Give each RUN line in smax-idx.ll its own check prefix (NFC). (#220210)

The three RUN lines share the CHECK prefix, which only works while all
three VF/IC configurations produce identical output. This fixes the
dropped checks for smax_idx_max_no_exit_user.

While touching the file, also modernize the naming a bit, to be more
uniform with existing tests.
DeltaFile
+452-217llvm/test/Transforms/LoopVectorize/smax-idx.ll
+452-2171 files

LLVM/project 1cb39aallvm/lib/Transforms/Utils LoopUtils.cpp

Fixups
DeltaFile
+1-1llvm/lib/Transforms/Utils/LoopUtils.cpp
+1-11 files

LLVM/project 1c82e00llvm/lib/Transforms/Utils LoopUtils.cpp, llvm/test/Transforms/LoopVectorize compress-idioms.ll compress-store-vec-epilogue.ll

Fixups
DeltaFile
+37-40llvm/test/Transforms/LoopVectorize/compress-store-vec-epilogue.ll
+3-3llvm/lib/Transforms/Utils/LoopUtils.cpp
+0-2llvm/test/Transforms/LoopVectorize/compress-idioms.ll
+40-453 files

LLVM/project ddfaad0llvm/include/llvm/Transforms/Utils LoopUtils.h, llvm/lib/Transforms/Utils LoopUtils.cpp

Fixups
DeltaFile
+128-181llvm/test/Transforms/LoopVectorize/compress-idioms.ll
+40-9llvm/test/Transforms/LoopVectorize/compress-idioms-negative-tests.ll
+16-20llvm/test/Transforms/LoopVectorize/AArch64/compress-idioms.ll
+12-16llvm/test/Transforms/LoopVectorize/VPlan/compress-idioms.ll
+9-1llvm/lib/Transforms/Utils/LoopUtils.cpp
+4-3llvm/include/llvm/Transforms/Utils/LoopUtils.h
+209-2301 files not shown
+212-2337 files

LLVM/project 0aa68cdllvm/lib/Transforms/Vectorize LoopVectorizationLegality.cpp, llvm/test/Transforms/LoopVectorize compress-idioms-negative-tests.ll

Add out-of-loop use check
DeltaFile
+32-0llvm/test/Transforms/LoopVectorize/compress-idioms-negative-tests.ll
+10-2llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+42-22 files

LLVM/project 200afebllvm/lib/Transforms/Utils LoopUtils.cpp, llvm/lib/Transforms/Vectorize LoopVectorize.cpp VPlanTransforms.cpp

Tests, fixes, and design rework
DeltaFile
+603-175llvm/test/Transforms/LoopVectorize/compress-idioms.ll
+174-0llvm/test/Transforms/LoopVectorize/compress-idioms-negative-tests.ll
+87-49llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+58-74llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+98-0llvm/test/Transforms/LoopVectorize/compress-store-vec-epilogue.ll
+66-0llvm/lib/Transforms/Utils/LoopUtils.cpp
+1,086-29812 files not shown
+1,212-38518 files

LLVM/project 1e9cbfdllvm/lib/Transforms/Vectorize VPRecipeBuilder.h

Add comment
DeltaFile
+3-0llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h
+3-01 files

LLVM/project b906a06llvm/lib/Transforms/Vectorize VPlanTransforms.cpp VPlan.h, llvm/test/Transforms/LoopVectorize compress-idioms.ll

[LoopVectorize] Support vectorization of compressing patterns in VPlan

RFC link: https://discourse.llvm.org/t/rfc-loop-vectorization-of-compress-store-expand-load-patterns/86442

This adds loop vectorizer support for "compressing" patterns,
for example:

```
int dst_idx = 0;
for (int i = 0; i < n; i++) {
  if (cond[i])
    dst[dst_idx++] = src[i];
}
```

Can be vectorized with a `llvm.masked.compressstore` as:

```
int dst_idx = 0;

    [52 lines not shown]
DeltaFile
+424-0llvm/test/Transforms/LoopVectorize/compress-idioms.ll
+157-0llvm/test/Transforms/LoopVectorize/VPlan/compress-idioms.ll
+132-0llvm/test/Transforms/LoopVectorize/AArch64/compress-idioms.ll
+112-15llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+60-4llvm/lib/Transforms/Vectorize/VPlan.h
+49-0llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+934-1915 files not shown
+1,117-2721 files

LLVM/project ad9aba5llvm/include/llvm/Analysis IVDescriptors.h, llvm/lib/Analysis IVDescriptors.cpp

Fixups
DeltaFile
+59-8llvm/unittests/Analysis/IVDescriptorsTest.cpp
+9-10llvm/lib/Analysis/IVDescriptors.cpp
+1-1llvm/include/llvm/Analysis/IVDescriptors.h
+69-193 files

LLVM/project 3cc8588llvm/include/llvm/Analysis IVDescriptors.h, llvm/lib/Analysis IVDescriptors.cpp

Fixups
DeltaFile
+4-5llvm/lib/Analysis/IVDescriptors.cpp
+3-3llvm/include/llvm/Analysis/IVDescriptors.h
+1-1llvm/unittests/Analysis/IVDescriptorsTest.cpp
+8-93 files

LLVM/project ed18284llvm/include/llvm/Analysis IVDescriptors.h, llvm/lib/Analysis IVDescriptors.cpp

Fixups
DeltaFile
+35-28llvm/lib/Analysis/IVDescriptors.cpp
+23-17llvm/unittests/Analysis/IVDescriptorsTest.cpp
+22-9llvm/include/llvm/Analysis/IVDescriptors.h
+80-543 files

LLVM/project b7a8c69llvm/include/llvm/Analysis IVDescriptors.h, llvm/lib/Analysis IVDescriptors.cpp

Rework and simplify
DeltaFile
+47-82llvm/lib/Analysis/IVDescriptors.cpp
+30-20llvm/include/llvm/Analysis/IVDescriptors.h
+3-28llvm/unittests/Analysis/IVDescriptorsTest.cpp
+80-1303 files