LLVM/project 36fe08aclang/test/CIR/lib/Analysis CMakeLists.txt, mlir/test/lib/Analysis CMakeLists.txt

[MLIR][CIR][NFCI] Split TestAliasAnalysis into its own library (#222174)

This is a target for the CIR alias analysis, and bringing in all of the
MLIRTestAnalysis is too heavy: it results in a significant increase in
CIR test size. This patch, plus a few little things, gets us ~850 edges
removed from the Clang Build (after Medhi's patches).

This also has CIR use it.
DeltaFile
+20-1mlir/test/lib/Analysis/CMakeLists.txt
+1-1clang/test/CIR/lib/Analysis/CMakeLists.txt
+21-22 files

LLVM/project c363b39llvm/lib/Transforms/Vectorize SLPVectorizer.cpp

[SLP] NFC: Remove redundant expression from getBuildVectorCost (#222547)

Gathers is initialized with the contents from VL and then not modified,
so `VL.equals(Gathers)` is always true.
DeltaFile
+3-6llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+3-61 files

LLVM/project c69a5eblibcxx/include/__utility declval.h

[libc++] Simplify the implementation of std::declval (#222303)

The implementation of `std::declval` calling `__declval` was originally
introduced for improved compile times. However, we now have a builtin
for `add_rvalue_reference`, which makes the old implementation faster
again, since we avoid instantiating any class types _and_ avoid overload
resolution.
DeltaFile
+4-8libcxx/include/__utility/declval.h
+4-81 files

LLVM/project 14789f7orc-rt/test/regression lit.cfg.py, orc-rt/test/regression/darwin check-rt-process-info.test

[orc-rt] Generalize testcases for different target archs (#222629)

Drop the hard-coded archs from the check-rt-process-info testcases.
Instead, check against an arch value derived from the build's target
triple.
DeltaFile
+3-3orc-rt/test/regression/darwin/check-rt-process-info.test
+3-2orc-rt/test/regression/linux/check-rt-process-info.test
+4-0orc-rt/test/regression/lit.cfg.py
+10-53 files

LLVM/project 3ec60e8libc/src/stdio/gpu vfprintf_utils.h

[libc] Optimize the GPU printf implementation with size hints (#222474)

Summary:
The GPU printf interface is functionally a shim to pass a `va_list` and
format string to the CPU for formatting. The size of the argument list
isn't exposed by the C ABI, but we can use `__builtin_object_size` to
try to look it up. This will bind to the `alloca` holding our arguments
in the ABI and return a positive size if it is known.

We do this opportunistically, as the check is lossy. In cases where it
is known, this saves a stack spill to store the true size. Additionally,
we can use this to detect cases where `printf` is being used as a simple
`puts`.

This saves 10 VGPRs for the `printf("string")` case. It also saves 8
bytes of stack in most all cases.
DeltaFile
+6-1libc/src/stdio/gpu/vfprintf_utils.h
+6-11 files

LLVM/project 30f6f86llvm/test/CodeGen/X86 min-legal-vector-width.ll inline-asm-pr76416.ll

RegisterPressure: Remove dead defs correctly

When an instruction has overlapping register defs where only some carry the
dead flag (for example a dead super-register def alongside a live sub-register
def), the collector left the shared register units in both the live and dead def
sets. That produced a PressureDiff decrement with no matching increment and tripped
the "PSet overflow/underflow" assertion in getUpwardPressureDelta.

A register unit is dead if any def covering it is dead, regardless of operand
order. Reconcile by subtracting the dead defs from the live defs instead of the
reverse: removeRegLanes only clears the overlapping units, so a def keeps any
units a dead def does not cover.

Fixes #155807.
Fixes #149144.
Fixes #76416.
Fixes #205272.

Co-authored-by: XChy <xxs_chy at outlook.com>
Co-authored-by: Claude claude-opus-4.8 <noreply at anthropic.com>
DeltaFile
+233-216llvm/test/CodeGen/X86/masked-udiv.ll
+106-89llvm/test/CodeGen/X86/vector-idiv-strictfp.ll
+72-60llvm/test/CodeGen/X86/vector-idiv-udiv-512.ll
+42-40llvm/test/CodeGen/X86/udiv_fix_sat.ll
+75-0llvm/test/CodeGen/X86/inline-asm-pr76416.ll
+35-35llvm/test/CodeGen/X86/min-legal-vector-width.ll
+563-4409 files not shown
+709-47215 files

LLVM/project 0afee5ccompiler-rt/lib/tsan/rtl tsan_interceptors_mac.cpp, compiler-rt/test/tsan/Darwin os_unfair_lock_deadlock.c trylock_no_deadlock.c

[Darwin][TSan] Use deadlock detector aware calls for Darwin-specific lock interceptors (#216040)

Currently the deadlock detector is unaware of these lock types because
the interceptors use bare Acquire-Release calls. This patch switches
them over to the Mutex(Pre|Post)Lock calls instead.

Assisted by: Claude

rdar://155410097
DeltaFile
+93-0compiler-rt/test/tsan/Darwin/trylock_no_deadlock.c
+39-0compiler-rt/test/tsan/Darwin/os_unfair_lock_deadlock.c
+16-11compiler-rt/lib/tsan/rtl/tsan_interceptors_mac.cpp
+148-113 files

LLVM/project 21d80e8orc-rt/include/orc-rt-c/support Logging.h

[orc-rt] Remove redundant extern keyword. (#222619)

orc_rt_log_OSLogHandles is already extern via ORC_RT_C_EXPORT.
DeltaFile
+1-2orc-rt/include/orc-rt-c/support/Logging.h
+1-21 files

LLVM/project bf86a77offload/include device.h, offload/libompaccsupport device.cpp

[offload][omp] Move strict threads & groups computation to libomptarget
DeltaFile
+178-3offload/libompaccsupport/device.cpp
+0-147offload/plugins-nextgen/common/src/PluginInterface.cpp
+9-63offload/plugins-nextgen/common/include/PluginInterface.h
+40-1offload/include/device.h
+9-9offload/test/offloading/ompx_bare_gridsize.c
+1-1offload/test/offloading/ompx_bare_multi_dim.cpp
+237-2242 files not shown
+238-2278 files

LLVM/project b3eab3amlir/include/mlir/Dialect/LLVMIR LLVMIntrinsicOps.td, mlir/lib/Conversion/VectorToLLVM ConvertVectorToLLVM.cpp

[mlir][vector] Fix mask neutral value for masked fmaximum/fminimum reductions (#222275)

Masked maximumf/minimumf reductions were lowered by replacing inactive
lanes with a neutral value before applying an unmasked reduction. The
maximumf neutral was incorrectly set to the negative subnormal closest
to zero, causing it to beat any negative active value. Similarly,
minimumf used FLT_MAX, which loses to an active +Inf.
This change adds LLVM dialect support for
llvm.vp.reduce.fmaximum/fminimum and lowers masked reductions directly
to these predicated intrinsics.
DeltaFile
+84-62mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
+119-0mlir/test/Integration/Dialect/Vector/CPU/reductions-masked-minmax-f32.mlir
+64-8mlir/test/Conversion/VectorToLLVM/vector-reduction-to-llvm.mlir
+8-0mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
+6-0mlir/test/Target/LLVMIR/Import/intrinsic.ll
+2-0mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
+283-706 files

LLVM/project c61df43offload/include device.h, offload/libompaccsupport PluginManager.cpp

[offload][omp] Move reading _kernel_environment to libomptarget
DeltaFile
+57-64offload/plugins-nextgen/common/include/PluginInterface.h
+26-47offload/plugins-nextgen/common/src/PluginInterface.cpp
+66-0offload/libompaccsupport/PluginManager.cpp
+19-0offload/include/device.h
+9-2offload/plugins-nextgen/cuda/src/rtl.cpp
+0-6offload/plugins-nextgen/host/src/rtl.cpp
+177-1193 files not shown
+185-1209 files

LLVM/project 3eeb9b2flang/include/flang/Optimizer/Support AllocationPolicy.h, flang/include/flang/Optimizer/Transforms AllocationPlacementPolicy.h

[flang] add AllocationPolicy attribute to module and use it in InlineHLFIRCopy (#222013)

The StackArrays/AllocationPlacement pass cannot move fir.allocmem
created during InlineHLFIRCopy for the copy-in/cop-out buffers because
of there placement in branches.

Moving these allocmem outside of the branches is suboptimal as these
allocations may never occur at runtime (when the data is actually
already contiguous).
Extending the StackArrays pass is doable but very tedious (the data flow
analysis passes used in the pass cannot recognized "same
predicates"/understand that the two fir.if block that
allocate/deallocates will be both reached or never reached (even when
modifying InlineHLFIRCopy to use the same SSA value for both fir.if). So
this requires custom logic, and was adding 200 lines of non trivial code
to audit and I did not like it.

I decided to expose the allocation policy so that other passes can rely
on it. To make it the most flexible and future proof this is done via a

    [15 lines not shown]
DeltaFile
+146-0flang/include/flang/Optimizer/Support/AllocationPolicy.h
+130-0flang/test/HLFIR/inline-hlfir-copy-stack.fir
+119-0flang/lib/Optimizer/Support/AllocationPolicy.cpp
+102-16flang/lib/Optimizer/HLFIR/Transforms/InlineHLFIRCopy.cpp
+0-90flang/include/flang/Optimizer/Transforms/AllocationPlacementPolicy.h
+14-56flang/lib/Optimizer/Transforms/AllocationPlacement.cpp
+511-16218 files not shown
+766-20724 files

LLVM/project cb46e85llvm/lib/ExecutionEngine/JITLink ELF_riscv.cpp, llvm/test/ExecutionEngine/JITLink/RISCV ELF_relax_many_align.s

[JITLink][RISCV] Avoid quadratic removal of alignment edges (#222317)

We encountered this issue while using BOLT to instrument clang on
RISC-V. JITLink spent significant time removing alignment edges during
relaxation finalization in large code blocks with many alignment
relocations.

During RISC-V relaxation finalization, finalizeBlockRelax removes
AlignRelaxable edges individually from a block's edge vector. Each erase
shifts the remaining suffix, making this cleanup quadratic when the
number of alignment edges grows with the total edge count.

Compact surviving edges once and remove the trailing entries from the
back, preserving edge order and making cleanup linear. Count the
trailing entries before erasing to avoid comparing an invalidated
iterator.


These results support the performance benefit, but they come from

    [9 lines not shown]
DeltaFile
+29-0llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_many_align.s
+9-6llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
+38-62 files

LLVM/project 46f9c22llvm/test/Transforms/Scalarizer bitcast-scalar-to-vector.ll bitcast-vector-to-scalar.ll

[Scalarizer] Update tests to use update_test_checks.py (#222460)

This PR is to address feedback on this comment:
https://github.com/llvm/llvm-project/pull/221033#discussion_r3973313815

requesting the tests use utils/update_test_checks.py instead.
DeltaFile
+24-18llvm/test/Transforms/Scalarizer/bitcast-vector-to-scalar.ll
+14-12llvm/test/Transforms/Scalarizer/bitcast-scalar-to-vector.ll
+38-302 files

LLVM/project cc45d4fllvm/test/Analysis/CostModel/X86 clmul.ll

[CostModel][X86] clmul.ll - add test coverage for vpclmulqdq targets (#222610)
DeltaFile
+48-23llvm/test/Analysis/CostModel/X86/clmul.ll
+48-231 files

LLVM/project 05d870boffload/include device.h, offload/libompaccsupport device.cpp

[offload][omp] Move strict threads & groups computation to libomptarget
DeltaFile
+177-3offload/libompaccsupport/device.cpp
+0-147offload/plugins-nextgen/common/src/PluginInterface.cpp
+7-63offload/plugins-nextgen/common/include/PluginInterface.h
+40-1offload/include/device.h
+9-9offload/test/offloading/ompx_bare_gridsize.c
+1-1offload/test/offloading/ompx_bare_multi_dim.cpp
+234-2242 files not shown
+235-2278 files

LLVM/project f47cf93offload/include device.h, offload/libompaccsupport PluginManager.cpp

[offload][omp] Move reading _kernel_environment to libomptarget
DeltaFile
+57-64offload/plugins-nextgen/common/include/PluginInterface.h
+26-47offload/plugins-nextgen/common/src/PluginInterface.cpp
+66-0offload/libompaccsupport/PluginManager.cpp
+19-0offload/include/device.h
+9-2offload/plugins-nextgen/cuda/src/rtl.cpp
+3-6offload/plugins-nextgen/common/src/RecordReplay.cpp
+180-1193 files not shown
+187-1259 files

LLVM/project f880fc1llvm/lib/Target/AMDGPU SIFixSGPRCopies.cpp

review: record the call in run to avoid re-scanning
DeltaFile
+12-13llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
+12-131 files

LLVM/project 19a9fd6llvm/lib/Target/AMDGPU SIFixSGPRCopies.cpp, llvm/test/CodeGen/AMDGPU ds_read2.ll merge-m0.mir

[AMDGPU] Don't merge M0 initializations across calls that clobber M0
DeltaFile
+133-0llvm/test/CodeGen/AMDGPU/merge-m0.mir
+18-5llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
+1-0llvm/test/CodeGen/AMDGPU/ds_read2.ll
+152-53 files

LLVM/project e4d4083llvm/include/llvm/Transforms/Utils CodeExtractor.h, llvm/lib/Frontend/OpenMP OMPIRBuilder.cpp

[OpenMP] Give the device shared memory allocations a debug location. (#221842)

Fixes https://github.com/llvm/llvm-project/issues/221831.

In generic mode on the device, the buffers that carry values into an
outlined region come from device shared memory rather than the stack, so
they are emitted as calls to `__kmpc_alloc_shared` and
`__kmpc_free_shared`. Those are definitions in the DeviceRTL, which
makes them inlinable calls, and the verifier requires an inlinable call
in a function with debug info to carry a !dbg location. None of these
calls had one, for two separate reasons.

1. `allocateVar()` and `deallocateVar()` took a bare insertion point, so
an override had no debug location to set on the runtime calls it emits
in place of the alloca the base class would have created. Fixed by
adding a `DebugLoc` parameter that carries one.

2. The `createOMPAllocShared `and `createOMPFreeShared` calls in
`createParallel` relied on the implicit conversion from an insertion

    [8 lines not shown]
DeltaFile
+43-0mlir/test/Target/LLVMIR/omptarget-debug-shared-alloc-loc.mlir
+20-15llvm/lib/Transforms/Utils/CodeExtractor.cpp
+14-7llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+4-2llvm/include/llvm/Transforms/Utils/CodeExtractor.h
+81-244 files

LLVM/project 11cf968llvm/utils/LLVMVisualizers llvm.natvis

[NATVIS] Fix ConstantInt APInt value access (#221719)

Ensure we peek through the APInt::U VAL / *pVal union
DeltaFile
+1-1llvm/utils/LLVMVisualizers/llvm.natvis
+1-11 files

LLVM/project 73f0077clang/lib/AST/ByteCode Compiler.cpp Pointer.h

Revert "[clang][bytecode] Use opaque pointers for decl-based dummy pointers" (#222599)

Reverts llvm/llvm-project#220917

Looks like this breaks some memory-sanitizier builders:
https://lab.llvm.org/buildbot/#/builders/169/builds/26405
https://lab.llvm.org/buildbot/#/builders/164/builds/25236
DeltaFile
+32-186clang/lib/AST/ByteCode/Interp.cpp
+27-80clang/lib/AST/ByteCode/Interp.h
+13-69clang/lib/AST/ByteCode/Pointer.cpp
+18-39clang/lib/AST/ByteCode/InterpBuiltin.cpp
+8-29clang/lib/AST/ByteCode/Pointer.h
+7-12clang/lib/AST/ByteCode/Compiler.cpp
+105-4158 files not shown
+123-44414 files

LLVM/project 38fb876llvm/lib/Transforms/Vectorize LoopVectorize.cpp

[LV][NFC] Move up getEpilogueTailLowering() (#222358)

This patch only moves up `getEpilogueTailLowering()` so that it can be
used by `planForEpilogueTF` as needed here: https://github.com/llvm/llvm-project/pull/208764
DeltaFile
+73-72llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+73-721 files

LLVM/project 26012d6llvm/test/Analysis/CostModel/X86 pdep.ll pext.ll

[CostModel][X86] Add baseline cost test for pdep/pext intrinsics (#222603)

Slow pdep/pext targets in particular are highly inaccurate
DeltaFile
+154-0llvm/test/Analysis/CostModel/X86/pdep.ll
+154-0llvm/test/Analysis/CostModel/X86/pext.ll
+308-02 files

LLVM/project 97d570doffload/include device.h, offload/libompaccsupport device.cpp

[offload][omp] Move strict threads & groups computation to libomptarget
DeltaFile
+177-3offload/libompaccsupport/device.cpp
+0-147offload/plugins-nextgen/common/src/PluginInterface.cpp
+7-63offload/plugins-nextgen/common/include/PluginInterface.h
+40-1offload/include/device.h
+9-9offload/test/offloading/ompx_bare_gridsize.c
+1-1offload/test/offloading/ompx_bare_multi_dim.cpp
+234-2242 files not shown
+235-2278 files

LLVM/project 3d08f9doffload/include device.h, offload/libompaccsupport PluginManager.cpp

[offload][omp] Move reading _kernel_environment to libomptarget
DeltaFile
+57-64offload/plugins-nextgen/common/include/PluginInterface.h
+26-47offload/plugins-nextgen/common/src/PluginInterface.cpp
+64-0offload/libompaccsupport/PluginManager.cpp
+19-0offload/include/device.h
+9-2offload/plugins-nextgen/cuda/src/rtl.cpp
+3-6offload/plugins-nextgen/common/src/RecordReplay.cpp
+178-1192 files not shown
+179-1258 files

LLVM/project abf3bd6clang/lib/CodeGen CGBuiltin.cpp, clang/test/DebugInfo/CXX verbose-trap.cpp

[clang][DebugInfo] Fix verbose trap source line (#222456)

The artificial inline location for `__builtin_verbose_trap` used line
zero. As a result, the emitted trap could inherit the preceding source
line in DWARF line tables.

Keep the artificial trap-message frame while assigning the builtin
call's line and column to the trap instruction.
DeltaFile
+4-4clang/test/DebugInfo/CXX/verbose-trap.cpp
+7-1clang/lib/CodeGen/CGBuiltin.cpp
+11-52 files

LLVM/project 365ad50llvm/lib/Transforms/Vectorize SLPVectorizer.cpp, llvm/lib/Transforms/Vectorize/SLPVectorizer SLPUtils.h SLPUtils.cpp

[SLP][modularisation][NFC] Move loop trip-count helpers to SLPUtils

Move the BoUpSLP-independent helpers findInnermostNonInvariantLoop and
getLoopTripCount out of SLPVectorizer.cpp into the self-contained
SLPVectorizer/SLPUtils.{h,cpp} module. getLoopTripCount reads the file-local
LoopAwareTripCount cl::opt, which stays static in SLPVectorizer.cpp and is
passed to the moved helper as an explicit parameter. NFC.

Part of the SLPVectorizer.cpp modularization effort:
https://discourse.llvm.org/t/modularizing-slpvectorizer-cpp/90922
DeltaFile
+2-34llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+33-0llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPUtils.cpp
+11-0llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPUtils.h
+46-343 files

LLVM/project 462e817clang/include/clang/Basic BuiltinsAMDGPU.td BuiltinsAMDGPUDocs.td, clang/test/CodeGenOpenCL builtins-amdgcn-gfx13-w32-err.cl builtins-amdgcn-gfx13-err.cl

[AMDGPU] Add intrinsics and builtins for v_cvt_scale_pk32_* instructions
DeltaFile
+1,308-0llvm/test/CodeGen/AMDGPU/llvm.amdgcn.cvt.scale.pk32.gfx13.ll
+60-0clang/include/clang/Basic/BuiltinsAMDGPUDocs.td
+58-0clang/test/CodeGenOpenCL/builtins-amdgcn-gfx13.cl
+26-0clang/test/CodeGenOpenCL/builtins-amdgcn-gfx13-err.cl
+24-0clang/include/clang/Basic/BuiltinsAMDGPU.td
+20-0clang/test/CodeGenOpenCL/builtins-amdgcn-gfx13-w32-err.cl
+1,496-07 files not shown
+1,546-913 files

LLVM/project fcd2f4allvm/lib/Transforms/Vectorize SLPVectorizer.cpp, llvm/lib/Transforms/Vectorize/SLPVectorizer SLPReductionUtils.h SLPReductionUtils.cpp

[SLP][modularisation][NFC] Move getReductionInstr/getAggregateSize to SLPReductionUtils

Move the BoUpSLP-independent helpers getReductionInstr and getAggregateSize
out of SLPVectorizer.cpp into the self-contained
SLPVectorizer/SLPReductionUtils.{h,cpp} module.

Part of the SLPVectorizer.cpp modularization effort:
https://discourse.llvm.org/t/modularizing-slpvectorizer-cpp/90922
DeltaFile
+0-79llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+77-0llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPReductionUtils.cpp
+16-0llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPReductionUtils.h
+93-793 files