LLVM/project 46ff6b5llvm/lib/Transforms/Vectorize SLPVectorizer.cpp, llvm/lib/Transforms/Vectorize/SLPVectorizer SLPUtils.h SLPCostAnalysis.cpp

[SLP]Model or-reduction of masked shifted lanes as a bitfield pack

An or reduction of and(shl(x, s), m) lanes that each cover a disjoint
contiguous byte field of the result is a repacking of the per-lane field
contents, not a shift and reduce. Prove the fields disjoint from the
per-lane possibly-set bits (a saturating numeric upper bound combined with
known bits), then emit the pack as a trunc, an optional per-lane lshr, a
byte shuffle and a bitcast. A plain byte reversal becomes a bswap, an
identity byte order needs no shuffle, and byte-zext lanes compact for free.

Fixes #175446

Assisted-by: Cursor

Reviewers: bababuck

Pull Request: https://github.com/llvm/llvm-project/pull/219731
DeltaFile
+301-40llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+138-97llvm/test/Transforms/PhaseOrdering/X86/avg.ll
+152-0llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPUtils.cpp
+68-0llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPCostAnalysis.cpp
+28-24llvm/test/Transforms/SLPVectorizer/X86/pr48879-sroa.ll
+42-0llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPUtils.h
+729-1616 files not shown
+766-19012 files

LLVM/project a47fe60llvm/lib/Target/RISCV RISCVTargetTransformInfo.cpp, llvm/test/Analysis/CostModel/RISCV vp-intrinsics.ll

[RISCV] Account for VL toggle cost when splitting VP memory intrinsics (#223992)

Not an alternative to #222836 since this doesn't handle all cases, but
something we should do anyway in the TTI to be accurate.

For vp.load/vp.gather/vp.strided.load and their store counterparts, when
they're split they introduce extra vl toggles which involve computation
on the evl, e.g.

      vsetvli a2, zero, e8, mf4, ta, ma
      vmv1r.v v8, v0
      csrr a2, vlenb
      srli a3, a2, 3
      vslidedown.vx v0, v0, a3
      sub a3, a1, a2
      sltu a4, a1, a3
      addi a4, a4, -1
      slli a5, a2, 3
      and a3, a4, a3

    [12 lines not shown]
DeltaFile
+21-21llvm/test/Transforms/LoopVectorize/RISCV/strided-access-wide-stride.ll
+31-2llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+13-13llvm/test/Transforms/LoopVectorize/RISCV/strided-accesses-narrow-iv.ll
+5-5llvm/test/Analysis/CostModel/RISCV/vp-intrinsics.ll
+70-414 files

LLVM/project 2794e41llvm/include/llvm/Object GOFF.h GOFFObjectFile.h, llvm/lib/Object GOFFObjectFile.cpp

[Object][GOFF] Support RLD records (#216780)

This is to add support for RT_RLD records when reading GOFF objects.
DeltaFile
+119-1llvm/lib/Object/GOFFObjectFile.cpp
+47-14llvm/include/llvm/Object/GOFFObjectFile.h
+46-0llvm/unittests/Object/GOFFObjectFileTest.cpp
+10-0llvm/include/llvm/Object/GOFF.h
+222-154 files

LLVM/project 03a5dbautils/bazel/llvm-project-overlay/mlir/test BUILD.bazel

[Bazel] Fixes 4837d8d (#224283)

This fixes 4837d8d5a3b1694f2e760cb4eec54360b047f722 (#214627).

Buildkite error link:
https://buildkite.com/llvm-project/upstream-bazel/builds?commit=4837d8d5a3b1694f2e760cb4eec54360b047f722

Co-authored-by: Google Bazel Bot <google-bazel-bot at google.com>
DeltaFile
+2-0utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
+2-01 files

LLVM/project 66ccc4cclang/lib/AST/ByteCode Interp.h Context.cpp

[clang][bytecode] Add a function frame allocator (#220229)

Add a function frame allocator we share across evaluations.

For code like
```c++
consteval int foo() {
  int a = 0;
  for (int i = 0; i != 10; ++i)
    inc(a);
  return a;
}
```
We previously `new[]`-ed a frame for every call of `inc()`, and
`delete[]`d the memory again directly after, resulting in lots of small
(in this case) allocations.

Add a `FrameAllocator` class that handles frames like a LIFO stack and
allocates memory in 4kb chunks. If a newly created frame fits into an

    [39 lines not shown]
DeltaFile
+210-0clang/lib/AST/ByteCode/FrameAllocator.h
+8-31clang/lib/AST/ByteCode/Interp.cpp
+31-3clang/lib/AST/ByteCode/InterpState.h
+11-13clang/lib/AST/ByteCode/InterpState.cpp
+11-11clang/lib/AST/ByteCode/Context.cpp
+3-12clang/lib/AST/ByteCode/Interp.h
+274-705 files not shown
+283-9411 files

LLVM/project a1ec0e4llvm/lib/Target/SPIRV SPIRVCallLowering.cpp, llvm/test/CodeGen/SPIRV/transcoding func_param_attr.ll

[SPIR-V] Emit FuncParamAttr Zext/Sext for return type attributes (#223724)
DeltaFile
+15-0llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp
+14-0llvm/test/CodeGen/SPIRV/transcoding/func_param_attr.ll
+29-02 files

LLVM/project 21517dellvm/lib/Target/AArch64 AArch64Features.td AArch64Processors.td, llvm/test/CodeGen/AArch64 dup-ext-load-combine.ll

[AArch64] Use SVE for load-extend-broadcast (#221689)

On certain cores, it is faster to use SVE ld1r instructions to load,
extend and broadcast an integer value to a vector in all cases other
than 64bit vectors where no type promotion occurs.

To acheive this, introduce a tuning option, `PreferSVEVectors` for use
when combining DUP instructions to create a Splat Vector to the scalable
alternative, and then use the already implemented scheduling model
patterns for splat vectors to end up generate the ld1r instruction.

If used in a loop, the predicate will be hoisted outside of the loop.
DeltaFile
+238-66llvm/test/CodeGen/AArch64/dup-ext-load-combine.ll
+12-2llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+4-2llvm/lib/Target/AArch64/AArch64Processors.td
+4-0llvm/lib/Target/AArch64/AArch64Features.td
+258-704 files

LLVM/project c5c167cllvm/include/llvm/Support LLVMDriver.h Driver.h, llvm/lib/Support Driver.cpp

[Support] Add ToolSession for in-process tool invocation (#221996)

Please read
[RFC](https://discourse.llvm.org/t/rfc-embeddable-llvm-tool-drivers-for-long-lived-hosts/91754)
& [RFC
section](https://discourse.llvm.org/t/rfc-embeddable-llvm-tool-drivers-for-long-lived-hosts/91754#p-367966-why-initllvm-ownership-matters-7)

This patch introduces `LLVMToolSession`, which lets a long-lived host
own LLVM process initialization and invoke registered LLVM tools without
constructing and destroying `InitLLVM` for every call.

The existing `llvm` multicall driver is used as the first consumer. It
already combines several callable tool entry points in one executable,
making it a small and concrete place to establish the session model
without changing the individual tools.

An `LLVMToolSession`:

- owns one `InitLLVM` instance for the lifetime of the host;

    [26 lines not shown]
DeltaFile
+131-0llvm/lib/Support/Driver.cpp
+127-0llvm/unittests/Support/LLVMToolSession/LLVMToolSessionTest.cpp
+96-0llvm/include/llvm/Support/Driver.h
+22-50llvm/tools/llvm-driver/llvm-driver.cpp
+0-27llvm/include/llvm/Support/LLVMDriver.h
+20-0llvm/unittests/Support/LLVMToolSession/CMakeLists.txt
+396-7731 files not shown
+435-10537 files

LLVM/project bbd61cbllvm/lib/Transforms/Scalar BDCE.cpp, llvm/test/Transforms/BDCE dbg-sext-to-zext.ll dbg-binops-multiuse.ll

Fix llvm bdce debug salvage (#220900)

BDCE simplifies constant-mask `and`, `or`, and `xor` instructions when
the changed bits are not demanded by program uses. It can similarly
replace a `sext` with a `zext` when none of the sign bits are demanded.
Both transformations used ordinary RAUW, which also redirected direct
debug uses to values with different meanings.

Replace only non-metadata uses when applying these optimizations. This
leaves direct debug users for BDCE's existing reverse-order salvage
pass, which reconstructs supported operations in a `DIExpression` and
makes unsupported locations unavailable.

Add regression tests covering salvage of `and`, `or`, and `xor`, the
unavailable fallback for an unrepresentable wide constant, and
preservation of signed-extension semantics when program uses receive a
`zext`.

Fixes #218890
Fixes #46640
DeltaFile
+69-0llvm/test/Transforms/BDCE/dbg-binops-multiuse.ll
+39-0llvm/test/Transforms/BDCE/dbg-sext-to-zext.ll
+6-2llvm/lib/Transforms/Scalar/BDCE.cpp
+114-23 files

LLVM/project 5a35d5bclang/lib/CIR/CodeGen CIRGenTypes.cpp CIRGenBuilder.h, clang/test/CodeGen/AArch64/sve dup.c

[clang][cir] Add missing tests for SVE DUP intrinsics (#223932)

Adds missing code-gen tests for DUP intrinsics operating on bf16.
DeltaFile
+57-0clang/test/CodeGen/AArch64/sve/dup.c
+1-1clang/lib/CIR/CodeGen/CIRGenTypes.cpp
+1-1clang/lib/CIR/CodeGen/CIRGenBuilder.h
+59-23 files

LLVM/project 2ad0b22clang/lib/AST/ByteCode Pointer.cpp

Silence "not all control paths return a value"; NFC (#224276)
DeltaFile
+1-0clang/lib/AST/ByteCode/Pointer.cpp
+1-01 files

LLVM/project b8f372dlibc/src/__support/mathvec CMakeLists.txt sinf.h, libc/src/mathvec/generic sinf.cpp

[libc][mathvec] Vectorise sinf (#220985)

Replaces loop over scalar sinf with a fully vectorised implementation.
DeltaFile
+168-0libc/src/__support/mathvec/trig_reductionf_nofma.h
+129-0libc/src/__support/mathvec/trig_reductionf.h
+74-6libc/src/__support/mathvec/sinf.h
+14-1libc/src/__support/mathvec/CMakeLists.txt
+1-1libc/src/mathvec/generic/sinf.cpp
+386-85 files

LLVM/project 5068c41clang/test/OffloadTools/clang-linker-wrapper linker-wrapper-image.c linker-wrapper-host-datalayout.c, clang/tools/clang-linker-wrapper ClangLinkerWrapper.cpp

clang-linker-wrapper: Set the host DataLayout on the offload wrapper module

The offload wrapper module was created with only a target triple, and the
datalayout wasn't set until later, where it was copied from the TargetMachine,
after the wrapping code already ran.

The wrapping code did query the datalayout for the pointer size, so this was
broken for host and devices with different pointer sizes.
queries the DataLayout (e.g. the size_t / intptr type via getSizeTTy), so on a
host whose pointer size differs from the default layout (e.g. a 32-bit host) it
used the wrong integer width for image offsets.

This removes a use of TargetMachine::createDataLayout, which I am trying to
remove.

Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
DeltaFile
+27-0clang/test/OffloadTools/clang-linker-wrapper/linker-wrapper-host-datalayout.c
+4-5clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+4-4clang/test/OffloadTools/clang-linker-wrapper/linker-wrapper-image.c
+35-93 files

LLVM/project e9e1cb3llvm/lib/Target/SPIRV SPIRVNonSemanticDebugHandler.cpp, llvm/test/CodeGen/SPIRV/debug-info debug-type-composite.ll

[SPIR-V] Skip debug type sizes wider than 32 bits (#223678)

A size or offset above 4 GB was truncated to 32 bits, now they are
dropped
DeltaFile
+20-1llvm/test/CodeGen/SPIRV/debug-info/debug-type-composite.ll
+9-0llvm/lib/Target/SPIRV/SPIRVNonSemanticDebugHandler.cpp
+29-12 files

LLVM/project ff0451fllvm/lib/Support APFloatPowerOfFiveTable.inc, llvm/test/CodeGen/AMDGPU float-to-arbitrary-fp-fp8-hw.ll llvm.amdgcn.permlane.ll

Merge branch 'main' into users/lukel97/riscv/vp-split-cost
DeltaFile
+815-0llvm/test/Transforms/PhaseOrdering/ARM/arm_mat_mult_q31.ll
+383-393llvm/test/CodeGen/AMDGPU/llvm.amdgcn.permlane.ll
+736-0llvm/test/Transforms/SLPVectorizer/X86/bool-mask.ll
+719-0llvm/test/CodeGen/NVPTX/mixed-precision-add-f32x2-upconvert-invalid.ll
+326-308llvm/test/CodeGen/AMDGPU/float-to-arbitrary-fp-fp8-hw.ll
+616-0llvm/lib/Support/APFloatPowerOfFiveTable.inc
+3,595-7011,034 files not shown
+33,253-9,4561,040 files

LLVM/project 4837d8dmlir/test/Conversion/ConvertToSPIRV simple.mlir scf.mlir, mlir/test/lib/Pass TestConvertToSPIRVPass.cpp

[mlir][SPIR-V] Populate math and cf dialect patterns in `test-convert-to-spirv` (#214627)
DeltaFile
+20-0mlir/test/Conversion/ConvertToSPIRV/scf.mlir
+19-0mlir/test/Conversion/ConvertToSPIRV/simple.mlir
+4-0mlir/test/lib/Pass/TestConvertToSPIRVPass.cpp
+43-03 files

LLVM/project b588586mlir/lib/Dialect/Bufferization/Transforms BufferOptimizations.cpp, mlir/test/Transforms promote-buffers-to-stack.mlir

[mlir][bufferization] Fix 32-bit overflow in `PromoteBuffersToStack` threshold check (#223986)

This PR fix 32-bit overflow in `PromoteBuffersToStack` threshold check.

Fixes #223937

---------

Signed-off-by: Federico Bruzzone <federico.bruzzone.i at gmail.com>
DeltaFile
+10-2mlir/test/Transforms/promote-buffers-to-stack.mlir
+2-1mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
+12-32 files

LLVM/project bc79eb5flang/docs OpenMPSupport.md, offload/test/offloading error_directive.c

[OpenMP][DeviceRTL] Implement __kmpc_error for the error directive (#220702)

### Description
[OpenMP][DeviceRTL] Implement __kmpc_error for the error directive

### Notes
Part of #204240 
Assisted-by: Github Copilot
DeltaFile
+39-0offload/test/offloading/error_directive.c
+27-0offload/test/offloading/fortran/error_directive.f90
+23-0offload/test/offloading/fortran/error_directive_fatal.f90
+12-0openmp/device/src/Misc.cpp
+4-0openmp/device/include/Interface.h
+1-1flang/docs/OpenMPSupport.md
+106-16 files

LLVM/project 82b6b78llvm/test/Transforms/LoopVectorize epilog-vectorization-fmaxnum-reductions.ll fmax-without-fast-math-flags-interleave.ll, llvm/test/Transforms/LoopVectorize/AArch64 fmin-without-fast-math-flags.ll fmax-without-fast-math-flags.ll

Freeze MinOrMaxOp earlier
DeltaFile
+61-79llvm/test/Transforms/LoopVectorize/fcmp-uno-fold-interleave.ll
+48-84llvm/test/Transforms/LoopVectorize/fmax-without-fast-math-flags.ll
+56-68llvm/test/Transforms/LoopVectorize/AArch64/fmax-without-fast-math-flags.ll
+41-59llvm/test/Transforms/LoopVectorize/fmax-without-fast-math-flags-interleave.ll
+24-42llvm/test/Transforms/LoopVectorize/epilog-vectorization-fmaxnum-reductions.ll
+20-26llvm/test/Transforms/LoopVectorize/AArch64/fmin-without-fast-math-flags.ll
+250-3587 files not shown
+335-43913 files

LLVM/project b3d9359clang/docs ReleaseNotes.md, clang/lib/Sema SemaTemplateDeduction.cpp

[Clang] Fix deduction from constant TP of reference type. (#223645)

We were not implementing https://eel.is/c++draft/temp.deduct.type#13
properly.

Fixes #40328

Assisted-By: Opus 5
DeltaFile
+47-0clang/test/SemaTemplate/temp_arg_nontype_ref.cpp
+16-14clang/lib/Sema/SemaTemplateDeduction.cpp
+13-0clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp
+3-0clang/docs/ReleaseNotes.md
+79-144 files

LLVM/project 136ee82flang/lib/Evaluate tools.cpp character.h

Make static assertion template-dependent

Avoid platform-dependent widening

Avoid platform-dependent widening

One more char dependence

Mask-out not needed anymore

clang-format

clang-format

Post-merge fixes
DeltaFile
+3-11flang/lib/Evaluate/character.h
+3-3flang/lib/Evaluate/tools.cpp
+6-142 files

LLVM/project aeba0a3libc/test/src/math/exhaustive cos.wc sin.wc, llvm/test/CodeGen/AMDGPU maximumnum.bf16.ll amdgcn.bitcast.512bit.ll

Merge commit '85dc28185005099502c58dfcdba30d601edb59f4' into HEAD
DeltaFile
+1,091,085-0libc/test/src/math/exhaustive/sin.wc
+1,090,178-0libc/test/src/math/exhaustive/cos.wc
+9,382-9,576llvm/test/CodeGen/AMDGPU/amdgcn.bitcast.1024bit.ll
+6,144-5,944llvm/test/CodeGen/AMDGPU/bf16.ll
+4,770-4,849llvm/test/CodeGen/AMDGPU/amdgcn.bitcast.512bit.ll
+3,231-3,437llvm/test/CodeGen/AMDGPU/maximumnum.bf16.ll
+2,204,790-23,8062,940 files not shown
+2,373,010-116,7282,946 files

LLVM/project 85dc281flang/include/flang/Evaluate character-value.h, flang/lib/Evaluate character-value.cpp character-value-impl.h

Make static assertion template-dependent

Avoid platform-dependent widening

Avoid platform-dependent widening

One more char dependence

clang-format
DeltaFile
+9-2flang/unittests/Evaluate/CharacterValueTest.cpp
+6-3flang/lib/Evaluate/character-value-impl.cpp
+4-2flang/lib/Evaluate/character-value-impl.h
+3-2flang/include/flang/Evaluate/character-value.h
+1-1flang/lib/Evaluate/character-value.cpp
+23-105 files

LLVM/project c439207libc/test/src/math/exhaustive cos.wc sin.wc, llvm/test/CodeGen/AMDGPU maximumnum.bf16.ll amdgcn.bitcast.512bit.ll

Merge commit 'ae9feeea47f191cce37ef408ee0a692652c1c62a' into HEAD
DeltaFile
+1,091,085-0libc/test/src/math/exhaustive/sin.wc
+1,090,178-0libc/test/src/math/exhaustive/cos.wc
+9,382-9,576llvm/test/CodeGen/AMDGPU/amdgcn.bitcast.1024bit.ll
+6,144-5,944llvm/test/CodeGen/AMDGPU/bf16.ll
+4,770-4,849llvm/test/CodeGen/AMDGPU/amdgcn.bitcast.512bit.ll
+3,231-3,437llvm/test/CodeGen/AMDGPU/maximumnum.bf16.ll
+2,204,790-23,8062,935 files not shown
+2,372,984-116,7152,941 files

LLVM/project 2526f1clldb/source/Plugins/LanguageRuntime/CPlusPlus CPPLanguageRuntime.h CPPLanguageRuntime.cpp

[lldb] Use Guarded in CPPLanguageRuntime (#220212)

Use Guarded to make sure m_vtable_info_map cannot be accesses without
locking the respective lock.
DeltaFile
+4-5lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+3-2lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
+7-72 files

LLVM/project 4fc3acaclang/test/OffloadTools/clang-linker-wrapper linker-wrapper-host-datalayout.c, clang/tools/clang-linker-wrapper ClangLinkerWrapper.cpp

clang-linker-wrapper: Set the host DataLayout on the offload wrapper module

The offload wrapper module was created with only a target triple, and the
datalayout wasn't set until later, where it was copied from the TargetMachine,
after the wrapping code already ran.

The wrapping code did query the datalayout for the pointer size, so this was
broken for host and devices with different pointer sizes.
queries the DataLayout (e.g. the size_t / intptr type via getSizeTTy), so on a
host whose pointer size differs from the default layout (e.g. a 32-bit host) it
used the wrong integer width for image offsets.

This removes a use of TargetMachine::createDataLayout, which I am trying to
remove.

Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
DeltaFile
+27-0clang/test/OffloadTools/clang-linker-wrapper/linker-wrapper-host-datalayout.c
+4-5clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+31-52 files

LLVM/project 9b4133foffload/include PluginManager.h, offload/liboffload/src OffloadImpl.cpp

[offload][omp] Load plugins through liboffload
DeltaFile
+15-11offload/libompaccsupport/PluginManager.cpp
+6-0offload/liboffload/src/OffloadImpl.cpp
+2-1offload/include/PluginManager.h
+23-123 files

LLVM/project 5f2cbfaoffload/liboffload/API Platform.td, offload/liboffload/src OffloadImpl.cpp

[OFFLOAD] add olIteratePlatforms
DeltaFile
+45-0offload/unittests/OffloadAPI/platform/olIteratePlatforms.cpp
+23-0offload/liboffload/API/Platform.td
+11-0offload/liboffload/src/OffloadImpl.cpp
+79-03 files

LLVM/project 0c430fboffload CMakeLists.txt, offload/liboffload CMakeLists.txt

[offload][omp] Link libomptarget against static liboffload
DeltaFile
+27-14offload/liboffload/CMakeLists.txt
+3-3offload/libomptarget/CMakeLists.txt
+3-3offload/liboffload/src/OffloadImpl.cpp
+2-1offload/CMakeLists.txt
+35-214 files

LLVM/project 2ff59c7offload/liboffload/src OffloadImpl.cpp

[offload] lazily load liboffload
DeltaFile
+242-90offload/liboffload/src/OffloadImpl.cpp
+242-901 files