LLVM/project b3411b8llvm/docs ProgrammersManual.md, llvm/include/llvm/ADT FoldingSet.h

[FoldingSet] Switch to linear probing and Algorithm R deletion (#218190)

FoldingSet uses an inefficient chaining hash table. Switch to
linear-probing open addressing: the bucket array holds node pointers,
with null marking an empty slot. Deletion uses Knuth TAOCP 6.4 Algorithm
R, as DenseMap/StringMap do, so erase invalidates iterators while
leaving pointers to nodes valid.

The next-in-bucket pointer becomes a cached 32-bit hash, halving
FoldingSetNode. A probe compares it before the profile compare, and
FindNodeOrInsertPos returns it instead of a bucket address, so an
InsertPos survives intervening insertions.

https://discourse.llvm.org/t/rfc-modernizing-llvms-foldingset-open-addressing-with-swiss-table-and-algorithm-r/91637

LLM-aided

Co-authored-by: Kazu Hirata <kazu at google.com>
DeltaFile
+92-181llvm/lib/Support/FoldingSet.cpp
+54-56llvm/include/llvm/ADT/FoldingSet.h
+92-17llvm/unittests/ADT/FoldingSet.cpp
+5-4llvm/docs/ProgrammersManual.md
+243-2584 files

LLVM/project 319e731clang/include/clang/AST ASTContext.h, clang/lib/AST ASTContext.cpp

[clang] Shrink AutoTypes map key to reduce peak memory (#218278)

While looking for memory regressions, I found that #118288 caused
[CTRE](https://github.com/hanickadot/compile-time-regular-expressions)
to regress by ~9.5% in peak memory (+758 MB).

The fix is simple: use a reference to the FoldingSetNodeID in the map.

| | Max RSS |
| --- | --- |
| trunk | 8928 MB |
| this PR | **8347 MB (−6.5%)** |

[compile-time-tracker](

https://llvm-compile-time-tracker.com/compare.php?from=49de424f45389cb757c3cc8c50daf38d024e2314&to=0cf6a242f9b5a211f9dffd6b8f52aeeb3e91e508&stat=instructions)
DeltaFile
+17-1clang/include/clang/AST/ASTContext.h
+2-2clang/lib/AST/ASTContext.cpp
+19-32 files

LLVM/project c6bdaballvm/include/llvm/IR DebugInfoMetadata.h, llvm/lib/CodeGen/AsmPrinter DwarfUnit.cpp

[DebugInfo] Add DW_TAG_property support to LLVM DebugInfo (#215776)

DWARF v6 adds DW_TAG_property to represent an entity accessed like a
data member but implemented via an accessor, such as an Objective-C
@property backed by an ivar. This adds a DIProperty metadata node,
plumbs it through the IR (LLParser/AsmWriter, bitcode, DIBuilder,
Verifier), and emits DW_TAG_property/DW_AT_property_forward DIEs in
DwarfUnit, anchored on the accessor's own subprogram DIE.

This covers the LLVM IR and DWARF layers only; Clang emission and
LLDB consumption are left for follow-up patches.

Assisted-by: Claude
DeltaFile
+83-0llvm/include/llvm/IR/DebugInfoMetadata.h
+58-0llvm/test/DebugInfo/Generic/property.ll
+42-0llvm/unittests/IR/MetadataTest.cpp
+35-0llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+26-0llvm/lib/IR/LLVMContextImpl.h
+20-0llvm/test/Assembler/diproperty.ll
+264-020 files not shown
+435-126 files

LLVM/project 2a697daflang/lib/Optimizer/Transforms/CUDA CUFFunctionRewrite.cpp, flang/test/Fir/CUDA cuda-function-rewrite.mlir

[flang][cuda][NFC] Walk fir.call instead of greedy rewrite in CUFFunctionRewrite (#218513)

The pass only replaces on_device() calls with a constant. The greedy
pattern driver was extra work on every fir.call and also folded the
surrounding convert chain. Walk with IRRewriter instead, and check for
the i1 constant in the tests.

This reduce the footprint of the pass especially if there are many
fir.call ops.
DeltaFile
+13-23flang/lib/Optimizer/Transforms/CUDA/CUFFunctionRewrite.cpp
+20-10flang/test/Fir/CUDA/cuda-function-rewrite.mlir
+33-332 files

LLVM/project aca37b4llvm/lib/Target/AMDGPU SILoadStoreOptimizer.cpp AMDGPU.td, llvm/test/CodeGen/AMDGPU ds_write2.ll ds_read2-gfx1250.ll

[AMDGPU] Disable unaligned 2addr LDS operations in strict mode
DeltaFile
+326-161llvm/test/CodeGen/AMDGPU/ds_read2-gfx1250.ll
+149-75llvm/test/CodeGen/AMDGPU/ds_write2.ll
+12-2llvm/lib/Target/AMDGPU/DSInstructions.td
+8-0llvm/lib/Target/AMDGPU/AMDGPU.td
+6-1llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp
+501-2395 files

LLVM/project 226061bllvm/lib/Transforms/Vectorize SLPVectorizer.cpp, llvm/test/Transforms/SLPVectorizer/X86 reassoc-copyable-in-another-entry.ll

[SLP]Fix unscheduled-deps assertion for reassoc scalars covered by another entry's copyable data

The scheduler's reassociated-operand cleanup released the dependency
through copyable data of any entry's edge, so a dep registered for an
uncovered entry could go unreleased.

Fixes: #218850

Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/219010
DeltaFile
+76-0llvm/test/Transforms/SLPVectorizer/X86/reassoc-copyable-in-another-entry.ll
+16-2llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+92-22 files

LLVM/project 9131e72llvm/test/Analysis/CostModel/AArch64 fround-bf16.ll sve-fround.ll

[AArch64] Add cost tests for round intrinsics. NFC (#219008)
DeltaFile
+367-0llvm/test/Analysis/CostModel/AArch64/fround.ll
+316-0llvm/test/Analysis/CostModel/AArch64/sve-fround.ll
+127-0llvm/test/Analysis/CostModel/AArch64/fround-bf16.ll
+810-03 files

LLVM/project 9b9d90cclang/docs ReleaseNotes.md, clang/lib/CodeGen CGDecl.cpp

[Clang][CodeGen] Fix crash in EmitParmDecl for bodyless destructors with -fextend-variable-liveness (#218830)

The fake-use coroutine check in EmitParmDecl calls
FnDecl->getBody()->getStmtClass() without guarding against a null
getBody(). This crashes when processing implicit parameters (e.g.
should_call_delete) of MSVC deleting destructors whose base destructor
is only declared, not defined.
DeltaFile
+17-0clang/test/CodeGen/fake-use-msvc-dtor.cpp
+1-1clang/lib/CodeGen/CGDecl.cpp
+1-0clang/docs/ReleaseNotes.md
+19-13 files

LLVM/project d8f73ceutils/bazel MODULE.bazel.lock, utils/bazel/llvm-project-overlay/libc libc_build_rules.bzl

[libc][bazel] Add targets for startup objects

[libc][bazel] more startup object rules

[libc][bazel] Refactor internal_copts for libc_support_library
DeltaFile
+202-0utils/bazel/llvm-project-overlay/libc/startup/startup_rules.bzl
+104-0utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
+46-0utils/bazel/llvm-project-overlay/libc/startup/linux/x86_64/BUILD.bazel
+41-2utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
+3-0utils/bazel/llvm-project-overlay/libc/startup/BUILD.bazel
+1-1utils/bazel/MODULE.bazel.lock
+397-32 files not shown
+399-48 files

LLVM/project ab2c34bllvm/docs AMDGPUUsage.rst

[AMDGPU] Document gfx1250-strict. NFC
DeltaFile
+12-0llvm/docs/AMDGPUUsage.rst
+12-01 files

LLVM/project d61b93eclang/docs/analyzer checkers.md, clang/include/clang/StaticAnalyzer/Checkers Checkers.td

[clang][docs] Add documentation for the DanglingPtrDeref checker (#216688)

In order to move the `DanglingPtrDeref` checker out of alpha it needs a
documentation the user can get information from. This PR added the
documentation for the `DanglingPtrDeref` checker and follow up PR will
also do the same for the `UseAfterLifetimeEnd` checker. Currently the
documentation sits in the `alpha.core` category, but once we move the
checker out of alpha stage it should be changed as well.

AI-policy: After I have written the documentation I verified my
spellings, grammar with AI.
DeltaFile
+59-0clang/docs/analyzer/checkers.md
+1-1clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
+60-12 files

LLVM/project 179b292utils/bazel/llvm-project-overlay/libc libc_configure_options.bzl BUILD.bazel

[libc][bazel] Allow building with -DLIBC_FULL_BUILD

This PR defines a flag `--@llvm-project//libc:build_mode` that configures LLVM-libc to build with full-build flags. This is only compatible with clang at the moment, since it relies on the `-nostdlibinc` flag.
DeltaFile
+39-4utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
+22-5utils/bazel/llvm-project-overlay/libc/libc_configure_options.bzl
+22-5utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+83-143 files

LLVM/project c39d2fclibc/src/signal/linux kill.cpp __restore.cpp, libc/src/stdlib atexit.cpp at_quick_exit.cpp

[libc][bazel] Make a large swath of targets full-build compatible
DeltaFile
+1,412-45utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+1-2libc/src/signal/linux/__restore.cpp
+2-1libc/src/stdlib/atexit.cpp
+2-1libc/src/stdlib/at_quick_exit.cpp
+0-1libc/src/signal/linux/kill.cpp
+1,417-505 files

LLVM/project 229a6dfutils/bazel MODULE.bazel extensions.bzl

[libc][bazel] Add a repo with linux kernel UAPI headers

This will be used to support libc's -DFULL_BUILD option, which uses `-nostdlibinc` and thus requires a copy of linux kernel headers.
DeltaFile
+74-0utils/bazel/linux_uapi.bzl
+5-1utils/bazel/MODULE.bazel.lock
+2-0utils/bazel/extensions.bzl
+1-0utils/bazel/MODULE.bazel
+82-14 files

LLVM/project ca7de35llvm/lib/Transforms/Vectorize VectorCombine.cpp, llvm/test/Transforms/VectorCombine ext-extract-oob.ll

[VectorCombine] Reject out-of-bounds extract indexes in scalarizeExtExtract (#218984)

Fixes #218724.

An out-of-bounds `extractelement` produces poison in LLVM IR.
`VectorCombine::scalarizeExtExtract` currently matches constant-index
extracts without checking that the index is within the vector bounds.

For a sufficiently large out-of-bounds index, `scalarizeExtExtract` uses
the index to compute a shift amount for the packed integer
representation. The resulting constant can exceed the bitwidth of the
packed type, causing an `APInt` assertion in `ConstantInt::get`.

This patch adds a bounds check in `scalarizeExtExtract` and bails out
when the extract index is out of range, avoiding the invalid shift
construction.

The regression test uses the reduced reproducer from #218724.
DeltaFile
+18-0llvm/test/Transforms/VectorCombine/ext-extract-oob.ll
+4-0llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+22-02 files

LLVM/project 44ea65cllvm/lib/Transforms/Utils Local.cpp PromoteMemoryToRegister.cpp, llvm/test/Transforms/PhaseOrdering always-inline-alloca-promotion.ll

Re-apply "[PromoteMemToReg] Insert store undef when removing lifetime markers" (#218935)

Reapplies #191909 / reverts #218804

Re-apply as-is. The issues were downstream and have been since fixed.
DeltaFile
+190-0llvm/test/Transforms/SROA/lifetime-aware-phi.ll
+32-3llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+7-7llvm/test/Transforms/PhaseOrdering/ARM/arm_var_q31.ll
+2-4llvm/test/Transforms/PhaseOrdering/always-inline-alloca-promotion.ll
+3-0llvm/lib/Transforms/Utils/Local.cpp
+1-1llvm/test/Transforms/PhaseOrdering/ARM/arm_mean_q7.ll
+235-156 files

LLVM/project 2371da7llvm/lib/Target/AMDGPU GCNSubtarget.h AMDGPU.td, llvm/test/CodeGen/AMDGPU ds_write2.ll ds_read2-gfx1250.ll

[AMDGPU] Disable unaligned 2addr LDS operations in strict mode
DeltaFile
+326-161llvm/test/CodeGen/AMDGPU/ds_read2-gfx1250.ll
+149-75llvm/test/CodeGen/AMDGPU/ds_write2.ll
+12-2llvm/lib/Target/AMDGPU/DSInstructions.td
+6-1llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp
+4-0llvm/lib/Target/AMDGPU/GCNSubtarget.h
+4-0llvm/lib/Target/AMDGPU/AMDGPU.td
+501-2396 files

LLVM/project f69fbd6lldb/include/lldb/Host/linux Ptrace.h, lldb/source/Plugins/Process/Linux NativeRegisterContextLinux_loongarch64.cpp NativeThreadLinux.cpp

lldb: Linux: delete Ptrace.h pollyfill (#218045)

As the comment in sources alludes to:

> System includes - They have to be included after framework includes
because
> they define some macros which collide with variable names in other
modules.

These collisions would ideally not happen, but they are unlikely to be
fixed any time soon. The workaround is to define what we need in the
places that we need it. This was done in a previous commit and so the
header can now be removed.

Link: https://github.com/llvm/llvm-project/pull/217435
Fixes: https://github.com/llvm/llvm-project/issues/217413
DeltaFile
+0-18lldb/include/lldb/Host/linux/Ptrace.h
+4-3lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+5-2lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86.cpp
+5-2lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+3-3lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp
+5-1lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
+22-294 files not shown
+34-3410 files

LLVM/project 1150d84llvm/utils/TableGen/Common CodeGenDAGPatterns.cpp InfoByHwMode.cpp

[TableGen] Remove unnecessary sorts from writeToStream in InfoByHwMode subclasses. NFC (#218977)

The underlying map is already sorted by mode, so we can iterate over it.

---------

Co-authored-by: Kazu Hirata <kazu at google.com>
DeltaFile
+4-16llvm/utils/TableGen/Common/InfoByHwMode.cpp
+4-11llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
+8-272 files

LLVM/project cc92641llvm/test/Transforms/PhaseOrdering loop-vectorize-bfi.ll, llvm/test/Transforms/PhaseOrdering/RISCV any-of-vectorization.ll

Update phaseordering tests
DeltaFile
+5-5llvm/test/Transforms/PhaseOrdering/loop-vectorize-bfi.ll
+4-4llvm/test/Transforms/PhaseOrdering/RISCV/any-of-vectorization.ll
+9-92 files

LLVM/project 4392860libc/startup/linux/x86_64 tls.cpp, utils/bazel/llvm-project-overlay/libc libc_build_rules.bzl

[libc][bazel] Add targets for startup objects

[libc][bazel] more startup object rules

[libc][bazel] Refactor internal_copts for libc_support_library
DeltaFile
+202-0utils/bazel/llvm-project-overlay/libc/startup/startup_rules.bzl
+104-0utils/bazel/llvm-project-overlay/libc/startup/linux/BUILD.bazel
+46-0utils/bazel/llvm-project-overlay/libc/startup/linux/x86_64/BUILD.bazel
+41-2utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
+3-0utils/bazel/llvm-project-overlay/libc/startup/BUILD.bazel
+1-1libc/startup/linux/x86_64/tls.cpp
+397-31 files not shown
+398-37 files

LLVM/project a7847balibc/src/signal/linux kill.cpp __restore.cpp, libc/src/stdlib atexit.cpp at_quick_exit.cpp

[libc][bazel] Make a large swath of targets full-build compatible
DeltaFile
+1,412-45utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+1-2libc/src/signal/linux/__restore.cpp
+2-1libc/src/stdlib/atexit.cpp
+2-1libc/src/stdlib/at_quick_exit.cpp
+0-1libc/src/signal/linux/kill.cpp
+1,417-505 files

LLVM/project c07696ellvm/lib/Target/AMDGPU SIISelLowering.cpp, llvm/test/CodeGen/AMDGPU llvm.amdgcn.cluster.load.async.to.lds.ll llvm.amdgcn.cluster.load.ll

[AMDGPU] Downgrade cluster loads in strict mode
DeltaFile
+703-168llvm/test/CodeGen/AMDGPU/llvm.amdgcn.cluster.load.ll
+527-71llvm/test/CodeGen/AMDGPU/llvm.amdgcn.cluster.load.async.to.lds.ll
+26-0llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+1,256-2393 files

LLVM/project 12fc6cbllvm/lib/Target/WebAssembly/GISel WebAssemblyInstructionSelector.cpp, llvm/test/CodeGen/WebAssembly/GlobalISel/instructions global_value.ll load.ll

[WebAssembly][GlobalISel] Implement pointer and memory ops. (#206885)

Implements a variety of pointer and memory related ops
(`G_GLOBAL_VALUE`, `G_PTR_ADD`, `G_LOAD`, `G_STORE`, etc.).

Split from #157161

-----

TODO (in future PR)

- Move `G_PTRTOINT`, `G_INTTOPTR`, `G_PTRMASK` selection to tablegen
(for all targets)
- MAYBE try to shuffle `G_GLOBAL_VALUE` selection elsewhere (e.g.
legalizer). Doesn't seem worth it?
DeltaFile
+236-0llvm/test/CodeGen/WebAssembly/GlobalISel/instructions/store.ll
+220-0llvm/test/CodeGen/WebAssembly/GlobalISel/instructions/sextload.mir
+208-0llvm/test/CodeGen/WebAssembly/GlobalISel/instructions/zextload.mir
+198-0llvm/test/CodeGen/WebAssembly/GlobalISel/instructions/load.ll
+127-0llvm/test/CodeGen/WebAssembly/GlobalISel/instructions/global_value.ll
+123-3llvm/lib/Target/WebAssembly/GISel/WebAssemblyInstructionSelector.cpp
+1,112-312 files not shown
+1,720-1018 files

LLVM/project accdedbllvm/include/llvm/TargetParser AMDGPUTargetParser.h, llvm/lib/Target/AMDGPU AMDGPUSubtarget.cpp

Incorporate comments and rebase

Change-Id: I15da9851c0190f78f3f29f4e06f2669f087fd37e
DeltaFile
+3-22llvm/unittests/TargetParser/TargetParserTest.cpp
+0-12llvm/lib/TargetParser/AMDGPUTargetParser.cpp
+5-5llvm/tools/llvm-calc-occupancy/llvm-calc-occupancy.cpp
+5-5llvm/include/llvm/TargetParser/AMDGPUTargetParser.h
+4-4llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
+2-5llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
+19-535 files not shown
+27-6111 files

LLVM/project 5a60475.github/workflows release-binaries.yml

workflows/release-binaries: Update dispatch options for Windows (#218988)

This makes it possible to manually build the Windows binaries for
releases.
DeltaFile
+2-0.github/workflows/release-binaries.yml
+2-01 files

LLVM/project 38f92fcllvm/lib/TargetParser Triple.cpp, llvm/test/CodeGen/AMDGPU validate-subtarget-subarch.ll

AMDGPU: Touch up gfx1250-strict definition details (#218866)
DeltaFile
+38-4llvm/unittests/TargetParser/TargetParserTest.cpp
+12-0llvm/test/CodeGen/AMDGPU/validate-subtarget-subarch.ll
+4-3llvm/utils/TableGen/Basic/AMDGPUTargetDefEmitter.cpp
+7-0llvm/unittests/TargetParser/TripleTest.cpp
+3-3llvm/test/TableGen/AMDGPUTargetDefSubArchSpelling.td
+1-1llvm/lib/TargetParser/Triple.cpp
+65-113 files not shown
+68-149 files

LLVM/project 0c7045dllvm/include/llvm/DebugInfo/DWARF/LowLevel DWARFExpression.h, llvm/lib/DWARFLinker/Classic DWARFLinker.cpp

[DWARF] Add DW_OP_LLVM_NVIDIA_mux vendor extension as a subop of DW_OP_LLVM_user (#216314)

DW_OP_LLVM_NVIDIA_mux takes an LEB128 selector, giving NVIDIA an
extension space behind a single opcode in the DW_OP_LLVM_user space. The
selector is opaque to LLVM; no NVIDIA operation semantics are defined
here. This mux opcode is a subop of DW_OP_LLVM_user.

Assissted-by: LLM
DeltaFile
+82-0llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp
+61-0llvm/test/tools/llvm-dwarfutil/ELF/X86/Inputs/undecodable-expression.yaml
+18-0llvm/test/tools/llvm-debuginfo-analyzer/DWARF/undecodable-expression.test
+17-0llvm/test/tools/llvm-dwarfutil/ELF/X86/undecodable-expression.test
+11-3llvm/include/llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h
+13-0llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp
+202-34 files not shown
+242-410 files

LLVM/project 4373648llvm/test/Transforms/LoopVectorize/RISCV tail-folding-interleave.ll strided-accesses.ll

[VPlan][RISCV] Perform a simple version of LSR for EVL tail folded loops

With EVL tail folding the loop step is no longer loop-invariant after vectorization, so SCEV can't analyze it. This prevents LoopStrengthReduce from converting IV-based address calculations to loop-carried phis as before EVL tail folding: https://godbolt.org/z/e3oejca4Y

This adds a *very* simple version of LSR in VPlan that's run for EVL tail folded loops before the step is made unanalyzable by SCEV.

On rva23u64 the following C loop:

    for (int i = 0; i < n; i++)
        x[i]++;

goes from:

    .LBB0_2:
        sh2add  a3, a1, a0
        vsetvli a4, a2, e32, m2, ta, ma
        vle32.v v8, (a3)
        vadd.vi v8, v8, 1
        sub     a2, a2, a4

    [16 lines not shown]
DeltaFile
+196-152llvm/test/Transforms/LoopVectorize/RISCV/interleaved-accesses.ll
+266-0llvm/test/Transforms/LoopVectorize/RISCV/strength-reduce-addrs.ll
+95-90llvm/test/Transforms/LoopVectorize/RISCV/tail-folding-bin-unary-ops-args.ll
+82-79llvm/test/Transforms/LoopVectorize/RISCV/reductions.ll
+71-76llvm/test/Transforms/LoopVectorize/RISCV/strided-accesses.ll
+77-68llvm/test/Transforms/LoopVectorize/RISCV/tail-folding-interleave.ll
+787-46568 files not shown
+1,994-1,51774 files

LLVM/project 8452e5elibcxx/src/support new.ipp

[libc++][NFC] Add clarifying comment on dangling macro defininition (#215883)

Since we #error immediately before, a comment is needed to explain the
purpose of the define.
DeltaFile
+1-1libcxx/src/support/new.ipp
+1-11 files