LLVM/project 59cf30bllvm/lib/Target/AMDGPU AMDGPUPromoteAlloca.cpp, llvm/test/CodeGen/AMDGPU promote-alloca-mixed-width-access.ll

[AMDGPU] PromoteAlloca: split scalar accesses that span several elements

promoteAllocaToVector already splits a *vector* access across several
elements when it is a multiple of the element size, but a *scalar* access
had to be bitcastable to the element type, so an i64 load from an alloca
promoted to <8 x i32> was rejected as "not a supported access type" and
the object stayed in scratch.

Accept a scalar access that is a whole multiple of the element size and
route it through the existing subvector path, which already builds the
value from consecutive elements and bitcasts. Accesses with padding are
still rejected, since splitting those would put the pieces at the wrong
offsets, as are non-integer non-float types.
DeltaFile
+78-0llvm/test/CodeGen/AMDGPU/promote-alloca-mixed-width-access.ll
+28-4llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
+106-42 files

LLVM/project fb0a790llvm/lib/Target/AMDGPU AMDGPUPromoteAlloca.cpp, llvm/test/CodeGen/AMDGPU eliminate-frame-index-select.ll promote-alloca-homogeneous-struct.ll

[AMDGPU] PromoteAlloca: flatten homogeneous structs to vectors

getVectorTypeForAlloca() peeled nested ArrayType and one inner
FixedVectorType, but stopped at any StructType. An alloca of an array of
structs was therefore rejected with "Cannot convert type to vector" and
fell back to scratch, even when the struct was a trivial wrapper around a
scalar.

Peel structs too, but only when every field has the same type and the
struct has no padding, so flattened elements keep the byte offsets the
surrounding index arithmetic assumes. Structs with differing field types
or with padding are left alone.
DeltaFile
+59-0llvm/test/CodeGen/AMDGPU/promote-alloca-homogeneous-struct.ll
+35-6llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
+6-1llvm/test/CodeGen/AMDGPU/eliminate-frame-index-select.ll
+100-73 files

LLVM/project 2cdedc6bolt/lib/Core Relocation.cpp, bolt/test/AArch64 tls.c

Revert "[AArch64][BOLT] Fold local-exec TLS relocations into loads and stores…"

This reverts commit 378f2d88e32147459b24d63b971711136f83c0b0.
DeltaFile
+6-47llvm/test/CodeGen/AArch64/arm64-tls-local-exec.ll
+1-18llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
+8-5llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+0-12bolt/test/AArch64/tls.c
+0-10llvm/test/CodeGen/AArch64/win-tls.ll
+0-8bolt/lib/Core/Relocation.cpp
+15-1006 files

LLVM/project 86d1e00llvm/lib/Target/DirectX DXILResourceAccess.cpp, llvm/test/CodeGen/DirectX/ResourceAccess handle-to-index.ll

[DirectX] Prevent `dxil-resource-access` from constructing a foldable phi (#211346)

A phi node of the index should only be created if the indices actually
differ: https://godbolt.org/z/x6z64qqvK.

This is resolved by updating `getAccessIndices` to only create a new phi
when needed.

This causes validation errors when accessing specific resources that
require all indices are constant.

Resolves, in part, https://github.com/llvm/llvm-project/issues/211121

Assisted by: Claude Opus 4.8
DeltaFile
+16-1llvm/lib/Target/DirectX/DXILResourceAccess.cpp
+2-4llvm/test/CodeGen/DirectX/ResourceAccess/handle-to-index.ll
+18-52 files

LLVM/project e93d609compiler-rt/lib/rtsan rtsan_interceptors_posix.cpp

[rtsan] Fix sanitizer_common/TestCases/dlsym_alloc.c (#216579)

This test crashes on `free(NULL)` when DlsymAlloc is being used. This is
because `DlysmAlloc::Free` seems to crash on linux when it's called with
`nullptr`.

The vast majority of other sanitizers guard against it on the sanitizer
side in this way:


https://github.com/llvm/llvm-project/blob/65e0fe689bb7c1a6516644c27c25c3fe3c8b1ac7/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp#L728


https://github.com/llvm/llvm-project/blob/65e0fe689bb7c1a6516644c27c25c3fe3c8b1ac7/compiler-rt/lib/lsan/lsan_interceptors.cpp#L78

For example.
DeltaFile
+19-15compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
+19-151 files

LLVM/project 4fe326dllvm/lib/Target/X86 X86ISelLowering.cpp, llvm/test/CodeGen/X86 vector-reduce-xor.ll

[X86] combineVECREDUCE_LOGIC - add missing reduce_xor parity result sign extension (#217002)

#199544 enabled support for reduce_xor with non-vXi1 types, but we were
missing the sign extension that was handled only for the reduce_or/and
cases

Fixes #215069
DeltaFile
+21-20llvm/lib/Target/X86/X86ISelLowering.cpp
+1-0llvm/test/CodeGen/X86/vector-reduce-xor.ll
+22-202 files

LLVM/project 6523442mlir/include/mlir/Interfaces CallInterfaces.td, mlir/lib/Dialect/LLVMIR/IR LLVMDialect.cpp

[mlir][Interfaces] `CallOpInterface`: Model forwarded result + improve verification (#214724)

`CallOpInterface` distinguishes between forwarded operands and consumed
operands. This commit adds the concept of "forwarded results", making
operands/results symmetric.

Forwarded operands are forwarded from the caller to the callee's block
arguments. Forwarded results are forwarded from the callee to the
caller's results. All other operands/results are consumed/produced by
the call op.

This commit also improves verification:
- The number of forwarded operands and callee arguments must match.
- The number of forwarded results and caller results must match.
- Verification that was duplicated in op verifiers is now performed by
the interface verifier.

Note: `llvm.call` / `llvm.func` support variadic operands. These are not
supported by `CallOpInterface` or `CallableOpInterface`. The

    [8 lines not shown]
DeltaFile
+111-0mlir/test/Interfaces/CallInterfaces/call-op-interface-invalid.mlir
+65-37mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+68-0mlir/lib/Interfaces/CallInterfaces.cpp
+63-0mlir/test/Interfaces/CallInterfaces/call-op-interface-roundtrip.mlir
+40-4mlir/include/mlir/Interfaces/CallInterfaces.td
+31-0mlir/test/lib/Dialect/Test/TestOpDefs.cpp
+378-4114 files not shown
+536-12220 files

LLVM/project ce20efallvm/test/Transforms/PGOProfile memprof.ll

simplify test
DeltaFile
+6-12llvm/test/Transforms/PGOProfile/memprof.ll
+6-121 files

LLVM/project 3287bc9clang/lib/Sema SemaExpr.cpp, clang/test/SemaCXX source_location.cpp

[clang] Fix issue introduced in predefined expressions in lambdas (#217021)

Resolves #213420.

The problem introduced in #211811 is that the search for the
`LambdaScopeInfo` corresponding to the current lambda operator stops at
the first scope info that is not a `CapturingScopeInfo`.
This is relevant in `getCurLambda` (where I looked when implementing the
PR), but not here.
DeltaFile
+34-5clang/test/SemaCXX/source_location.cpp
+1-2clang/lib/Sema/SemaExpr.cpp
+35-72 files

LLVM/project 42febe1flang/include/flang/Optimizer/Builder/Runtime Assign.h, flang/lib/Optimizer/Builder/Runtime Assign.cpp

[flang] - Call _FortranAAssignSimple instead of _FortranAAssign for intrinsic-type array assignments.

This patch adds support for calling _FortranAAssignSimple, a faster-path for array assignments.
`_FortranAAssignSimple` is called when ALL the following conditions are true:
1. Intrinsic element type (not derived type)
2. Matching ranks (no scalar-to-array broadcasting)
3. Non-volatile
4. Not polymorphic
5. Not explicit-length character
6. Not temporary LHS

Otherwise, uses `_FortranAAssign` (or specialized variants like `_FortranAAssignPolymorphic`, `_FortranAAssignExplicitLengthCharacter`).

This is a (perhaps final) part of the fix for https://github.com/llvm/llvm-project/issues/203915
DeltaFile
+287-0flang/test/HLFIR/assign-simple-routing.fir
+46-4flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp
+19-13flang/lib/Optimizer/OpenMP/LowerWorkdistribute.cpp
+13-0flang/lib/Optimizer/Builder/Runtime/Assign.cpp
+12-0flang/include/flang/Optimizer/Builder/Runtime/Assign.h
+2-2flang/test/HLFIR/assign-codegen.fir
+379-192 files not shown
+381-218 files

LLVM/project 2c87f91flang-rt/lib/runtime assign.cpp, flang-rt/unittests/Runtime Assign.cpp

fix clang-format issues and flang-rt unittest for Assign.cpp
DeltaFile
+6-6flang-rt/unittests/Runtime/Assign.cpp
+3-2flang-rt/lib/runtime/assign.cpp
+9-82 files

LLVM/project e6bd01foffload/languages/include/kernel LanguageRuntime.h, offload/languages/kernel/src LanguageRuntime.cpp

add Memset
DeltaFile
+87-0offload/test/offloading/CUDA/memset.cu
+85-0offload/test/offloading/HIP/memset.hip
+19-0offload/languages/kernel/src/LanguageRuntime.cpp
+1-2offload/test/offloading/HIP/basic_launch_blocks_and_threads.hip
+1-2offload/test/offloading/CUDA/basic_launch_blocks_and_threads.cu
+2-0offload/languages/include/kernel/LanguageRuntime.h
+195-42 files not shown
+197-48 files

LLVM/project 7193df9offload/languages/kernel/src LanguageRuntime.cpp, offload/test/offloading/CUDA devicesync_streams.cu

add proper deviceSync
DeltaFile
+98-0offload/test/offloading/CUDA/devicesync_streams.cu
+97-0offload/test/offloading/HIP/devicesync_streams.hip
+13-6offload/languages/kernel/src/LanguageRuntime.cpp
+1-1offload/test/offloading/HIP/launch_tu.hip
+1-1offload/test/offloading/HIP/basic_launch_multi_arg.hip
+1-1offload/test/offloading/HIP/basic_launch_blocks_and_threads.hip
+211-97 files not shown
+218-1213 files

LLVM/project 5257b56offload/languages/kernel/include LanguageUtils.h, offload/languages/kernel/src LanguageLaunch.cpp LanguageRuntime.cpp

add blocking semantics to LaunchKernel and Memcpy
DeltaFile
+131-0offload/test/offloading/CUDA/blocking_stream_semantics.cu
+125-0offload/test/offloading/HIP/blocking_stream_semantics.hip
+50-4offload/languages/kernel/include/LanguageUtils.h
+20-5offload/languages/kernel/src/LanguageRuntime.cpp
+17-3offload/languages/kernel/src/LanguageLaunch.cpp
+4-2offload/test/offloading/HIP/stream_api.hip
+347-143 files not shown
+355-179 files

LLVM/project 1fd19d7clang/docs AutomaticReferenceCounting.md AutomaticReferenceCounting.rst, clang/include/clang/Basic AttrDocs.td

Rebase, small improvements

Created using spr 1.3.7
DeltaFile
+4,251-4,283clang/include/clang/Basic/AttrDocs.td
+2,202-1,876llvm/test/CodeGen/AArch64/GlobalISel/arm64-atomic.ll
+21-3,157llvm/test/CodeGen/X86/fp128-libcalls-strict.ll
+0-2,674clang/docs/AutomaticReferenceCounting.rst
+2,591-0clang/docs/AutomaticReferenceCounting.md
+2,162-0clang/test/CodeGen/Mips/variadic-aggregate.c
+11,227-11,9902,634 files not shown
+106,806-54,0522,640 files

LLVM/project 96086b7llvm/test/CodeGen/X86 dpbusd_const.ll dpbusd.ll

[X86] dpbusd tests - presume AVX512BW is available if target has AVX512VNNI (#217020)

Similar to #209838 - technically there's no such target that has
AVX512VNNI but not AVX512BW and there's a limit to "what if" test
coverage we need.

Avoids regressions on future ISD::VECREDUCE_ADD legal support
DeltaFile
+3-3llvm/test/CodeGen/X86/dpbusd_i4.ll
+2-2llvm/test/CodeGen/X86/dpbusd_const.ll
+2-2llvm/test/CodeGen/X86/dpbusd.ll
+7-73 files

LLVM/project 2290f4aoffload/languages/include/kernel DefineLanguageNames.inc UndefineLanguageNames.inc, offload/languages/kernel/src LanguageRuntime.cpp

add StreamCreateWithFlags
DeltaFile
+27-0offload/test/offloading/CUDA/stream_api.cu
+26-0offload/test/offloading/HIP/stream_api.hip
+24-0offload/languages/kernel/src/LanguageRuntime.cpp
+10-1offload/languages/include/kernel/LanguageRuntime.h
+3-1offload/languages/include/kernel/UndefineLanguageNames.inc
+3-0offload/languages/include/kernel/DefineLanguageNames.inc
+93-26 files

LLVM/project 803fc50llvm/lib/Transforms/ObjCARC ObjCARCContract.cpp

[ObjCARCContract] Bail before requesting analyses if !ModuleHasARC (NFC) (#216910)
DeltaFile
+8-11llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp
+8-111 files

LLVM/project e1c9277llvm/lib/Target/NVPTX NVVMReflect.cpp

[NVPTX] Fix NVVMReflect change reporting (#217060)
DeltaFile
+1-1llvm/lib/Target/NVPTX/NVVMReflect.cpp
+1-11 files

LLVM/project f1da2eblld/ELF/Arch X86_64.cpp, lld/test/ELF x86-64-tls-pltoff64.s

[ELF] Handle and optimize x86-64 PLTOFF64 TLS sequences (#216263)

In `gcc -mcmodel=large` generated General Dynamic/Local Dynamic TLS
sequences, R_X86_64_TLSGD/R_X86_64_TLSLD is followed by a MOVABS loading
`__tls_get_addr at pltoff`, and the call goes through a register:

```
  leaq x at tlsgd(%rip), %rdi # R_X86_64_TLSGD
  movabsq $__tls_get_addr at pltoff, %rax # R_X86_64_PLTOFF64
  addq %rbx, %rax
  callq *%rax
```

`relaxTlsGdToLe` and `relaxTlsGdToIe` write the 16-byte direct call
sequence at
loc-4, corrupting the preceding instruction, while `relaxTlsLdToLe`
reports
"expected R_X86_64_PLT32 or R_X86_64_GOTPCRELX after R_X86_64_TLSLD".


    [3 lines not shown]
DeltaFile
+98-0lld/test/ELF/x86-64-tls-pltoff64.s
+60-3lld/ELF/Arch/X86_64.cpp
+158-32 files

LLVM/project 7993402clang/lib/Driver/ToolChains CommonArgs.cpp, clang/test/Driver cuda-via-liboffload.cu

add PerThreadDefaultStream
DeltaFile
+28-0offload/languages/kernel/CMakeLists.txt
+14-0clang/test/Driver/cuda-via-liboffload.cu
+12-0offload/languages/kernel/src/PerThreadDefaultStream.cpp
+6-3offload/languages/kernel/src/State.cpp
+5-0clang/lib/Driver/ToolChains/CommonArgs.cpp
+1-0offload/languages/kernel/exports
+66-36 files

LLVM/project fd3c302mlir/include/mlir/Dialect/SparseTensor/Transforms Passes.td, mlir/test/Dialect/SparseTensor pre_rewriting.mlir

[mlir][sparse] Load the vector dialect in pre-sparsification-rewrite (#216491)

Fixes #216273

`mlir-opt --pre-sparsification-rewrite` aborts on this input:

```mlir
#sparse = #sparse_tensor.encoding<{ map = (d0, d1) -> (d0 : dense, d1 : compressed) }>
func.func @print(%arg0: !llvm.ptr) {
  %0 = sparse_tensor.new %arg0 : !llvm.ptr to tensor<?x?xf32, #sparse>
  sparse_tensor.print %0 : tensor<?x?xf32, #sparse>
  llvm.return
}
```

```
LLVM ERROR: can't create Attribute 'mlir::vector::PrintPunctuationAttr' because
storage uniquer isn't initialized: the dialect was likely not loaded, ...
```

    [13 lines not shown]
DeltaFile
+12-0mlir/test/Dialect/SparseTensor/pre_rewriting.mlir
+1-0mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
+13-02 files

LLVM/project ff447b1mlir/lib/Dialect/SparseTensor/Transforms SparseGPUCodegen.cpp, mlir/test/Dialect/SparseTensor/GPU gpu_buffer_semantics.mlir

[mlir][sparse] Fix crash on linalg ops with buffer semantics (#216458)

Fixes #216215

## The problem

`mlir-opt --sparse-gpu-codegen` crashes on valid input:

```
Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
```

The pass looks for `linalg.generic` ops shaped like a matmul so it can
turn them into GPU library calls. Its checks only look at the *shape* of
the operation (loop count, iterator types, indexing maps, the
multiply-add body) — none of them check whether the operands are tensors
or memrefs.

Sparsity only exists on tensors, so when the pass then asks "is this

    [30 lines not shown]
DeltaFile
+57-0mlir/test/Dialect/SparseTensor/GPU/gpu_buffer_semantics.mlir
+5-0mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
+62-02 files

LLVM/project a83c926offload/languages/kernel/include LanguageUtils.h Stream.h, offload/languages/kernel/src State.cpp

add interal StreamTy
DeltaFile
+242-31offload/languages/kernel/src/State.cpp
+43-7offload/languages/kernel/include/State.h
+34-9offload/test/offloading/CUDA/stream_api.cu
+33-8offload/test/offloading/HIP/stream_api.hip
+33-0offload/languages/kernel/include/Stream.h
+16-1offload/languages/kernel/include/LanguageUtils.h
+401-563 files not shown
+412-669 files

LLVM/project ae23474llvm/lib/Target/NVPTX NVVMIntrRange.cpp NVPTXTagInvariantLoads.cpp

[NVPTX] Preserve CFGAnalyses in more passes (#217062)
DeltaFile
+3-2llvm/lib/Target/NVPTX/NVVMIntrRange.cpp
+3-2llvm/lib/Target/NVPTX/NVPTXTagInvariantLoads.cpp
+3-2llvm/lib/Target/NVPTX/NVPTXMarkKernelPtrsGlobal.cpp
+9-63 files

LLVM/project 21504f4llvm/include/llvm/Transforms/Utils BypassSlowDivision.h, llvm/lib/CodeGen CodeGenPrepare.cpp

[CodeGenPrepare] Maintain BranchProbabilityInfo up-to-date in bypassSlowDivision (#212058)

The test case crashes on the release/23.x. What happens is the
`BranchProbabilityInfo` becomes outdated because of a change of CFG in
`bypassSlowDivision` but no update to `BranchProbabilityInfo`.
So when it arrives to `SplitIndirectBrCriticalEdges` and hit the assert
in `setEdgeProbability`, because the Branch probabilities no-longer make
sense.
DeltaFile
+31-11llvm/lib/Transforms/Utils/BypassSlowDivision.cpp
+32-0llvm/test/Transforms/CodeGenPrepare/X86/bypass-slow-division-bpi-update.ll
+3-1llvm/include/llvm/Transforms/Utils/BypassSlowDivision.h
+1-1llvm/lib/CodeGen/CodeGenPrepare.cpp
+67-134 files

LLVM/project f72ef5allvm/lib/Transforms/Vectorize LoopVectorize.cpp

Fixups
DeltaFile
+3-2llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+3-21 files

LLVM/project 3a20364clang/docs InternalsManual.md

[docs][clang] refactor diagnostic spec instruction and grammar nit (#213432)

A grammar nit found in the description of the Clang Diagnostic Subsystem
is improved.

Replace the instruction mentioning the use of "slash-newline" for
writing multiple diagnostics with the appropriate "backslashes" as that's
what is actually used for separting multiple diagnostics into more than
one line.

The change makes it more obvious on how to implement multi-line
diagnostics by dropping the slightly ambigious slash-newline.

---------

Signed-off-by: Hardik Kumar <hardikxk at gmail.com>
DeltaFile
+3-2clang/docs/InternalsManual.md
+3-21 files

LLVM/project a928b74llvm/lib/CodeGen LiveVariables.cpp

[LiveVariables] Use MCRegister. NFC (#216928)

Avoids an implicit conversion.
DeltaFile
+1-1llvm/lib/CodeGen/LiveVariables.cpp
+1-11 files

LLVM/project 0ef7e0cllvm/lib/Target/ARM ARMInstrThumb2.td ARMInstrThumb.td, llvm/test/CodeGen/ARM v8m-tail-call-macho.ll

[ARM] Allow tTAILJMPd on v8-M Baseline (#216747)

a1189106d5a1 added B.W to v8-M Baseline, relaxing t2B, tCBZ and tCBNZ
from Requires<[IsThumb2]> to Requires<[IsThumb, HasV8MBaseline]>, and
enabled tail calls for it. It missed tTAILJMPd, which expands to t2B but
still required IsThumb2, so emitting a tail call for a Thumb1 MachO
target failed:
> LLVM ERROR: Attempting to emit tTAILJMPd instruction but the
Feature_IsThumb2 predicate(s) are not met
DeltaFile
+17-0llvm/test/CodeGen/ARM/v8m-tail-call-macho.ll
+2-2llvm/lib/Target/ARM/ARMInstrThumb.td
+1-1llvm/lib/Target/ARM/ARMInstrThumb2.td
+20-33 files