LLVM/project d64b699llvm/lib/Target/AMDGPU GCNCreateVOPD.cpp, llvm/test/CodeGen/AMDGPU vopd3-imm-fold.ll bf16.ll

[AMDGPU] Form VOPD3 pairs with pair-local literal moves

This PR lets GCNCreateVOPD form a VOPD3 pair when its components use one
distinct non-inline constant. VOPD3 cannot encode literal operands, but src0
can read scalar registers, so we move the value to a free SGPR. If both
components use the same value, one move serves both.

We reject pairs that need two values because two moves add more instructions
than one fusion removes. We also reject functions without tracked liveness and
functions optimized for size.

We use one reverse liveness walk to find an SGPR that is free over each
pair-local range. We exclude reserved registers and VCC. Disjoint selected
pairs can reuse the same SGPR, and each accepted pair adds at most one
S_MOV_B32 for the one instruction removed by fusion.

When overlapping candidates form the same number of pairs, we prefer the set
that needs fewer scalar moves. We keep pair count as the primary objective.


    [2 lines not shown]
DeltaFile
+383-393llvm/test/CodeGen/AMDGPU/llvm.amdgcn.permlane.ll
+326-308llvm/test/CodeGen/AMDGPU/float-to-arbitrary-fp-fp8-hw.ll
+433-0llvm/test/CodeGen/AMDGPU/vopd3-imm-fold.mir
+225-181llvm/test/CodeGen/AMDGPU/bf16.ll
+373-0llvm/test/CodeGen/AMDGPU/vopd3-imm-fold.ll
+201-26llvm/lib/Target/AMDGPU/GCNCreateVOPD.cpp
+1,941-90847 files not shown
+3,280-2,06253 files

LLVM/project 3590b62llvm/lib/Target/AMDGPU GCNVOPDUtils.cpp GCNVOPDUtils.h

[NFC][AMDGPU] Separate VOPD candidate selection

This PR separates VOPD candidate matching from selection without changing
generated code.

GCNCreateVOPD used to choose a pair as soon as tryMatchVOPDPair found one.
That made matching and selection one operation: the first match consumed both
instructions before later work could decide whether the pair was usable.

We now record matches in program order, collect every adjacent candidate, and
select the same greedy non-overlapping set in a separate step.

This gives later changes a place to reject or rank a candidate without hiding
an overlapping pair that uses its second instruction.
DeltaFile
+36-39llvm/lib/Target/AMDGPU/GCNCreateVOPD.cpp
+12-7llvm/lib/Target/AMDGPU/GCNVOPDUtils.h
+2-2llvm/lib/Target/AMDGPU/GCNVOPDUtils.cpp
+50-483 files

LLVM/project 33c6066llvm/test/CodeGen/RISCV/GlobalISel rv64zbkb.ll

[RISCV][GISel] Remove stale FIXMEs from rv64zbkb.ll. NFC (#224156)
DeltaFile
+0-3llvm/test/CodeGen/RISCV/GlobalISel/rv64zbkb.ll
+0-31 files

LLVM/project 1a9ff38utils/bazel/llvm-project-overlay/libc/test libc_test_rules.bzl, utils/bazel/llvm-project-overlay/libc/test/UnitTest BUILD.bazel

[bazel][test][libc] Use LLVM-libc's clock entrypoint in overlay tests (#224131)

This mimics LLVM-libc's CMake logic to always prefer LLVM-libc's own
`clock` implementation when available:
https://github.com/llvm/llvm-project/blob/2b16c36b4c532aa1f459ce566f7b41395b34edcf/libc/test/UnitTest/CMakeLists.txt#L32-L34
DeltaFile
+2-6utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl
+1-1utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
+3-72 files

LLVM/project d587093utils/bazel/llvm-project-overlay/libc/test libc_test_rules.bzl, utils/bazel/llvm-project-overlay/libc/test/include BUILD.bazel

[test][bazel][libc] Fix dependencies for some tests under full-build (#223498)
DeltaFile
+82-59utils/bazel/llvm-project-overlay/libc/test/include/BUILD.bazel
+37-4utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel
+16-4utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
+6-2utils/bazel/llvm-project-overlay/libc/utils/MPCWrapper/BUILD.bazel
+3-3utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl
+4-1utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel
+148-736 files

LLVM/project a0b33b0utils/bazel/llvm-project-overlay/libc/startup/linux startup_rules.bzl, utils/bazel/llvm-project-overlay/libc/test libc_test_rules.bzl

[bazel][libc][test] Allow LLVM-libc tests to be run in full-build mode (#219262)

This PR makes the required changes to run LLVM-libc full build tests in
Bazel. After this PR, most tests pass:


```
bazel test @llvm-project//libc/test/... --config=ci --@llvm-project//libc:build_mode=full --keep_going
Executed 760 out of 970 tests: 760 tests pass and 210 fail to build.
```

Follow on changes will fix specific tests that are failing (some missing
deps etc).

Specifically, this PR:
- Propagates the correct dependencies and compiler/linker options from
[`add_libc_hermetic`](https://github.com/llvm/llvm-project/blob/4098f568c46e06b6df470111868b4c165dd80f4d/libc/cmake/modules/LLVMLibCTestRules.cmake#L750).
- Adds `crt1.o` and hermetic utils as deps for all full-built tests.
- Fixes some build deps to be full-build compatible.
DeltaFile
+59-17utils/bazel/llvm-project-overlay/libc/test/libc_test_rules.bzl
+48-3utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel
+19-0utils/bazel/llvm-project-overlay/libc/startup/linux/startup_rules.bzl
+126-203 files

LLVM/project bffd242libc/test/UnitTest BazelFilePath.cpp

[bazel][libc] Do not depend on system `getenv` in BazelFilePath.cpp (#223873)

This PR models after
https://github.com/llvm/llvm-project/commit/ee407f7e7069cccfdc1815de07e17cebf83d19f9
in order to conditionally use LLVM-libc's `getenv` when compiling in
full-build mode.
DeltaFile
+13-3libc/test/UnitTest/BazelFilePath.cpp
+13-31 files

LLVM/project ac93c24clang/include/clang/AST DeclBase.h, clang/lib/AST DeclBase.cpp

[Clang] Cache stable primary declaration contexts

Cache primary contexts whose identity cannot change. Continue resolving
namespaces, C tags, and Objective-C contexts dynamically, and leave incomplete
C++ records uncached. Add regression coverage for mutable primary identities.

Three-sample medians versus the AST-context parent:
- RegisterAllDialects: 62,561,621,359 -> 61,772,265,706 instructions
  (-1.262%); peak RSS 1,375,288 -> 1,379,564 KiB (+0.311%).
- NVVMDialect: 90,739,370,711 -> 90,247,122,518 instructions (-0.543%);
  peak RSS 1,157,772 -> 1,157,812 KiB (+0.003%).
- CTMark O0: 29.4799 -> 29.4838 s (+0.013%); maximum per-test compile RSS
  265,072,640 -> 266,158,080 bytes (+0.409%).

Assisted-by: Codex
DeltaFile
+77-0clang/unittests/AST/DeclTest.cpp
+23-9clang/lib/AST/DeclBase.cpp
+10-1clang/include/clang/AST/DeclBase.h
+110-103 files

LLVM/project 99a9b8eclang/include/clang/AST DeclBase.h, clang/lib/AST DeclBase.cpp

[Clang] Cache AST context lookup for declarations

Cache the owning AST context after its first lookup and route declarations
through the cached DeclContext path. Keep an explicit translation-unit walk in
the cache-miss path, since the inline Decl lookup calls
getParentASTContext().

Three-sample medians versus refreshed main:
- RegisterAllDialects: 64,540,392,413 -> 62,561,621,359 instructions
  (-3.066%); peak RSS 1,368,340 -> 1,375,288 KiB (+0.508%).
- NVVMDialect: 92,108,060,036 -> 90,739,370,711 instructions (-1.486%);
  peak RSS 1,157,348 -> 1,157,772 KiB (+0.037%).
- CTMark O0: 29.4972 -> 29.4799 s (-0.059%); maximum per-test compile RSS
  264,605,696 -> 265,072,640 bytes (+0.177%).

Assisted-by: Codex
DeltaFile
+17-1clang/include/clang/AST/DeclBase.h
+18-0clang/unittests/AST/DeclTest.cpp
+12-4clang/lib/AST/DeclBase.cpp
+47-53 files

LLVM/project 2c59a93llvm/test/CodeGen/AMDGPU asyncmark-gfx12plus.ll memintrinsic-unroll.ll, llvm/test/Transforms/SeparateConstOffsetFromGEP index-insertion-point-terminator-def.ll

[SeparateConstOffsetFromGEP] Rebuild GEP indices at their definition point (#223546)

When a constant offset is split out of a GEP index, the rebuilt index
replaces the original one. Rebuilding the index immediately before the
GEP amounts to sinking the index computation, increasing live ranges and
register pressure. This change attempts to rebuild the index at the
definition point of the original index instead. The same insertion point
is used for the `idxprom` cast created by
`canonicalizeArrayIndicesToIndexSize` too.
DeltaFile
+80-80llvm/test/CodeGen/AMDGPU/memmove-var-size.ll
+151-0llvm/test/Transforms/SeparateConstOffsetFromGEP/NVPTX/index-insertion-point.ll
+57-57llvm/test/CodeGen/AMDGPU/memintrinsic-unroll.ll
+109-0llvm/test/Transforms/SeparateConstOffsetFromGEP/index-insertion-point-terminator-def.ll
+39-39llvm/test/CodeGen/AMDGPU/asyncmark-gfx12plus.ll
+16-16llvm/test/Transforms/SeparateConstOffsetFromGEP/AMDGPU/xor-decompose.ll
+452-1927 files not shown
+492-22313 files

LLVM/project a11b560clang/include/clang/CIR/Dialect/IR CIROps.td, clang/lib/CIR/Dialect/IR CIRDialect.cpp

[CIR] Verify cir.ptr_mask's mask width instead of resizing it

A mismatch is a producer bug, so reject it rather than convert it.

Assisted-by: Cursor / claude-opus-5
DeltaFile
+35-65clang/test/CIR/Lowering/ptr-mask.cir
+23-0clang/test/CIR/IR/invalid-ptr-mask.cir
+20-0clang/lib/CIR/Dialect/IR/CIRDialect.cpp
+2-13clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+5-5clang/test/CIR/IR/ptr-mask.cir
+3-4clang/include/clang/CIR/Dialect/IR/CIROps.td
+88-876 files

LLVM/project 44286f0lld/COFF ICF.cpp

[lld][COFF] Refactor ICF section equality checks, NFC (#206562)

In the context of #205456 , this seemed like a reasonable refactoring.
The template specialization might be overkill, but I figured it would
ensure there was no performance regression.
DeltaFile
+47-64lld/COFF/ICF.cpp
+47-641 files

LLVM/project 1ad9806llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/Shared BUILD.gn, llvm/utils/gn/secondary/llvm/unittests/ExecutionEngine/Orc BUILD.gn

[gn build] Port 4aeec5992e48 (#224161)
DeltaFile
+1-0llvm/utils/gn/secondary/llvm/unittests/ExecutionEngine/Orc/BUILD.gn
+1-0llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/Shared/BUILD.gn
+2-02 files

LLVM/project 3947787lldb/include/lldb/Target StackFrameRecognizer.h, lldb/source/Commands CommandObjectFrame.cpp

Change string type of StackFrameRecognizer module names (#222810)

The majority of these come from FileSpec filenames (which are no longer
ConstStrings). Instead of putting them into the StringPool, the
StackFrameRecognizerManager can just hold onto the name in the
RegisteredEntry.
DeltaFile
+10-12lldb/source/Target/StackFrameRecognizer.cpp
+2-2lldb/source/Plugins/SystemRuntime/MacOSX/AbortWithPayloadFrameRecognizer.cpp
+2-2lldb/include/lldb/Target/StackFrameRecognizer.h
+1-2lldb/source/Commands/CommandObjectFrame.cpp
+1-1lldb/source/Target/AssertFrameRecognizer.cpp
+1-1lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+17-201 files not shown
+18-217 files

LLVM/project 4c9a33allvm/include/llvm/CodeGen TargetInstrInfo.h, llvm/lib/CodeGen/AsmPrinter AsmPrinter.cpp

[WinEH] Only emit the async-EH nop after EH_LABEL on x86 (#219275)

Under `-fasync-exceptions`, `AsmPrinter::emitFunctionBody()` emits a nop
after an `EH_LABEL` whose next instruction can fault, so that the
faulting instruction opening an EH region does not share an address with
the return address of the call before it.

`EH_LABEL` is a meta-instruction and reports a size of zero, so that nop
is invisible to `getInstSizeInBytes()` and to everything that sums it.
On AArch64 that undercounts block offsets, `AArch64CompressJumpTables`
picks a one-byte jump table entry that does not fit, and the assembler
rejects it with `value evaluated as 258 is out of range`. That is how
this was found, building OpenCV's bundled protobuf for
`aarch64-pc-windows-msvc` with clang-cl `/EHa`. `BranchRelaxation` sums
the same sizes and has the same hole.

Only x86 needs the padding. On Arm64 the unwinder already backs the PC
up over a call when it knows there was one, which is exactly the case
the nop protects against, So gate the nop on x86 triples. That also

    [9 lines not shown]
DeltaFile
+41-0llvm/test/CodeGen/WinEH/wineh-eha-nop.ll
+0-34llvm/test/CodeGen/AArch64/wineh-async-eh-pad-instr-size.ll
+4-2llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+0-3llvm/include/llvm/CodeGen/TargetInstrInfo.h
+45-394 files

LLVM/project a510f0emlir/lib/Dialect/LLVMIR/Transforms InlinerInterfaceImpl.cpp

Update comment
DeltaFile
+2-2mlir/lib/Dialect/LLVMIR/Transforms/InlinerInterfaceImpl.cpp
+2-21 files

LLVM/project 3be2fabmlir/lib/Dialect/LLVMIR/Transforms InlinerInterfaceImpl.cpp, mlir/test/Dialect/LLVMIR inlining-alias-scopes.mlir

[mlir][LLVM] Use a disjoint scope domain when inlining noalias

This matches recent changes to the LLVM inliner.

AI disclosure: Claude wrote the code, I wrote the commit message and
have done initial review.
DeltaFile
+28-25mlir/lib/Dialect/LLVMIR/Transforms/InlinerInterfaceImpl.cpp
+10-18mlir/test/Dialect/LLVMIR/inlining-alias-scopes.mlir
+38-432 files

LLVM/project 98f40a3mlir/lib/Dialect/LLVMIR/Transforms InlinerInterfaceImpl.cpp

Remove pointless comment
DeltaFile
+0-2mlir/lib/Dialect/LLVMIR/Transforms/InlinerInterfaceImpl.cpp
+0-21 files

LLVM/project daf1953mlir/test/Dialect/LLVMIR inlining-alias-scopes.mlir

Test that the inliner keeps the flag when it clones a domain

Co-Authored-By: Claude Opus 5 (1M context) <noreply at anthropic.com>
DeltaFile
+35-0mlir/test/Dialect/LLVMIR/inlining-alias-scopes.mlir
+35-01 files

LLVM/project b6a4957mlir/include/mlir/Dialect/LLVMIR LLVMAttrDefs.td, mlir/lib/Dialect/LLVMIR/Transforms InlinerInterfaceImpl.cpp

[mlir][LLVM] Add disjointScopes to AliasScopeDomainAttr

This also updates the MLIR-side inliner to clone disjoint domains
while cloning alias scopes, matching changes to LLVM.

AI disclosure: Claude wrote the code, I wrote the commit message and
looked at the code.
DeltaFile
+25-0mlir/test/Target/LLVMIR/Import/metadata-alias-scopes.ll
+23-0mlir/test/Target/LLVMIR/attribute-alias-scopes.mlir
+17-2mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
+4-2mlir/lib/Target/LLVMIR/ModuleImport.cpp
+4-1mlir/lib/Dialect/LLVMIR/Transforms/InlinerInterfaceImpl.cpp
+2-2mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+75-76 files

LLVM/project 06f61f1llvm/lib/Target/AMDGPU AMDGPULowerModuleLDSPass.cpp, llvm/test/CodeGen/AMDGPU lower-lds-struct-aa-memcpy.ll remove-no-kernel-id-attribute.ll

[AMDGPU] Use a disjoint scope domain for merged LDS structs

When lowering LDS values, all the values are mutually disjoint, so we
can use the newly-added disjoint scopes feature to simplify the IR.

AI disclosure: Claude wrote this and I reviewed it and wrote the
 commit message
DeltaFile
+16-51llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
+35-10llvm/test/CodeGen/AMDGPU/lower-module-lds-precise-allocate-to-module-struct.ll
+15-18llvm/test/CodeGen/AMDGPU/lower-lds-struct-aa.ll
+11-13llvm/test/CodeGen/AMDGPU/lower-module-lds-via-hybrid.ll
+8-12llvm/test/CodeGen/AMDGPU/remove-no-kernel-id-attribute.ll
+9-10llvm/test/CodeGen/AMDGPU/lower-lds-struct-aa-memcpy.ll
+94-1146 files not shown
+140-16012 files

LLVM/project cd75ebellvm/lib/Target/AMDGPU AMDGPULowerKernelArguments.cpp, llvm/test/CodeGen/AMDGPU lower-kernargs.ll si-split-load-store-alias-info.ll

[AMDGPU] Use a disjoint scope domain for noalias kernel arguments

All noalias arguments of a kernel are disjoint with each other, so we
can use a disjoint scope to save on metadata construction.

AI disclosure: Claude wrote this, I looked at it and wrote this
message.
DeltaFile
+53-64llvm/test/CodeGen/AMDGPU/lower-noalias-kernargs.ll
+20-13llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp
+11-11llvm/test/CodeGen/AMDGPU/lower-kernel-arguments-noalias-call-no-ptr-args.ll
+8-8llvm/test/CodeGen/AMDGPU/si-split-load-store-alias-info.ll
+4-4llvm/test/CodeGen/AMDGPU/lower-kernargs.ll
+96-1005 files

LLVM/project 302a80allvm/test/Transforms/Inline noalias2.ll

Test a callee that has both noalias arguments and its own scopes

Co-Authored-By: Claude Opus 5 (1M context) <noreply at anthropic.com>
DeltaFile
+51-0llvm/test/Transforms/Inline/noalias2.ll
+51-01 files

LLVM/project 13ab15fclang/test/CodeGen arm-v8.2a-neon-intrinsics-generic.c arm_neon_intrinsics.c, llvm/lib/Transforms/Utils InlineFunction.cpp

[Inliner] Use a disjoint scope domain for noalias arguments

InlineFunction creates alias.scope/noalias metadata to represent the
set of `noalias` arguments to a function. We don't need the `!noalias`
now that we have the ability to use disjoint scopes, saving us IR size
and metadata bloat.

TODO move these to a previous commit.
Also changes InstCombine to not drop the experimental.noalias.scope.decl
for disjoint scopes even if they're not mentioned in a `!noalias`, but
do still delete them if they're not used.
DeltaFile
+324-324clang/test/CodeGen/arm_neon_intrinsics.c
+72-72clang/test/CodeGen/arm-v8.2a-neon-intrinsics-generic.c
+35-30llvm/lib/Transforms/Utils/InlineFunction.cpp
+13-14llvm/test/Transforms/Inline/noalias-calls2.ll
+12-12llvm/test/Transforms/Inline/noalias2.ll
+11-11llvm/test/Transforms/PhaseOrdering/pr39282.ll
+467-4639 files not shown
+487-48315 files

LLVM/project 84ce080llvm/test/Transforms/LICM scalar-promote-aa-tags.ll

Update tests introduced recently
DeltaFile
+2-2llvm/test/Transforms/LICM/scalar-promote-aa-tags.ll
+2-21 files

LLVM/project e363f15llvm/test/Analysis/ScopedNoAliasAA disjoint-domains.ll, llvm/test/CodeGen/SystemZ/Large branch-01.ll

Update tests for rebase
DeltaFile
+6-6llvm/test/Analysis/ScopedNoAliasAA/disjoint-domains.ll
+3-3llvm/test/CodeGen/SystemZ/Large/branch-01.ll
+2-2llvm/test/Transforms/ScalarizeMaskedMemIntrin/X86/metadata.ll
+1-1mlir/test/Target/LLVMIR/masked-intrinsic-metadata.mlir
+1-1mlir/test/Target/LLVMIR/Import/masked-intrinsic-metadata.ll
+1-1llvm/test/Transforms/LoopVectorize/VPlan/cse-loads.ll
+14-146 files

LLVM/project 0fc28dallvm/docs LangRef.md

Update docs
DeltaFile
+7-10llvm/docs/LangRef.md
+7-101 files

LLVM/project e5de866llvm/docs LangRef.md

Add a warning about string names on disjoint
DeltaFile
+4-0llvm/docs/LangRef.md
+4-01 files

LLVM/project 61b5976llvm/docs LangRef.md, llvm/include/llvm/Analysis ScopedNoAliasAA.h

Review feedback
DeltaFile
+14-14llvm/lib/Analysis/ScopedNoAliasAA.cpp
+12-5llvm/docs/LangRef.md
+2-1llvm/include/llvm/Analysis/ScopedNoAliasAA.h
+28-203 files

LLVM/project 6ecb394clang/test/CodeGen arm_neon_intrinsics.c arm-v8.2a-neon-intrinsics-generic.c, llvm/lib/Bitcode/Reader MetadataLoader.cpp

[IR] Add alias scope domains with disjoint scopes

See RFC at
https://discourse.llvm.org/t/rfc-disjoint-scope-alias-scope-noalias-domains/91537

This commit adds support for declaring an alias scope domain disjoint.
Disjoint domains are ones where each scope is implicitly `!noalias`
with each other scope in the domain. This is represented by adding an
`i1` into the scope's domain as the second argument, with `i1 true`
representing disjoint scopes and `i1 false` representing the old
non-disjoint behavior. AutoUpgrade mechanisms have been added to add
in the missing `i1 false` to existing metadata.

This commit updates alias analysis to know about disjoint scopes and
updates the function cloner to also clone the alias domain if it's
disjoint (since, as a herd of LLMs discovered, you don't want the old
IR to be noalias with a clone of itself).

Commits to migrate passes to use disjoint scopes where that's an

    [4 lines not shown]
DeltaFile
+72-72clang/test/CodeGen/arm-v8.2a-neon-intrinsics-generic.c
+54-54clang/test/CodeGen/arm_neon_intrinsics.c
+97-0llvm/lib/Bitcode/Reader/MetadataLoader.cpp
+95-0llvm/test/Transforms/InstCombine/noalias-scope-decl-disjoint-domain.ll
+42-42llvm/test/Transforms/LoopUnroll/peel-loop-noalias-scope-decl.ll
+39-35llvm/test/CodeGen/MIR/AMDGPU/machine-metadata.mir
+399-203189 files not shown
+1,342-718195 files