LLVM/project 7075e15 — clang/include/clang/AST TypeLoc.h, clang/lib/Sema SemaType.cpp TreeTransform.h

[clang] Preserve ext_vector_type locations during template substitution (#229328)

Instantiating a fixed-length `ext_vector_type` with a dependent element
type could emit an invalid-element diagnostic without a source location.

For example:

```cc
struct S {};

template <typename T> struct Vector {
  typedef T type __attribute__((ext_vector_type(4)));
};

Vector<S> v;
```

Before:


    [24 lines not shown]
DeltaFile
+47-0clang/unittests/AST/SourceLocationTest.cpp
+29-8clang/include/clang/AST/TypeLoc.h
+23-13clang/lib/Sema/TreeTransform.h
+26-6clang/lib/Sema/SemaType.cpp
+23-0clang/test/SemaTemplate/ext-vector-type.cpp
+17-1clang/test/PCH/cxx-dependent-sized-ext-vector.cpp
+165-287 files not shown
+195-3813 files

LLVM/project 3c7bb4d — utils/bazel/llvm-project-overlay/libc BUILD.bazel libc_build_rules.bzl, utils/bazel/llvm-project-overlay/libc/hdr BUILD.bazel

[bazel][libc] Allow generated headers to be filtered by entrypoint

This PR splits the `libc_generated_header` into two steps. Instead of directly generating each header, we introduce a `libc_hdrgen_spec` rule that describes all the inputs to `hdrgen` for a given header, but does not produce a file.

Separately, we introduce a rule `libc_generated_headers` to actually create header files. Here, you can provide an `entrypoints` attribute to filter the produced header.

Note that this is not exactly equivalent to how the CMake build works. In this PR, LLVM-libc function objects are still compiled against unfiltered headers. CMake, whereas CMake produces filtered headers and compiles c++ sources against them.

If we want to be closer to CMake, we could instead make the entrypoint list configurable at the command-line. We could add a new provider `LibcEntrypointListInfo` and a companion `libc_entrypoint_list` rule that records all the entrypoint names we want to use when filtering headers. Then we would use a `label_flag` to select which `libc_entrypoint_list` should be used for filtering headers. I don't love this, since it's a global option and thus necessitates using transitions to create different header sets, but it is close to what CMake does.
DeltaFile
+140-29utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl
+15-7utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+0-1utils/bazel/llvm-project-overlay/libc/hdr/BUILD.bazel
+155-373 files

LLVM/project 64be9da — libc/src/__support/OSUtil/linux/syscall_wrappers execve.h

[libc] Simplify execve syscall error handling (#242601)

Use syscall_checked<int> in the execve wrapper instead of converting
syscall errors by hand.
DeltaFile
+3-6libc/src/__support/OSUtil/linux/syscall_wrappers/execve.h
+3-61 files

LLVM/project b75c806 — libc/src/__support/OSUtil/linux/syscall_wrappers getrandom.h

[libc] Simplify getrandom syscall error handling (#242602)

Use syscall_checked<ssize_t> in the getrandom wrapper instead of
converting syscall errors by hand.
DeltaFile
+2-5libc/src/__support/OSUtil/linux/syscall_wrappers/getrandom.h
+2-51 files

LLVM/project 12290e2 — llvm/lib/Transforms/Scalar ConstraintElimination.cpp, llvm/test/Transforms/ConstraintElimination add-nsw.ll sadd-with-overflow.ll

Revert "[ConstraintElim] A signed sum of operands with opposite signs cannot …"

This reverts commit 4b5da127ee5c9926a7189b5c55ef073a1af17b85.
DeltaFile
+0-62llvm/test/Transforms/ConstraintElimination/sadd-with-overflow.ll
+9-25llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
+6-3llvm/test/Transforms/ConstraintElimination/add-nsw.ll
+15-903 files

LLVM/project 0212d77 — llvm/lib/Target/Mips MipsISelLowering.cpp, llvm/test/CodeGen/Mips/llvm-ir ashr.ll shl.ll

[Mips] Use a proper boolean for the select condition in lowerShift*Parts (#241685)

lowerShiftLeftParts and lowerShiftRightParts used (and Shamt, VT.bits)
directly as the condition of ISD::SELECT. That value is 0 or VT.bits
(32, or 64 for i128 on MIPS64), not 0/1. Since MIPS uses
ZeroOrOneBooleanContent, DAG combines may treat the condition as a 0/1
value, e.g. folding select(c, 0, 1) into xor c, 1, which miscompiles
when the condition is 32. For example 0x1FFFFFFFF >> (b & 32) returned
0x2100000001 instead of 1 for b = 32 on MIPS32.

Compare the masked shift amount against zero with setcc ne to form the
select condition. The DOUBLE_SELECT_I/DOUBLE_SELECT_I64 path used for
pre-MIPS4/MIPS32 in lowerShiftRightParts branches on the value being
non-zero, so it keeps using the masked shift amount directly.

Fixes #235261

Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
DeltaFile
+365-8llvm/test/CodeGen/Mips/llvm-ir/lshr.ll
+17-10llvm/test/CodeGen/Mips/llvm-ir/shl.ll
+17-5llvm/lib/Target/Mips/MipsISelLowering.cpp
+12-8llvm/test/CodeGen/Mips/llvm-ir/ashr.ll
+411-314 files

LLVM/project 4ab698d — llvm/lib/CodeGen/GlobalISel CombinerHelper.cpp, llvm/test/CodeGen/AArch64/GlobalISel combine-direct-hasoneuse-debug.mir

[GlobalISel] Ignore debug uses in direct single-use combines (#237643)

Debug uses can block the lshr/trunc and insert-vector chain combines in
`CombinerHelper`, making ordinary Machine IR depend on debug
information.

This patch counts only non-debug uses and uses a non-debug iterator when
retrieving the insert-vector user. The regression tests cover both
combines and fail without the change.

These direct `MRI.hasOneUse()` checks are not covered by #237070, which
changes the `m_OneUse` matcher.

This issue was found through a source audit. AI assisted with the
analysis and development of the fix.
DeltaFile
+55-0llvm/test/CodeGen/AArch64/GlobalISel/combine-direct-hasoneuse-debug.mir
+4-3llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
+59-32 files

LLVM/project 53e3568 — llvm/utils/gn/secondary/clang/lib/Headers BUILD.gn

[gn build] Port f2368ada4905 (#242724)
DeltaFile
+2-1llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn
+2-11 files

LLVM/project 9666ecc — llvm/utils/gn/secondary/llvm/lib/IR BUILD.gn, llvm/utils/gn/secondary/llvm/unittests/IR BUILD.gn

[gn build] Port d2c9cc6e795c (#242723)
DeltaFile
+1-0llvm/utils/gn/secondary/llvm/unittests/IR/BUILD.gn
+1-0llvm/utils/gn/secondary/llvm/lib/IR/BUILD.gn
+2-02 files

LLVM/project e5009d8 — llvm/lib/Target/SPIRV SPIRVLegalizerInfo.cpp, llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_masked_gather_scatter phi.ll

[SPIR-V] Legalize G_PHI of a vector of pointers (#241166)

With `SPV_INTEL_masked_gather_scatter`, vectors of pointers are legal
types and `G_IMPLICIT_DEF`/`G_FREEZE` already accept them, but `G_PHI`
did not, so a PHI of `<N x ptr>` failed with "unable to legalize
instruction". The SLP vectorizer forms such PHIs from vectorized address
computations. This adds the same pointer-vector rule to `G_PHI`.

Assisted-by: Claude Opus 5.5
DeltaFile
+23-0llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_masked_gather_scatter/phi.ll
+3-0llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp
+26-02 files

LLVM/project 3c4d950 — llvm/test/Transforms/GVN load-poison.ll

[GVN] Pre-commit tests for per-bit `poison` and provenance when forwarding a load
DeltaFile
+424-0llvm/test/Transforms/GVN/load-poison.ll
+424-01 files

LLVM/project 7d33d6d — llvm/lib/Transforms/Scalar GVN.cpp, llvm/test/Transforms/GVN invariant.group.ll metadata.ll

[GVN] Preserve per-bit `poison` and provenance when forwarding a load
DeltaFile
+59-52llvm/test/Transforms/GVN/load-poison.ll
+102-1llvm/lib/Transforms/Scalar/GVN.cpp
+26-27llvm/test/Transforms/GVN/PRE/rle.ll
+7-7llvm/test/Transforms/GVN/rle-coerced-noalias.ll
+6-4llvm/test/Transforms/GVN/metadata.ll
+3-2llvm/test/Transforms/GVN/invariant.group.ll
+203-931 files not shown
+206-957 files

LLVM/project f8a6460 — llvm/test/Transforms/GVN vector-poison.ll

[GVN] Explain the address space test in `vector-poison.ll`
DeltaFile
+2-0llvm/test/Transforms/GVN/vector-poison.ll
+2-01 files

LLVM/project e7fc770 — llvm/lib/Transforms/Utils VNCoercion.cpp, llvm/test/Transforms/GVN pr14166.ll ptr-vector-coercion.ll

[GVN] Keep `poison` per lane when forwarding vectors
DeltaFile
+48-63llvm/test/Transforms/GVN/pr63059.ll
+31-50llvm/test/Transforms/GVN/vector-poison.ll
+12-6llvm/lib/Transforms/Utils/VNCoercion.cpp
+4-9llvm/test/Transforms/GVN/ptr-vector-coercion.ll
+0-1llvm/test/Transforms/GVN/pr14166.ll
+95-1295 files

LLVM/project 1f64c9e — llvm/test/Transforms/GVN vector-poison.ll

[GVN] Pre-commit tests for per-lane `poison` in forwarded vectors
DeltaFile
+244-0llvm/test/Transforms/GVN/vector-poison.ll
+244-01 files

LLVM/project e6c95c8 — llvm/test/Transforms/InstCombine bitextract-of-vector.ll

[InstCombine] Pre-commit tests for vector `bitextract` of a `bitcast`
DeltaFile
+157-0llvm/test/Transforms/InstCombine/bitextract-of-vector.ll
+157-01 files

LLVM/project abfe003 — llvm/lib/Transforms/InstCombine InstructionCombining.cpp, llvm/test/Transforms/InstCombine bitextract-of-vector.ll

[InstCombine] Fold vector `bitextract` of a `bitcast` to `shufflevector`
DeltaFile
+93-49llvm/test/Transforms/InstCombine/bitextract-of-vector.ll
+63-22llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+156-712 files

LLVM/project d52ef4a — llvm/lib/Transforms/InstCombine InstructionCombining.cpp, llvm/test/Transforms/InstCombine bitextract-of-vector.ll

[InstCombine] Fold `bitextract` of a vector to `extractelement` or `shufflevector`
DeltaFile
+231-123llvm/test/Transforms/InstCombine/bitextract-of-vector.ll
+62-0llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+293-1232 files

LLVM/project 833f2c9 — llvm/test/Transforms/InstCombine bitextract-of-vector.ll

[InstCombine] Pre-commit tests for `bitextract` of a vector
DeltaFile
+464-0llvm/test/Transforms/InstCombine/bitextract-of-vector.ll
+464-01 files

LLVM/project 7df7868 — llvm/lib/Transforms/Scalar GVN.cpp, llvm/test/Transforms/GVN bitextract-bitinsert.ll

[GVN] Fold equivalent `bitextract` and `bitinsert` (#242716)

GVN gives each instruction a value number, and replaces an instruction
with an earlier one that has the same number. An instruction gets a
number from its opcode, type and operands only if GVN knows the opcode.
Any other opcode gets a fresh number, so GVN never merges it.

`bitextract` and `bitinsert` were missing from that list.

Replaces #237785, which was closed by mistake during a restack.
DeltaFile
+130-0llvm/test/Transforms/GVN/bitextract-bitinsert.ll
+2-0llvm/lib/Transforms/Scalar/GVN.cpp
+132-02 files

LLVM/project 5991b64 — llvm/lib/DWARFLinker/Classic DWARFLinkerDeclContext.cpp, llvm/test/tools/dsymutil/Inputs compilation-prefix-map-odr.s

[dsymutil] Undo prefix mapping before resolving paths for ODR uniquing

The classic linker resolves the declaration file of a type with
realpath() to tell apart types with the same name, line and size. For
paths remapped by compilation caching, which don't exist on disk,
realpath() fails and only the file name is left, so different types
declared in headers with the same name in different directories were
merged. Undo the prefix mapping from compilation-prefix-map.json first.
DeltaFile
+679-0llvm/test/tools/dsymutil/Inputs/compilation-prefix-map-odr.s
+47-0llvm/test/tools/dsymutil/X86/compilation-prefix-map-odr.test
+3-0llvm/lib/DWARFLinker/Classic/DWARFLinkerDeclContext.cpp
+729-03 files

LLVM/project ac1e1a0 — llvm/include/llvm/Support VirtualFileSystem.h, llvm/lib/Support VirtualFileSystem.cpp

[Support] Add vfs::findFileInParentDirectories()

Several tools look for a file in a directory and its parent
directories, for example clang-format for .clang-format and clang-tidy
for .clang-tidy, and each has its own loop for that. Add a function for
it, which dsymutil will use to find the compilation-prefix-map.json
files that compilation caching writes.
DeltaFile
+30-0llvm/unittests/Support/VirtualFileSystemTest.cpp
+16-0llvm/lib/Support/VirtualFileSystem.cpp
+11-0llvm/include/llvm/Support/VirtualFileSystem.h
+57-03 files

LLVM/project 36ca7c7 — llvm/lib/DWARFLinker/Classic DWARFLinker.cpp, llvm/test/tools/dsymutil/Inputs swift-interface-prefix-map.s compilation-prefix-map.s

[dsymutil] Support compilation-prefix-map.json from compilation caching

Compilation caching can prefix map the paths that the compiler sees, so
that cache keys don't depend on where the build happens, for example
/path/to/project becomes /^src. The build system records the mapping in
a compilation-prefix-map.json file in a parent directory of the object
files, as a JSON object from each remapped prefix to the original one.

dsymutil didn't support it, so it used the remapped paths from the
debug info as is: it failed to copy the Swift interfaces that the debug
info refers to, didn't recognize interfaces from the SDK or the
toolchain that it should skip, and wrote the remapped paths into the
dSYM.

Load the compilation-prefix-map.json closest to each object file, and
use it to find Swift interfaces and Clang modules, and to restore the
original paths in the path attributes and line tables of the linked
debug info. Clang modules use the map of the object file that refers to
them. -object-prefix-map still only applies to looking up Clang

    [6 lines not shown]
DeltaFile
+349-0llvm/test/tools/dsymutil/Inputs/compilation-prefix-map.s
+262-0llvm/test/tools/dsymutil/Inputs/swift-interface-prefix-map.s
+70-0llvm/test/tools/dsymutil/X86/swift-interface-prefix-map.test
+58-0llvm/test/tools/dsymutil/X86/compilation-prefix-map.test
+52-0llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
+36-14llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp
+827-1412 files not shown
+972-5718 files

LLVM/project 4cda9b1 — llvm/lib/Transforms/Scalar EarlyCSE.cpp, llvm/test/Transforms/EarlyCSE bitextract-bitinsert.ll

[EarlyCSE] Fold equivalent `bitextract` and `bitinsert`
DeltaFile
+3-6llvm/test/Transforms/EarlyCSE/bitextract-bitinsert.ll
+4-2llvm/lib/Transforms/Scalar/EarlyCSE.cpp
+7-82 files

LLVM/project 66fee45 — llvm/test/Transforms/EarlyCSE bitextract-bitinsert.ll

[EarlyCSE] Pre-commit tests for equivalent `bitextract` and `bitinsert`
DeltaFile
+133-0llvm/test/Transforms/EarlyCSE/bitextract-bitinsert.ll
+133-01 files

LLVM/project f247014 — llvm/lib/Transforms/Vectorize VPlanConstruction.cpp

[VPlan] Remove dead hasScalarVFOnly check in handleFindLastRed (NFC). (#242714)

handleFindLastReductions runs before the VFs are added to the plan, so
Plan.hasScalarVFOnly() is always false there. Scalar VFs with
interleaving are supported since 03c34bb59eb9 (#184099), so remove the
check instead of making it effective.
DeltaFile
+0-3llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
+0-31 files

LLVM/project f650cea — llvm/include/llvm/Support PrefixMapper.h, llvm/lib/Support PrefixMapper.cpp

[Support] Address PrefixMapper review feedback

Match a mapping whose Old ends with a separator, such as "/=/new" or
"/old/=/new", against paths below it; it used to match only the exact
path. Append the rest of the path with its leading separator intact, so
Windows paths keep their separators: "C:/old/a" now maps to "C:/new/a"
instead of "C:/new\a".

Make the map functions const, document how separators are matched and
joined, test separators, sort() and addInverseRange(), and drop the
unused StringSaver references.
DeltaFile
+101-9llvm/unittests/Support/PrefixMapperTest.cpp
+22-12llvm/include/llvm/Support/PrefixMapper.h
+12-12llvm/lib/Support/PrefixMapper.cpp
+135-333 files

LLVM/project f8bac50 — llvm/lib/Transforms/Vectorize VPlanLowering.cpp, llvm/test/Transforms/LoopVectorize fmax-without-fast-math-flags-tail-folding.ll

[VPlan] Keep NaN exit when using active-lane-mask for control flow. (#241543)

handleMaxMinNumReductions exits the vector loop early if any lane is
NaN, OR'ing the check with the latch exit check. With active-lane-mask
control flow, addVPLaneMaskPhiAndUpdateExitBranch replaced the whole
latch terminator by a branch on the negated mask without checking the
terminator, dropping the NaN exit.

Only replace the latch exit check by the negated mask and keep the other
exit conditions.

PR: https://github.com/llvm/llvm-project/pull/241543
DeltaFile
+27-10llvm/lib/Transforms/Vectorize/VPlanLowering.cpp
+4-3llvm/test/Transforms/LoopVectorize/fmax-without-fast-math-flags-tail-folding.ll
+31-132 files

LLVM/project e5c8c3d — llvm/lib/Transforms/Scalar EarlyCSE.cpp, llvm/test/Transforms/EarlyCSE bitextract-bitinsert.ll

[EarlyCSE] Fold equivalent `bitextract` and `bitinsert`
DeltaFile
+4-8llvm/test/Transforms/EarlyCSE/bitextract-bitinsert.ll
+4-2llvm/lib/Transforms/Scalar/EarlyCSE.cpp
+8-102 files

LLVM/project efe4bf2 — llvm/test/Transforms/EarlyCSE bitextract-bitinsert.ll

[EarlyCSE] Pre-commit tests for equivalent `bitextract` and `bitinsert`
DeltaFile
+193-0llvm/test/Transforms/EarlyCSE/bitextract-bitinsert.ll
+193-01 files