LLVM/project fe76e90llvm/lib/CodeGen MachineBlockPlacement.cpp, llvm/test/CodeGen/X86 code_placement_ext_tsp_size_and_perf.ll

[CodeGen] Allow `-enable-ext-tsp-block-placement` and `-apply-ext-tsp-for-size`  passed together (#183642)

Currently, the asserts fires when both `UseExtTspForPerf` and
`UseExtTspForSize` are true on a given function.

Ideally, we should allow `-enable-ext-tsp-block-placement` and
`-apply-ext-tsp-for-size` passed together, meaning run the block
placement for performance on hot functions, while run the placement for
size on cold functions.

The diff makes `UseExtTspForPerf` and `UseExtTspForSize` mutually
exclusive per-function: functions with the `OptForSize` attribute use
ext-tsp block placement for size, while the others use ext-tsp block
placement for perf.

Co-authored-by: Sharon Xu <sharonxu at fb.com>
DeltaFile
+91-0llvm/test/CodeGen/X86/code_placement_ext_tsp_size_and_perf.ll
+3-3llvm/lib/CodeGen/MachineBlockPlacement.cpp
+94-32 files

LLVM/project d72e95bclang/test/CIR/CodeGenHLSL matrix-element-expr-load.hlsl

[CIR] Use `-verify` on clang/test/CIR/CodeGenHLSL/matrix-element-expr-load.hlsl (#182817)

Update clang/test/CIR/CodeGenHLSL/matrix-element-expr-load.hlsl to use
`-verify` with expected CIR NYI diagnostics.
DeltaFile
+7-6clang/test/CIR/CodeGenHLSL/matrix-element-expr-load.hlsl
+7-61 files

LLVM/project 0b88ee1clang/include/clang/CIR/Dialect/IR CIRAttrs.td CIRTypes.h, clang/lib/CIR/Dialect/IR CIRTypes.cpp CIRAttrs.cpp

[CIR] Infrastructure and MemorySpaceAttrInterface for Address Spaces (#179073)

Related: https://github.com/llvm/llvm-project/issues/175871,
https://github.com/issues/assigned?issue=llvm%7Cllvm-project%7C179278,
https://github.com/issues/assigned?issue=llvm%7Cllvm-project%7C160386

- Introducing the LangAddressSpace enum with offload address space kinds
(offload_private, offload_local, offload_global, offload_constant,
offload_generic) and the LangAddressSpaceAttr attribute.


- Generalizes CIR AS attributes as MemorySpaceAttrInterface and Attaches
it to `PointerType`. Includes test coverage for valid IR roundtrips and
invalid address space parsing.

This starts a series of patches with the purpose of bringing complete
address spaces support features for CIR. Most of the test coverage is
provided in subsequent patches further down the stack. note that most of
these patches are based on: https://github.com/llvm/clangir/pull/1986
DeltaFile
+163-39clang/lib/CIR/Dialect/IR/CIRTypes.cpp
+104-4clang/lib/CIR/Dialect/IR/CIRAttrs.cpp
+52-3clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
+41-0clang/test/CIR/IR/address-space.cir
+29-3clang/test/CIR/IR/invalid-addrspace.cir
+17-3clang/include/clang/CIR/Dialect/IR/CIRTypes.h
+406-5212 files not shown
+474-7918 files

LLVM/project 6f9c68dllvm/test/Transforms/LoopVectorize/AArch64 scalable-strict-fadd.ll sve-interleaved-masked-accesses.ll

[VPlan] Don't adjust trip count for DataAndControlFlowWithoutRuntimeCheck (#183729)

Previously, the canonical IV increment may have overflowed to a non-zero
value due to vscale being a non power-of-two. So we used to emit a
runtime check for this.

If you didn't want the runtime check,
DataAndControlFlowWithoutRuntimeCheck skipped it and instead tweaked the
trip count so it wouldn't overflow.

However #144963 stopped the check from ever being emitted because vscale
is always a power-of-two on AArch64 and RISC-V, so it never overflowed
to a non-zero value. And in #183292 the code to emit the check was
removed. But we never restored the trip count back to normal when the
target's vscale was a power-of-two.

Now that vscale is always a power-of-two, this PR avoids adjusting it. A
follow up NFC can then remove DataAndControlFlowWithoutRuntimeCheck.
DeltaFile
+174-195llvm/test/Transforms/LoopVectorize/AArch64/scalable-strict-fadd.ll
+78-90llvm/test/Transforms/LoopVectorize/AArch64/sve-interleaved-masked-accesses.ll
+61-66llvm/test/Transforms/LoopVectorize/AArch64/uniform-args-call-variants.ll
+13-43llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding.ll
+40-2llvm/test/Transforms/LoopVectorize/AArch64/sve2-histcnt.ll
+14-20llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-unroll.ll
+380-41622 files not shown
+438-63728 files

LLVM/project 6f27060clang/lib/CIR/Dialect/IR CIRTypes.cpp

fix fmt
DeltaFile
+4-4clang/lib/CIR/Dialect/IR/CIRTypes.cpp
+4-41 files

LLVM/project 5f22decclang/docs LanguageExtensions.rst ReleaseNotes.rst, clang/lib/Sema SemaChecking.cpp

Clang: Deprecate float support from __builtin_elementwise_max (#180885)

Now we have
  __builtin_elementwise_maxnum
  __builtin_elementwise_maximum
  __builtin_elementwise_maximumnum
DeltaFile
+17-0clang/test/Sema/builtins-elementwise-math.c
+13-1clang/lib/Sema/SemaChecking.cpp
+6-2clang/test/SemaCXX/builtins-elementwise-math.cpp
+4-4clang/docs/LanguageExtensions.rst
+3-0clang/docs/ReleaseNotes.rst
+1-1libclc/clc/lib/generic/math/clc_fdim.inc
+44-81 files not shown
+46-87 files

LLVM/project cc9f25dclang/include/clang/CIR/Dialect/IR CIRTypes.td CIRTypes.h, clang/lib/CIR/Dialect/IR CIRTypes.cpp

rename normalize AS function
DeltaFile
+3-3clang/lib/CIR/Dialect/IR/CIRTypes.cpp
+2-2clang/include/clang/CIR/Dialect/IR/CIRTypes.td
+1-1clang/include/clang/CIR/Dialect/IR/CIRTypes.h
+6-63 files

LLVM/project 62cfe16libc/src/__support/math acospif.h asinpif.h, libc/test/src/math acospif_test.cpp

[libc][math][c23] implement C23 `acospif` math function (#183661)

Implementing C23 `acospi` math function for single-precision with the
header-only approach that is followed since #147386
DeltaFile
+100-0libc/src/__support/math/acospif.h
+51-0libc/test/src/math/smoke/acospif_test.cpp
+8-41libc/src/__support/math/asinpif.h
+37-0libc/src/__support/math/inv_trigf_utils.h
+33-0libc/test/src/math/exhaustive/acospif_test.cpp
+29-0libc/test/src/math/acospif_test.cpp
+258-4125 files not shown
+429-6131 files

LLVM/project fb6b470libc/src/__support/math CMakeLists.txt floorf16.h, utils/bazel/llvm-project-overlay/libc BUILD.bazel

[libc][math] Refactor floor family to header-only (#182194)

Refactors the floor math family to be header-only.

Closes https://github.com/llvm/llvm-project/issues/182193

Target Functions:
  - floor
  - floorbf16
  - floorf
  - floorf128
  - floorf16
  - floorl
DeltaFile
+87-5utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+66-0libc/src/__support/math/CMakeLists.txt
+38-0libc/src/__support/math/floorf16.h
+29-0libc/src/__support/math/floor.h
+29-0libc/src/__support/math/floorf.h
+29-0libc/src/__support/math/floorf128.h
+278-518 files not shown
+505-7324 files

LLVM/project 8bd8d8ellvm/test/CodeGen/AMDGPU load-saddr-offset-imm.ll

[AMDGPU] Remove extra pipes from load-saddr-offset-imm.ll (#183874)

This test uses opt to run instcombin and then pipes that into llc which
has its output piped into FileCheck. Before this patch, the test also
piped in the source file into llc as well, which caused issues with a
downstream test executor that executes the lines in bash. However, these
extra pipes don't make sense anyways, so remove them.
DeltaFile
+4-4llvm/test/CodeGen/AMDGPU/load-saddr-offset-imm.ll
+4-41 files

LLVM/project c1f47d1llvm/test/CodeGen/AMDGPU llvm.exp10.f64.ll llvm.exp.f64.ll, llvm/test/CodeGen/X86 funnel-shift-i512.ll zero_extend_vector_inreg.ll

Rebase

Created using spr 1.3.7
DeltaFile
+11,178-0llvm/test/CodeGen/AMDGPU/llvm.exp10.f64.ll
+10,242-0llvm/test/CodeGen/AMDGPU/llvm.exp.f64.ll
+9,987-0llvm/test/CodeGen/AMDGPU/llvm.exp2.f64.ll
+5,445-0llvm/test/CodeGen/X86/funnel-shift-i512.ll
+1,389-1,365llvm/test/CodeGen/AMDGPU/amdgcn.bitcast.1024bit.ll
+1,094-1,106llvm/test/CodeGen/X86/zero_extend_vector_inreg.ll
+39,335-2,4711,401 files not shown
+96,876-32,1751,407 files

LLVM/project 5395d26llvm/lib/Target/WebAssembly WebAssemblyFixIrreducibleControlFlow.cpp

Revert "[WebAssembly] Incorporate SCCs into WebAssemblyFixIrreducibleControlFlow (#181755)" (#183872)

This reverts commit c05e323be7caaadff6fdd09a2336be60e3041af1.

Changes failed Emscripten tests.
DeltaFile
+135-150llvm/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp
+135-1501 files

LLVM/project 567d035clang/lib/Sema SemaTemplateDeduction.cpp

[clang] NFC: remove unused / untested workaround in pack deduction

This snippet was part of what was introduced in 130cc445e46836b28defdce03b1adfdb16ddcf41

However, none of the existing tests require it, including the tests added in
that commit.

One of those tests had a FIXME which was fixed when we switched
frelaxed-template-template-args on by default as well.
DeltaFile
+0-10clang/lib/Sema/SemaTemplateDeduction.cpp
+0-101 files

LLVM/project 1eb0496clang/include/clang/Basic DiagnosticSemaKinds.td, clang/lib/Sema SemaDeclAttr.cpp

[CUDA] Allow `extern __shared__` on non-array types

NVCC allows `extern __shared__` on any type, not just incomplete arrays.
This is commonly used in CUDA libraries like NCCL to overlay a struct on
dynamically-allocated shared memory:

    extern __shared__ ncclShmemData ncclShmem;

Previously, Clang rejected this with a hard error and did not add
`CUDASharedAttr` to the VarDecl. This caused a cascade: `IdentifyTarget()`
classified the variable as host-side, and any device code referencing it
got a spurious "reference to __host__ variable in __device__ function"
error.

Downgrade the error to a default-ignored warning (`-Wcuda-extern-shared`)
and always add `CUDASharedAttr` so the variable is correctly classified as
device-side. The old `err_cuda_extern_shared` is preserved for potential
future use.
DeltaFile
+40-9clang/test/SemaCUDA/extern-shared.cu
+4-3clang/lib/Sema/SemaDeclAttr.cpp
+4-0clang/include/clang/Basic/DiagnosticSemaKinds.td
+48-123 files

LLVM/project 342e446llvm/lib/Target/AMDGPU SIInsertWaitcnts.cpp

[AMDGPU][SIInsertWaitcnts] Move VCCZ workaround code out of the way (#182619)

This is a cleanup patch that moves the VCCZ specific workaround code
from `SIInsertWaitcnts::insertWaitcntInBlock()` to a separate class and
refactors it a bit to make it easier to read.
The end result is a simpler `insertWaitcntInBlock()`.

Should be NFC.
DeltaFile
+107-61llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
+107-611 files

LLVM/project 795cfaeclang/test/CIR/CodeGen builtin-floating-point.c object-size.c, clang/test/CIR/CodeGenBuiltins builtins-floating-point.c builtin-object-size.c

[CIR][NFC] Move some builtin tests to the CodeGenBuitins folder (#183607)

This moves a few tests that were created in the wrong location. Also
changes the names of some test files to maintain consistency.
DeltaFile
+2,176-54clang/test/CIR/CodeGenBuiltins/builtins-floating-point.c
+0-2,212clang/test/CIR/CodeGen/builtin-floating-point.c
+877-0clang/test/CIR/CodeGenBuiltins/builtin-object-size.c
+0-877clang/test/CIR/CodeGen/object-size.c
+636-0clang/test/CIR/CodeGenBuiltins/builtin-bit.cpp
+0-636clang/test/CIR/CodeGenBuiltins/builtin_bit.cpp
+3,689-3,77924 files not shown
+5,226-5,41430 files

LLVM/project 085569bllvm/lib/Transforms/InstCombine InstCombineSelect.cpp, llvm/test/Transforms/InstCombine select-and-or.ll

Fix profile metadata propagation in InstCombine select folding

Propagate profile metadata when folding select instructions with logical AND/OR conditions and when canonicalizing SPF to intrinsics. This fixes profile verification failures in Transforms/InstCombine/select-and-or.ll.
DeltaFile
+75-25llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+21-20llvm/test/Transforms/InstCombine/select-and-or.ll
+0-1llvm/utils/profcheck-xfail.txt
+96-463 files

LLVM/project 12e1075llvm/lib/Transforms/Vectorize SLPVectorizer.cpp, llvm/test/Transforms/SLPVectorizer extract-many-users-buildvector.ll

[SLP]Fix operand reordering when estimating profitability of operands

Need to swap operand for a single instruction, not for the the same lane
of the first and second instruction in the list
DeltaFile
+10-10llvm/test/Transforms/SLPVectorizer/extract-many-users-buildvector.ll
+10-4llvm/test/Transforms/SLPVectorizer/X86/non-schedulable-node-with-non-schedulable-parent.ll
+5-6llvm/test/Transforms/SLPVectorizer/X86/bv-root-part-of-graph.ll
+6-5llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+5-5llvm/test/Transforms/SLPVectorizer/X86/split-vectorize-gathered-def-after-use.ll
+36-305 files

LLVM/project fd9421clldb/examples/python formatter_bytecode.py

[lldb] Fix sys.path manipulation failure in formatter_bytecode.py (#183868)

Fix bug in #183804.
DeltaFile
+2-1lldb/examples/python/formatter_bytecode.py
+2-11 files

LLVM/project 74177d1clang/include/clang/AST APValue.h

Replace direct Elts access with a call to getMatrixElt
DeltaFile
+1-1clang/include/clang/AST/APValue.h
+1-11 files

LLVM/project e3c0454clang/cmake/modules AddClang.cmake, llvm/cmake/modules AddLLVM.cmake

[CMake] Propagate dependencies to OBJECT libraries in `add_llvm_library` (#183541)

Previously, transitively inherited calls to
`target_include_directories(foo SYSTEM ...)` were being squashed into a
flat list of includes, effectively stripping off `-isystem` and
unintentionally forwarding warnings from such dependencies.

To correctly propagate `SYSTEM` dependencies, use
`target_link_libraries` to forward the parent target's link dependencies
to the OBJECT library (similar to the `_static` flow below). Unlike a
flat `target_include_directories`, this lets CMake resolve transitive
SYSTEM include directories through the proper dependency chain.

Note that `target_link_libraries` on an OBJECT library propagates all
usage requirements, not just includes. This also brings in transitive
`INTERFACE_COMPILE_DEFINITIONS`, `INTERFACE_COMPILE_OPTIONS`, and
`INTERFACE_COMPILE_FEATURES`. This is arguably more correct, as the
OBJECT library compiles the same sources and should see the same flags.


    [13 lines not shown]
DeltaFile
+6-1llvm/cmake/modules/AddLLVM.cmake
+1-1clang/cmake/modules/AddClang.cmake
+1-1mlir/cmake/modules/AddMLIR.cmake
+8-33 files

LLVM/project cc81e68clang/test/AST/HLSL ast-dump-APValue-matrix.hlsl

Exercise int16, int64, half, double, and bool in APValue AST test

Assisted-by: claude-opus-4.6
DeltaFile
+33-1clang/test/AST/HLSL/ast-dump-APValue-matrix.hlsl
+33-11 files

LLVM/project 136ba6eclang/lib/Basic/Targets Hexagon.cpp Hexagon.h, clang/test/Preprocessor hexagon-predefines.c

[Hexagon] Define __HVX_IEEE_FP__ when -mhvx-ieee-fp is enabled (#183829)

Add a __HVX_IEEE_FP__ define when the compiler is invoked with
-mhvx-ieee-fp flag
DeltaFile
+13-0clang/test/Preprocessor/hexagon-predefines.c
+6-0clang/lib/Basic/Targets/Hexagon.cpp
+1-0clang/lib/Basic/Targets/Hexagon.h
+20-03 files

LLVM/project dc520a5mlir/lib/Dialect/GPU/IR ValueBoundsOpInterfaceImpl.cpp GPUDialect.cpp, mlir/test/Dialect/GPU value-bounds-op-interface-impl.mlir

[mlir][GPU] Add  ValueBoundsOphinterface to gpu.subgroup_broadcast (#183848)

This commit adds an ValueBoundsOpInterface to gpu.subgroup_broadcast,
matching its integer range interface implementation, so that affine
analysis can peek through subgroup broadcast ops.
DeltaFile
+38-0mlir/test/Dialect/GPU/value-bounds-op-interface-impl.mlir
+23-0mlir/lib/Dialect/GPU/IR/ValueBoundsOpInterfaceImpl.cpp
+5-4mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
+66-43 files

LLVM/project 2bd9760llvm/include/llvm/Transforms/Utils MemoryTaggingSupport.h, llvm/lib/Transforms/Instrumentation HWAddressSanitizer.cpp

[𝘀𝗽𝗿] initial version

Created using spr 1.3.7
DeltaFile
+205-213llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll
+11-16llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
+18-5llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+4-3llvm/test/CodeGen/AArch64/stack-tagging.ll
+0-4llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h
+238-2415 files

LLVM/project fcf2ba2llvm/include/llvm/Transforms/Utils MemoryTaggingSupport.h, llvm/lib/Transforms/Instrumentation HWAddressSanitizer.cpp

[𝘀𝗽𝗿] changes to main this commit is based on

Created using spr 1.3.7

[skip ci]
DeltaFile
+44-52llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll
+11-16llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
+18-5llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+4-3llvm/test/CodeGen/AArch64/stack-tagging.ll
+0-4llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h
+77-805 files

LLVM/project c78f37fclang/lib/CIR/CodeGen CIRGenCleanup.cpp, clang/test/CIR/CodeGen coro-task.cpp dtors.cpp

[CIR] Fix dominance problems with values defined in cleanup scopes (#183810)

We currently encounter dominance verification errors when a value is
defined inside a cleanup scope but used outside the scope. This occurs
when forceCleanup() is used to exit a cleanup scope while a variable is
holding a value that was created in the scope body. Classic codegen
solved this problem by passing a list of values to spill and reload to
forceCleanup(). This change implements that same solution for CIR.

I have also aligned the ScalarExprEmitter::VisitExprWithCleanups
implementation with that of classic codegen, eliminating an extra
lexical scope. This causes temporary allocas to be created at the next
higher existing lexical scope, but I think that's OK since they would be
hoisted there anyway by a later pass.
DeltaFile
+200-132clang/test/CIR/CodeGen/coro-task.cpp
+245-41clang/test/CIR/CodeGen/dtors.cpp
+20-42clang/test/CIR/CodeGen/lambda-static-invoker.cpp
+41-2clang/lib/CIR/CodeGen/CIRGenCleanup.cpp
+36-5clang/test/CIR/CodeGen/cleanup.cpp
+18-19clang/test/CIR/CodeGen/stmt-expr.cpp
+560-2416 files not shown
+599-29112 files

LLVM/project 07891abllvm/cmake/modules HandleLLVMOptions.cmake

[cmake] Disable -Wdangling-pointer on GCC 12+ (#183593)

GCC 12 started warning on the RAII DAGUpdateListener pattern in
SelectionDAG.h (storing `this` in the constructor). It's a false
positive -- suppress it the same way we handle -Wno-dangling-reference
(GCC 13+) and -Wno-stringop-overread (GCC 11+).
DeltaFile
+7-0llvm/cmake/modules/HandleLLVMOptions.cmake
+7-01 files

LLVM/project 329c52clldb/include/lldb/Host HostInfoBase.h, lldb/include/lldb/Initialization SystemInitializerCommon.h

[lldb] Change the way the shlib directory helper is set (#183637)

This PR changes the way we set the shlib directory helper. Instead of
setting it while initializing the Host plugin, we register it when
initializing the Python plugin. The motivation is that the current
approach is incompatible with the dynamically linked script
interpreters, as they will not have been loaded at the time the Host
plugin is initialized.

The downside of the new approach is that we set the helper after having
initialized the Host plugin, which theoretically introduces a small
window where someone could query the helper before it has been set.
Fortunately the window is pretty small and limited to when we're
initializing plugins, but it's less "pure" than what we had previously.
That said, I think it balances out with removing the plugin include.
DeltaFile
+27-8lldb/source/Host/common/HostInfoBase.cpp
+1-14lldb/source/API/SystemInitializerFull.cpp
+6-2lldb/include/lldb/Host/HostInfoBase.h
+2-4lldb/source/Initialization/SystemInitializerCommon.cpp
+1-4lldb/include/lldb/Initialization/SystemInitializerCommon.h
+2-2lldb/source/Host/windows/HostInfoWindows.cpp
+39-349 files not shown
+50-4615 files

LLVM/project 7886257llvm/lib/Analysis BasicAliasAnalysis.cpp

[NFC] Fix use-after-free: track TargetLibraryAnalysis in BasicAAResult invalidation (#183852)

`BasicAAResult` holds a reference to `TargetLibraryInfo` but its
`invalidate()` function did not check `TargetLibraryAnalysis`. When the
pass manager destroyed and re-created `TLI` (e.g. during `CGSCC`
invalidation or `FAM.clear()`), `BasicAAResult` survived with a dangling
`TLI` reference.

This was exposed by #157495 which added `aliasErrno()`, the first code
path that dereferences `TLI` from `BasicAAResult` during the `CGSCC`
pipeline, causing a AV when compiling Rust's core library on Arm64
Windows.

This change adds `TargetLibraryAnalysis` to the invalidation check so
`BasicAAResult` is properly invalidated when its `TLI` reference becomes
stale.
DeltaFile
+2-1llvm/lib/Analysis/BasicAliasAnalysis.cpp
+2-11 files