LLVM/project b7dc8e3llvm/include/llvm/ADT FoldingSet.h, llvm/lib/Support FoldingSet.cpp

[ADT] Simplify FoldingSetIterator (NFC) (#219073)

This patch simplifies FoldingSetIterator by defining it entirely in the
header without the type-erased FoldingSetIteratorImpl.

Now that FoldingSet uses an open-addressing hash table, we just have to
march through the entire bucket array while skipping empty slots.  It
does not make sense to call out-of-line advance().

This also reduces the .text section size of a release build of bin/clang
by 647 bytes (from 185,968,635 to 185,967,988 bytes).

Assisted-by: Antigravity
DeltaFile
+35-32llvm/include/llvm/ADT/FoldingSet.h
+0-17llvm/lib/Support/FoldingSet.cpp
+35-492 files

LLVM/project 01aedf3clang/include/clang/AST DeclCXX.h, clang/lib/AST DeclFriend.cpp

[C++20] [Modules] Load friends for classes in ADL (#219094)

Close https://github.com/llvm/llvm-project/issues/218228

The root cause of the problem is the corresponding friend is not loaded
at the point of ADL.

This patch tries to fix this simply by loading the friends at the point
of ADL. Note that this may be best efficient if there are a lot of
friends. We just think it is rare. If it is really possible, we can
change the structure of friends from a list to a name lookup table.
DeltaFile
+95-0clang/test/Modules/pr218228.cppm
+11-0clang/lib/Sema/SemaLookup.cpp
+9-0clang/lib/AST/DeclFriend.cpp
+4-0clang/include/clang/AST/DeclCXX.h
+119-04 files

LLVM/project 64a4895orc-rt/include CMakeLists.txt, orc-rt/include/orc-rt/bedrock Session.h SimpleRemoteCA.h

[orc-rt] Add SimpleRemoteCA, a SimpleRemote protocol base (#219093)

SimpleRemoteCA implements the transport-independent parts of the
SimpleRemote protocol: opcode and header validation, setup-message
encoding, hang-up encoding and decoding, pending-call tracking, and
completion of controller calls onto the Session::ControllerAccess
contract. Subclasses own wire framing and byte transport entirely --
they de-frame incoming messages and hand the header fields to
handleMessage, and build outgoing ones from the Opcode set and the
encode helpers.

Header validation rejects fields the protocol requires to be unset: a
Result may not carry a handler tag, a hang-up may not carry a sequence
number or tag. It does not interpret fields the protocol requires to be
present -- in particular a Call's handler tag is passed through as
given, since the executor's job is to jump where the controller tells it
to.

A hang-up carries a serialized Error giving the reason the session is

    [6 lines not shown]
DeltaFile
+291-0orc-rt/test/unit/SimpleRemoteCATest.cpp
+147-0orc-rt/lib/bedrock/SimpleRemoteCA.cpp
+114-0orc-rt/include/orc-rt/bedrock/SimpleRemoteCA.h
+14-12orc-rt/include/orc-rt/bedrock/Session.h
+1-0orc-rt/lib/bedrock/CMakeLists.txt
+1-0orc-rt/include/CMakeLists.txt
+568-121 files not shown
+569-127 files

LLVM/project dc222c2clang/lib/Serialization ASTReader.cpp, clang/test/Modules merge-target-features.cpp

[NFC][clang][Serialization] Fix std::set_difference sorting mismatch in ASTReader (#219053)

Fixes a `std::set_difference` sorting violation in
`ASTReader::checkTargetOptions` that causes a crash when building clang
with `LLVM_ENABLE_EXPENSIVE_CHECKS` on libstdc++.

`accumulateFeaturesAsWritten` sorts target features using a custom
comparator that strips the `+`/`-` prefix (i.e. comparing `A.substr(1) <
B.substr(1)`). However, `std::set_difference` was being called with the
default `std::string::operator<` comparator, which does not match the
sorting order because `+` (ASCII 0x2B) is less than `-` (ASCII 0x2D).
For example, `["-cx16", "+sse2"]` is correctly sorted according to the
custom comparator, but incorrectly sorted according to the default
lexicographical comparator.

This patch fixes the issue by passing the same custom comparator used
for sorting to both `std::set_difference` calls.

Fixes #219046.
DeltaFile
+22-0clang/test/Modules/merge-target-features.cpp
+9-4clang/lib/Serialization/ASTReader.cpp
+31-42 files

LLVM/project 814a6fcllvm/lib/Transforms/Vectorize SLPVectorizer.cpp, llvm/test/Transforms/SLPVectorizer/X86 reassoc-flattened-copyable-operand.ll phi-operand-gather-insert-point.ll

[SLP]Trim combined nodes only at their roots

Combined subnodes were added to the trimming worklist as independent
candidates, carrying their descendants' aggregated costs. Trimming such
a subnode on its own deleted operands still referenced by the combined
root, producing instructions that no longer dominated their uses.

Skip CombinedVectorize subnodes in subtree-cost aggregation and worklist
construction so only combined roots are evaluated as trim candidates.

Fixes #218974

Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/219095
DeltaFile
+125-0llvm/test/Transforms/SLPVectorizer/X86/phi-operand-gather-insert-point.ll
+10-12llvm/test/Transforms/SLPVectorizer/X86/reassoc-flattened-copyable-operand.ll
+10-1llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+145-133 files

LLVM/project 2ff334allvm/tools/llvm-profdata llvm-profdata.cpp

[lsan][llvm-profdata] Suppress leak check on abnormal exit (#219088)

This is common issue with lsan after exit().
`exit()` is no return, we can't expect that compiler
will preserve pointers to allocations done by callers.

Fixes new build bot report after upgrading base compiler to clang 23.1.0
https://lab.llvm.org/buildbot/#/builders/169/builds/26007
It probably has improved stack or registers re-use.
DeltaFile
+13-0llvm/tools/llvm-profdata/llvm-profdata.cpp
+13-01 files

LLVM/project b6016efflang/docs FlangDriver.md

[flang][docs] Mention --driver-mode=flang in FlangDriver.md (#207659)

This patch adds a description about the `--driver-mode=flang` flag.
The behavior will be ensured by #207658.

---------

Co-authored-by: Tarun Prabhu <tarunprabhu at gmail.com>
DeltaFile
+2-0flang/docs/FlangDriver.md
+2-01 files

LLVM/project c0bf6b1libc/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 ae34d72libc/src/signal/linux kill.cpp __restore.cpp, libc/src/stdio remove.h

[libc][bazel] Make a large swath of targets full-build compatible
DeltaFile
+1,245-48utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+1-2libc/src/signal/linux/__restore.cpp
+2-1libc/src/stdlib/atexit.cpp
+0-1libc/src/stdio/remove.h
+0-1libc/src/signal/linux/kill.cpp
+1,248-535 files

LLVM/project 28ef86futils/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 3a64a0futils/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 86440cccompiler-rt/lib/orc/tests CMakeLists.txt, compiler-rt/test/orc CMakeLists.txt

[compiler-rt][cmake] Change orc-rt target names (#216901)

When configured with `LLVM_ENABLE_RUNTIMES=compiler-rt;orc-rt`,
following two CMake errors occur.

```
CMake Error at llvm-project/llvm/cmake/modules/AddLLVM.cmake:2245 (add_custom_target):
  add_custom_target cannot create target "check-orc-rt" because another
  target with the same name already exists.  The existing target is a custom
  target created in source directory
  "llvm-project/compiler-rt/test/orc".  See documentation
  for policy CMP0002 for more details.
Call Stack (most recent call first):
  llvm-project/llvm/cmake/modules/AddLLVM.cmake:2326 (add_lit_target)
  llvm-project/orc-rt/test/CMakeLists.txt:24 (add_lit_testsuite)

CMake Error at llvm-project/orc-rt/test/unit/CMakeLists.txt:1 (add_custom_target):
  add_custom_target cannot create target "OrcRTUnitTests" because another
  target with the same name already exists.  The existing target is a custom

    [10 lines not shown]
DeltaFile
+3-3compiler-rt/lib/orc/tests/CMakeLists.txt
+1-1compiler-rt/test/orc/CMakeLists.txt
+4-42 files

LLVM/project 96f1eacllvm/tools/llvm-profdata llvm-profdata.cpp

format

Created using spr 1.3.7
DeltaFile
+1-3llvm/tools/llvm-profdata/llvm-profdata.cpp
+1-31 files

LLVM/project cb98cebllvm/tools/llvm-profdata llvm-profdata.cpp

[𝘀𝗽𝗿] initial version

Created using spr 1.3.7
DeltaFile
+15-0llvm/tools/llvm-profdata/llvm-profdata.cpp
+15-01 files

LLVM/project 9e9c593clang/lib/ScalableStaticAnalysis/SourceTransformation/Transformations CppBoundedBuffers.cpp, clang/test/Analysis/Scalable/source-edit-generation end-to-end-cpp-bounded-buffers.cpp

[SSAF][clang-reforge] Add end-to-end clang-reforge tests

- Make CppBoundedBuffers adapt to flattened WPA results;
- Let CppBoundedBuffers use qualified EntityNames so that it can
  associate ASTNodes with WPA results;
- Add end-to-end tests

Final step of:
rdar://185840466
DeltaFile
+623-0clang/test/Analysis/Scalable/source-edit-generation/end-to-end-cpp-bounded-buffers.cpp
+23-9clang/lib/ScalableStaticAnalysis/SourceTransformation/Transformations/CppBoundedBuffers.cpp
+22-4clang/unittests/ScalableStaticAnalysis/SourceTransformation/CppBoundedBuffersTest.cpp
+668-133 files

LLVM/project 5d88e02llvm/lib/Target/AMDGPU SIInsertHardClauses.cpp, llvm/test/CodeGen/AMDGPU spillv16.ll hard-clauses-gfx1250.mir

[AMDGPU] Do not clause mem ops in different scopes

That is for performance reasons as it it unlikely give any
performance benefit.
DeltaFile
+143-168llvm/test/CodeGen/AMDGPU/hard-clauses-gfx1250.mir
+2-10llvm/test/CodeGen/AMDGPU/GlobalISel/load-uniform-in-vgpr.ll
+2-5llvm/lib/Target/AMDGPU/SIInsertHardClauses.cpp
+1-2llvm/test/CodeGen/AMDGPU/spillv16.ll
+0-2llvm/test/CodeGen/AMDGPU/GlobalISel/load-zero-and-sign-extending-uniform-in-vgpr.ll
+148-1875 files

LLVM/project ad5c4a2clang/test/Analysis/Scalable/source-edit-generation write-failure.cpp coexistence.cpp, clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin TestTransformation.cpp

[SSAF] Fix stage-2 clang build error on TestTransformationPlugin

The plugin code defines the extern variable
SSAFTestTransformationAnchorSource, which is supposed to be used to
force static linking, so not needed here.

The variable definition should undoubtedly be removed, as doing so
solves the build issue locally. The explanation below regarding why
this variable causes the issue was provided by Claude. I repeatedly
asked Claude questions, and he revised his reasoning several times
until it became consistent. However, we should still take the
following explanation with a grain of salt:

ASan created a private alias symbol for the extern variable
SSAFTestTransformationAnchorSource. The linker, when in
'-flat_namespace' mode, treated the symbol as a name-based bind, which
later failed to be resolved through name searching by the loader.

rdar://185749574

    [2 lines not shown]
DeltaFile
+0-8clang/test/Analysis/Scalable/source-edit-generation/Plugins/TestTransformationPlugin/TestTransformation.cpp
+0-3clang/test/Analysis/Scalable/source-edit-generation/happy-path.cpp
+0-2clang/test/Analysis/Scalable/source-edit-generation/write-failure.cpp
+0-2clang/test/Analysis/Scalable/source-edit-generation/coexistence.cpp
+0-154 files

LLVM/project 979b722mlir/include/mlir/Dialect/OpenACC OpenACCOps.td, mlir/include/mlir/Dialect/WasmSSA/IR WasmSSAOps.td

[mlir][IR] Require inherent symbol attributes for Symbol operations (#218920)

Require SymbolTable operations to implement SymbolOpInterface and store
symbol names and visibility as inherent attributes.

Add missing symbol properties/interfaces to GPU, OpenACC, OpenMP, EmitC,
and Toy operations, and update affected tests and the GPU Python
builder.

Assisted-by: Codex
DeltaFile
+32-66mlir/lib/IR/SymbolTable.cpp
+71-15mlir/include/mlir/Dialect/WasmSSA/IR/WasmSSAOps.td
+26-45mlir/include/mlir/IR/SymbolInterfaces.td
+54-13mlir/include/mlir/IR/SymbolTable.h
+40-15mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
+32-18mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
+255-17295 files not shown
+719-481101 files

LLVM/project 4357422llvm/lib/Transforms/Vectorize VPlanRecipes.cpp, llvm/test/Transforms/LoopVectorize/RISCV partial-reduce-dot-product.ll partial-reduce.ll

[LV] Support EVL for partial reduction and VPExpressionRecipe. (#205741)

This patch adds the support for partial reduction with EVL tail-folding
by not creating a new VPExpressionEVLRecipes but just changing the last
expressionRecipes from VPReductionRecipe to VPReductionEVLRecipe.

Currently, all partial reductions will be converted to
VPExpressionRecipe
when construction. So this patch also supports the VPExpressionRecipe
for EVL.
DeltaFile
+950-0llvm/test/Transforms/LoopVectorize/VPlan/RISCV/reductions-evl.ll
+858-0llvm/test/Transforms/LoopVectorize/RISCV/partial-reduce-with-predicate.ll
+197-0llvm/test/Transforms/LoopVectorize/RISCV/partial-reduce.ll
+52-19llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+68-0llvm/test/Transforms/LoopVectorize/VPlan/RISCV/partial-reduce-dot-product.ll
+20-20llvm/test/Transforms/LoopVectorize/RISCV/partial-reduce-dot-product.ll
+2,145-393 files not shown
+2,197-539 files

LLVM/project 499e1fbbolt/lib/Core BinaryFunction.cpp, bolt/test/RISCV weak-undefined-tail-call.s

[BOLT][RISCV] Avoid evaluating indirect branches as direct branches (#218088)

The RISC-V branch evaluator can resolve JALR when the base register
state is known. In particular, jalr zero, zero, 0 evaluates to address
zero even though it remains an indirect branch.

Do not send indirect branches through the direct branch symbolization
path. Leave them to the existing indirect branch handling instead.

Add a regression test modeling a tail call to an undefined weak symbol
relaxed by GNU ld.
DeltaFile
+30-0bolt/test/RISCV/weak-undefined-tail-call.s
+2-1bolt/lib/Core/BinaryFunction.cpp
+32-12 files

LLVM/project 5fcbb2allvm/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 (#219004)
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 4832c44llvm/test/tools/UpdateTestChecks/update_test_checks dot_value_in_metadata_string.test

Drop extra blank line
DeltaFile
+0-1llvm/test/tools/UpdateTestChecks/update_test_checks/dot_value_in_metadata_string.test
+0-11 files

LLVM/project 7f707b7llvm/test/tools/UpdateTestChecks/update_test_checks dot_value_in_metadata_string.test

Update test checks to save on a copy
DeltaFile
+3-2llvm/test/tools/UpdateTestChecks/update_test_checks/dot_value_in_metadata_string.test
+3-21 files

LLVM/project a10e7d3clang/test/CodeGen/AArch64/neon intrinsics.c

[CIR][AARCH64] Fix neon conversion test (#219069)

This fixes the neon intrinsics test, which has been failing since a
recent change to introduce more conversion handling. The test had an
inadvertantly repeated CIR check.
DeltaFile
+1-1clang/test/CodeGen/AArch64/neon/intrinsics.c
+1-11 files

LLVM/project 97c6103llvm/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 (#218999)
DeltaFile
+703-168llvm/test/CodeGen/AMDGPU/llvm.amdgcn.cluster.load.ll
+527-71llvm/test/CodeGen/AMDGPU/llvm.amdgcn.cluster.load.async.to.lds.ll
+27-0llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+1,257-2393 files

LLVM/project 3d771f4.github/workflows release-binaries.yml, clang/cmake/caches Release.cmake

Revert "Revert "workflows/release-binaries: Disable flang on Darwin (#164667)"" (#218978)

Reverts llvm/llvm-project#216667

This change was ported to the `release/23.x` branch in #217059, and when
we created the first release that included this change (3.1.0), the job
for the MacOS ARM binaries was killed when the job hit the 6 hour mark.
Previous 3.1.0-rc release did not include this change and all completed
well within the 6 hour time out.

To enable the job that builds the release binaries to complete within
the allotted time, I am reverting this change which will essentially
disable flang from building on Darwin.

In the future if we get faster builders, we can explore re-enabling
building flang.
DeltaFile
+8-2clang/cmake/caches/Release.cmake
+0-7.github/workflows/release-binaries.yml
+8-92 files

LLVM/project f44ab0alld/ELF SyntheticSections.cpp

[ELF] Avoid repeated scans when merging strings

Build per-worker shard lists before inserting merge pieces. This keeps
each shard's input order deterministic while avoiding a full scan of every
piece by every worker. Reuse SectionPiece::outputOff for packed temporary
(section, piece) links.

Both the worker and shard counts are capped at 32,
as a result the auxiliary list storage is bounded at 16 KiB
regardless of the number of input sections.

Focused benchmark on Linux 6.16, Btrfs, 16 pinned CPUs, --threads=16. The
input is 16 copies of an object containing 2,000,000 identical mergeable
strings (32,000,000 pieces total) averaged across 20 runs and 3 warmups.
(RSS is the median)

              wall       CPU       RSS
  before      0.353 s    1.523 s    682.5 MiB
  after       0.343 s    1.167 s    682.7 MiB

    [7 lines not shown]
DeltaFile
+64-10lld/ELF/SyntheticSections.cpp
+64-101 files

LLVM/project 9e4cffaclang-tools-extra/clang-tidy/misc RedundantExpressionCheck.cpp, clang/lib/Analysis/LifetimeSafety LifetimeSafety.cpp

[llvm, clang] Remove unused includes of FoldingSet.h (NFC) (#219027)

None of these files use FoldingSet.
DeltaFile
+0-1llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
+0-1clang/lib/StaticAnalyzer/Checkers/TaggedUnionModeling.h
+0-1clang/lib/StaticAnalyzer/Checkers/StdVariantChecker.cpp
+0-1clang/lib/Sema/SemaInit.cpp
+0-1clang/lib/Analysis/LifetimeSafety/LifetimeSafety.cpp
+0-1clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
+0-66 files

LLVM/project 8fe5093mlir/lib/Dialect/Bufferization/Transforms OneShotAnalysis.cpp, mlir/lib/Dialect/Linalg/IR LinalgOps.cpp

[mlir][Linalg] Split explicit inherent/discardable attribute APIs access (#218916)

Migrate Linalg, Bufferization, and MemRef users to explicit discardable
or operation-specific attribute access, including the Linalg generator
and C API.

Assisted-by: Codex
DeltaFile
+43-29mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
+15-11mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
+19-5mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
+15-8mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
+9-12mlir/lib/Dialect/MemRef/Transforms/NormalizeMemRefs.cpp
+11-8mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
+112-7326 files not shown
+240-13432 files

LLVM/project 3428605llvm/include/llvm/TargetParser AMDGPUTargetParser.h, llvm/lib/TargetParser AMDGPUTargetParser.cpp

[AMDGPU] Add MaxHWAddressableLocalMemorySize to TargetParser (#219020)

This is to aid in resolving
https://github.com/ROCm/llvm-project/issues/3298 : "Comgr should use
target information from upstream TargetParser rather than maintaining
its own"
DeltaFile
+32-0llvm/unittests/TargetParser/TargetParserTest.cpp
+11-0llvm/lib/TargetParser/AMDGPUTargetParser.cpp
+7-0llvm/include/llvm/TargetParser/AMDGPUTargetParser.h
+2-1llvm/utils/TableGen/Basic/AMDGPUTargetDefEmitter.cpp
+1-1llvm/test/TableGen/AMDGPUTargetDefSubArchSpelling.td
+53-25 files