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

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

[IVDescriptors] Implement MonotonicDescriptor

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

"Monotonic" variable is similar to induction variable, but its value is updated under some condition, e.g.:
```
int idx = 0;
for(int i = 0; i < n; ++i) {
  // some uses of idx
  if (cond)
    ++idx;
}
```
In this example, `i` is induction variable and `idx` is monotonic variable: it's updated only when cond == true. In LLVM IR, this looks like:
```
loop_header:
  %monotonic_phi = [%start, %prehader], [ %chain_phi0, %latch]

step_bb:

    [26 lines not shown]
DeltaFile
+153-0llvm/unittests/Analysis/IVDescriptorsTest.cpp
+121-0llvm/lib/Analysis/IVDescriptors.cpp
+39-0llvm/include/llvm/Analysis/IVDescriptors.h
+313-03 files

LLVM/project 1de09daclang/lib/CIR/Dialect/Transforms CallConvLoweringPass.cpp, clang/lib/CIR/Dialect/Transforms/TargetLowering CIRABIRewriteContext.cpp

[CIR][ABI] Thread indirect-argument address space through call-conv lowering
DeltaFile
+86-0clang/test/CIR/Transforms/abi-lowering/indirect-addrspace-arg-attr-lowering.cir
+54-11clang/lib/CIR/Dialect/Transforms/TargetLowering/CIRABIRewriteContext.cpp
+8-6mlir/include/mlir/ABI/Targets/Test/TestTarget.h
+10-3clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
+8-4mlir/lib/ABI/Targets/Test/TestTarget.cpp
+8-2mlir/include/mlir/ABI/ABIRewriteContext.h
+174-266 files

LLVM/project bcf0cd1lldb/include/lldb/Utility Locked.h, lldb/unittests/Utility LockedTest.cpp

[lldb] Add Guarded<T, Mutex> to Locked.h (#219421)

LLDB's code base has many variables that have an associated mutex that
needs to be locked to safely access that variable from multiple threads.
However, this locking scheme is currently not enforced by the compiler
and code sometimes accesses these variables without aquiring the
respective mutex first.

This patch introduces a `Guarded` class that strictly enforces that some
memory is only accessed after the respective mutex has been aquired.
This class hands out `Locked` objects for every access which guarentee
that the mutex is held as long as the variable is in scope.
DeltaFile
+37-0lldb/unittests/Utility/LockedTest.cpp
+28-0lldb/include/lldb/Utility/Locked.h
+65-02 files

LLVM/project b7e9265llvm/lib/IR Verifier.cpp, llvm/test/Verifier DILocalScope-non-local-parent.ll

[Verifier] Diagnose local scope chains that miss their DISubprogram

visitFunction() resolved a DILocation's subprogram via
DILocalScope::getSubprogram(), which recurses through
DILexicalBlockBase::getScope() and casts each parent to DILocalScope.
A DILexicalBlock parented to a non-local scope, such as a DIFile,
therefore aborted the verifier before visitDILexicalBlockBase could
report "invalid local scope".
DeltaFile
+28-0llvm/test/Verifier/DILocalScope-non-local-parent.ll
+3-1llvm/lib/IR/Verifier.cpp
+31-12 files

LLVM/project 0df2580clang/lib/AST StmtProfile.cpp, clang/test/Modules pr220187.cppm

[C++20] [Modules] Profiling the lambda call operator only (#220203)

Close https://github.com/llvm/llvm-project/issues/220187

The root cause of the problem is that during the deserialization process
some of the implicit functions are out of sync. They will be the same in
the end. But at the point of profiling, they are different.

This patch fixes this by profiling the explicit lambda call only, which
should be correct too. This was the intention of
CXXRecordDecl::getLambdaCallOperator(), but we didn't use it due to
deserialization ordering issues.
DeltaFile
+40-0clang/test/Modules/pr220187.cppm
+5-1clang/lib/AST/StmtProfile.cpp
+45-12 files

LLVM/project 7d31659llvm/lib/Analysis IVDescriptors.cpp, llvm/lib/Transforms/Vectorize VPlanConstruction.cpp

[LV] Vectorize fmin/fmax reductions (#198300)

Teach LoopVectorize to recognize fmin/fmax reductions. This patch only
supports reductions of this kind which have the FP `minimum/maximum` and
`minimumnum/maximumnum` semantics.
DeltaFile
+953-178llvm/test/Transforms/LoopVectorize/select-last-index-fp.ll
+30-3llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
+1-1llvm/lib/Analysis/IVDescriptors.cpp
+984-1823 files

LLVM/project cd08ff0llvm/test/CodeGen/AArch64/GlobalISel knownbits-add.mir knownbits-fshl-fshr.mir

[AArch64][GlobalISel] Regenerate knownbits tests. NFC (#220200)

Mostly just adding IsKnownNeverZero. knownbits-srem.mir now has auto
generated check lines.
DeltaFile
+463-463llvm/test/CodeGen/AArch64/GlobalISel/knownbits-vector.mir
+101-101llvm/test/CodeGen/AArch64/GlobalISel/knownbits-uadde.mir
+101-101llvm/test/CodeGen/AArch64/GlobalISel/knownbits-sadde.mir
+97-97llvm/test/CodeGen/AArch64/GlobalISel/knownbits-rotl-rotr.mir
+95-95llvm/test/CodeGen/AArch64/GlobalISel/knownbits-fshl-fshr.mir
+80-80llvm/test/CodeGen/AArch64/GlobalISel/knownbits-add.mir
+937-93732 files not shown
+1,857-1,87138 files

LLVM/project b0a9909llvm/lib/Transforms/Vectorize VPlan.h VPlanUtils.cpp, llvm/test/Transforms/LoopVectorize runtime-checks-difference.ll nested-loops-scev-expansion.ll

[VPlan] Expand AddRecs in Plan's entry (#209921)

Extend VPSCEVExpander to expand AddRecs in the Plan's entry. In the
general case, an AddRec's loop header refers to a BasicBlock that is no
longer in the Plan, and we have to fall back to the IR SCEV expander.
However, when the Plan's entry has a canonical IV that we can re-use as
a VPIRPhi, expand the AddRec to VPInstructions.
DeltaFile
+50-9llvm/test/Transforms/LoopVectorize/VPlan/expand-scev.ll
+33-6llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
+1-2llvm/test/Transforms/LoopVectorize/runtime-checks-difference.ll
+1-2llvm/test/Transforms/LoopVectorize/nested-loops-scev-expansion.ll
+1-1llvm/lib/Transforms/Vectorize/VPlan.h
+86-205 files