LLVM/project 9280f01clang-tools-extra/clang-tidy/modernize UseRangesCheck.cpp, clang-tools-extra/clang-tidy/utils UseRangesCheck.cpp

[clang-tidy] `use-ranges`: avoid unsafe result fix-its

Preserve callable results with .fun, allow structured-binding-safe rewrites, and keep diagnostics while suppressing unsafe fix-its when ranges result objects do not match the original result shape.

Assisted by Codex.
DeltaFile
+38-2clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
+37-0clang-tools-extra/test/clang-tidy/checkers/modernize/use-ranges.cpp
+22-5clang-tools-extra/clang-tidy/modernize/UseRangesCheck.cpp
+26-0clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h
+7-0clang-tools-extra/docs/ReleaseNotes.rst
+2-0clang-tools-extra/docs/clang-tidy/checks/modernize/use-ranges.rst
+132-71 files not shown
+134-77 files

LLVM/project 2c051e5clang-tools-extra/clang-tidy/modernize UseRangesCheck.cpp, clang-tools-extra/docs ReleaseNotes.rst

[clang-tidy] `use-ranges`: preserve output results

Preserve used output iterator results for output algorithm replacements by appending .out where the ranges algorithm returns an algorithm result object.

Fix #110223

Assisted by Codex.
DeltaFile
+104-0clang-tools-extra/test/clang-tidy/checkers/modernize/use-ranges.cpp
+59-0clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h
+26-28clang-tools-extra/clang-tidy/modernize/UseRangesCheck.cpp
+3-0clang-tools-extra/docs/ReleaseNotes.rst
+2-0clang-tools-extra/docs/clang-tidy/checks/modernize/use-ranges.rst
+194-285 files

LLVM/project 932a12cclang-tools-extra/clang-tidy/modernize UseRangesCheck.cpp, clang-tools-extra/docs ReleaseNotes.rst

[clang-tidy] `use-ranges`: preserve remove iterator results

Preserve used iterator results for remove, partition, stable_partition, and rotate-style replacements by appending .begin() where the ranges algorithm returns a subrange.

Fix #124794

Assisted by Codex.
DeltaFile
+25-0clang-tools-extra/test/clang-tidy/checkers/modernize/use-ranges.cpp
+16-0clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h
+6-6clang-tools-extra/clang-tidy/modernize/UseRangesCheck.cpp
+4-0clang-tools-extra/docs/ReleaseNotes.rst
+51-64 files

LLVM/project 37845daclang-tools-extra/clang-tidy/modernize UseRangesCheck.cpp, clang-tools-extra/clang-tidy/utils UseRangesCheck.cpp UseRangesCheck.h

[clang-tidy] `use-ranges`: preserve used `unique` results (#196035)

Preserve iterator uses when replacing `std::unique` with
`std::ranges::unique` by appending `.begin()` in used-result contexts.

Fix #127658

Assisted by Codex.
DeltaFile
+41-0clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
+30-9clang-tools-extra/clang-tidy/modernize/UseRangesCheck.cpp
+31-0clang-tools-extra/test/clang-tidy/checkers/modernize/use-ranges.cpp
+14-0clang-tools-extra/clang-tidy/utils/UseRangesCheck.h
+7-0clang-tools-extra/test/clang-tidy/checkers/modernize/Inputs/use-ranges/fake_std.h
+6-0clang-tools-extra/docs/ReleaseNotes.rst
+129-91 files not shown
+131-97 files

LLVM/project f5b80e3llvm/lib/CodeGen/SelectionDAG InstrEmitter.cpp, llvm/lib/Frontend/OpenMP OMPIRBuilder.cpp

fix unused variables

Created using spr 1.3.8-wip
DeltaFile
+0-36llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+3-5llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
+3-3llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+6-443 files

LLVM/project 7966cbbllvm/test/CodeGen/AArch64 sve-fixed-length-masked-expandloads.ll alias_mask.ll

[AArch64] Use ADDP tree for v16i8 to i16 bitmask extraction (#199812)

Re-land of #192974, reverted in 868aefd.

The original PR was reverted because the new lowering produced an
EXTRACT_VECTOR_ELT with an illegal i16 result type, which tripped the
operation legalizer when called from combineBoolVectorAndTruncateStore
on a `<32 x i1>` store split into two `<16 x i1>` halves. Returning i32
(handled by the caller's existing getZExtOrTrunc) avoids this.

Regression test added: bitmask_v32i8_split in
vec-combine-compare-to-bitmask.ll.

Note: in alias_mask.ll's whilewr_8_split2, the four halfword bitmask
results are now stored as separate `str h` × 4 rather than packed into
a d-register via ZIP1+EXT before a single store. Functionally
equivalent, slightly fewer NEON arithmetic ops. Side effect of the i32
return type; the store-merging combine doesn't match the same shape.
DeltaFile
+49-49llvm/test/CodeGen/AArch64/sve-fixed-length-masked-expandloads.ll
+36-36llvm/test/CodeGen/AArch64/alias_mask.ll
+36-11llvm/test/CodeGen/AArch64/vec-combine-compare-to-bitmask.ll
+16-16llvm/test/CodeGen/AArch64/dag-combine-setcc.ll
+12-12llvm/test/CodeGen/AArch64/fixed_masked_deinterleaved_loads.ll
+12-12llvm/test/CodeGen/AArch64/fixed_masked_interleaved_stores.ll
+161-1363 files not shown
+183-1559 files

LLVM/project c7a7e13llvm/include/llvm/IR DebugLoc.h, llvm/lib/AsmParser LLParser.cpp

[spr] initial version

Created using spr 1.3.8-wip
DeltaFile
+0-42llvm/test/Verifier/dbg-declare-invalid-debug-loc.ll
+38-0llvm/test/Assembler/dbg-declare-invalid-debug-loc.ll
+26-2llvm/lib/AsmParser/LLParser.cpp
+8-19llvm/include/llvm/IR/DebugLoc.h
+6-14llvm/lib/IR/AutoUpgrade.cpp
+8-9llvm/lib/IR/DebugProgramInstruction.cpp
+86-8622 files not shown
+150-15228 files

LLVM/project a67efdallvm/lib/Transforms/Vectorize VPlanUtils.cpp, llvm/test/Transforms/LoopVectorize/RISCV masked_gather_scatter.ll

[VPlan] Recognize shl by constant in getSCEVExprForVPValue. (#199359)

Treat `shl x, c` (with c < bitwidth) as `x * (1 << c)` so callers that
analyze GEP indices via SCEV can see through stride shifts written as
logical shifts.

PR: https://github.com/llvm/llvm-project/pull/199359
DeltaFile
+6-6llvm/test/Transforms/LoopVectorize/RISCV/masked_gather_scatter.ll
+7-0llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
+13-62 files

LLVM/project c78c900llvm/test/CodeGen/AArch64 bf16-v8-instructions.ll bf16-instructions.ll

[AArch64] Add tests for bf16 convert with fast-math flags. NFC (#200643)
DeltaFile
+308-0llvm/test/CodeGen/AArch64/bf16-v8-instructions.ll
+173-10llvm/test/CodeGen/AArch64/bf16-instructions.ll
+177-0llvm/test/CodeGen/AArch64/bf16-v4-instructions.ll
+658-103 files

LLVM/project da3f152llvm/include/llvm/IR Constants.h Constant.h, llvm/lib/IR Constants.cpp ConstantsContext.h

[IR][NFC] Fast path for Constant::isNullValue (#200434)

Constant::isNullValue is the, by far, most frequently called out-of-line
function of Constant. It also has non-trivial logic and needs to switch
on the class type.

Therefore, compute the "is null" property once on construction and store
it in an unused bit in SubclassOptionalData.

This improves performance of stage2-O3 by 0.15%.
DeltaFile
+8-20llvm/lib/IR/Constants.cpp
+13-5llvm/include/llvm/IR/Constants.h
+10-1llvm/include/llvm/IR/Constant.h
+2-0llvm/lib/IR/ConstantsContext.h
+33-264 files

LLVM/project 80f6b76llvm/include/llvm/Object ELF.h, llvm/lib/Object ELF.cpp XCOFFObjectFile.cpp

[Object] Remove unused argument of DataExtractor constructor (NFC) (#197124)

`AddressSize` parameter is not used by `DataExtractor` and will be
removed in the future. See #190519 for more context.
DeltaFile
+2-2llvm/lib/Object/ELF.cpp
+1-2llvm/lib/Object/XCOFFObjectFile.cpp
+1-1llvm/lib/Object/MachOObjectFile.cpp
+1-1llvm/include/llvm/Object/ELF.h
+1-1llvm/lib/Object/Decompressor.cpp
+6-75 files

LLVM/project b49a468llvm/include/llvm/ProfileData GCOV.h, llvm/lib/ProfileData InstrProfCorrelator.cpp

[Profile] Remove unused argument of DataExtractor constructor (NFC) (#197119)

`AddressSize` parameter is not used by `DataExtractor` and will be
removed in the future. See #190519 for more context.
DeltaFile
+5-5llvm/include/llvm/ProfileData/GCOV.h
+1-1llvm/lib/ProfileData/InstrProfCorrelator.cpp
+6-62 files

LLVM/project 87f6f5ellvm/include/llvm/IR Constant.h

fix typo

Created using spr 1.3.8-wip
DeltaFile
+1-1llvm/include/llvm/IR/Constant.h
+1-11 files

LLVM/project e920ecellvm/lib/Target/RISCV RISCVOptWInstrs.cpp, llvm/test/CodeGen/RISCV prefer-w-inst.mir sextw-removal.ll

[RISCV] Prevent RISCVOptWInstrs from shrinking volatile LD instructions. (#200472)

Fixes #200379
DeltaFile
+39-6llvm/test/CodeGen/RISCV/prefer-w-inst.mir
+17-0llvm/test/CodeGen/RISCV/sextw-removal.ll
+13-1llvm/lib/Target/RISCV/RISCVOptWInstrs.cpp
+69-73 files

LLVM/project 1f2223dllvm/lib/CodeGen ExpandIRInsts.cpp, llvm/utils profcheck-xfail.txt

[ExpandIRInsts] Fix profile metadata after #200291 (#200629)
DeltaFile
+8-1llvm/lib/CodeGen/ExpandIRInsts.cpp
+0-2llvm/utils/profcheck-xfail.txt
+8-32 files

LLVM/project ec7769cclang/lib/CodeGen CGObjCMacConstantLiteralUtil.h, llvm/include/llvm/ADT CachedHashString.h DenseMapInfo.h

[𝘀𝗽𝗿] initial version

Created using spr 1.3.5-bogner
DeltaFile
+12-28llvm/include/llvm/ADT/CachedHashString.h
+6-29llvm/lib/IR/LLVMContextImpl.h
+0-32llvm/include/llvm/ADT/DenseMapInfo.h
+6-18clang/lib/CodeGen/CGObjCMacConstantLiteralUtil.h
+3-18llvm/lib/Transforms/Scalar/EarlyCSE.cpp
+1-18llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+28-143228 files not shown
+108-1,382234 files

LLVM/project 6eb8d3aclang/include/clang/Basic DirectoryEntry.h, clang/lib/APINotes APINotesFormat.h

[𝘀𝗽𝗿] changes to main this commit is based on

Created using spr 1.3.5-bogner

[skip ci]
DeltaFile
+6-18clang/lib/CodeGen/CGObjCMacConstantLiteralUtil.h
+0-18clang/lib/APINotes/APINotesFormat.h
+0-17mlir/include/mlir/IR/TypeRange.h
+0-16mlir/include/mlir/IR/Value.h
+2-14mlir/include/mlir/IR/Remarks.h
+3-12clang/include/clang/Basic/DirectoryEntry.h
+11-95100 files not shown
+39-617106 files

LLVM/project b17edc6llvm/lib/CodeGen ExpandIRInsts.cpp

[ExpandIRInsts] Drop ProfcheckDisableMetadataFixes in some cases (#200627)

This is unnecessary inside of applyProfMetadataIfEnabled because it is
already handled before the callback lambda gets called within the
function. There was also a redundant case to remove.
DeltaFile
+15-19llvm/lib/CodeGen/ExpandIRInsts.cpp
+15-191 files

LLVM/project dbf01d4utils/bazel/llvm-project-overlay/clang/include/clang/Config config.h

[bazel] Add CLANG_USE_EXPERIMENTAL_CONST_INTERP (fixup for #199396) (#200619)
DeltaFile
+3-0utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
+3-01 files

LLVM/project 16a127bllvm/lib/Transforms/Utils Local.cpp, llvm/test/Transforms/GVN invariant.group.ll

[IR] Fix !invariant.group in combineMetadataForCSE when K moves (#200551)

SimplifyCFG mergeConditionalStoreToAddress currently transforms

    if (cond)
      store ptr, x !invariant.group;
    else
      store ptr, y;

into

    store ptr, select(cond, x, y) !invariant.group;  // BUG

It's clearly not valid to preserve !invariant.group here.

Fix this inside combineMetadataForCSE.  It can only preserve
!invariant.group if

 1. !DoesKMove, meaning that original instruction ("K") is replaced by

    [5 lines not shown]
DeltaFile
+60-0llvm/test/Transforms/SimplifyCFG/merge-cond-stores.ll
+5-14llvm/lib/Transforms/Utils/Local.cpp
+1-1llvm/test/Transforms/NewGVN/invariant.group.ll
+1-1llvm/test/Transforms/GVN/invariant.group.ll
+67-164 files

LLVM/project baa0796compiler-rt/lib/asan asan_allocator.cpp asan_allocator.h, compiler-rt/lib/asan/tests asan_noinst_test.cpp

[asan] NFC: clang-format allocator-related files (#200478)

Depends on #200615
Groundwork for #196413.

Mechanical cleanup of allocator related files in preparation of
functional changes. clang-format (v21.1.2) applied whole-file to:

  compiler-rt/lib/asan/asan_allocator.cpp
  compiler-rt/lib/asan/asan_allocator.h
  compiler-rt/lib/asan/asan_malloc_linux.cpp
  compiler-rt/lib/asan/asan_malloc_mac.cpp
  compiler-rt/lib/asan/asan_new_delete.cpp
  compiler-rt/lib/asan/tests/asan_noinst_test.cpp

Both compiler-rt/lib/asan/.clang-format and
compiler-rt/lib/sanitizer_common/.clang-format use
"BasedOnStyle: Google", so pointer alignment becomes "Type* name"
throughout.

    [3 lines not shown]
DeltaFile
+182-188compiler-rt/lib/asan/asan_allocator.cpp
+55-53compiler-rt/lib/asan/asan_allocator.h
+53-52compiler-rt/lib/asan/asan_malloc_linux.cpp
+43-47compiler-rt/lib/asan/asan_new_delete.cpp
+35-31compiler-rt/lib/asan/tests/asan_noinst_test.cpp
+12-12compiler-rt/lib/asan/asan_malloc_mac.cpp
+380-3836 files

LLVM/project ab0e26fllvm/utils/lit/lit/llvm fn_selection.py fn_param.py, llvm/utils/lit/tests fn-selection.py fn-filter-checks.py

[lit] Add lit.llvm.fn_selection: opt-in select-function pass via --param fn-pass
DeltaFile
+25-0llvm/utils/lit/tests/fn-selection.py
+16-0llvm/utils/lit/lit/llvm/fn_selection.py
+10-0llvm/utils/lit/tests/Inputs/fn-selection/lit.cfg
+3-3llvm/utils/lit/lit/llvm/fn_param.py
+4-0llvm/utils/lit/tests/fn-filter-checks.py
+2-0llvm/utils/lit/tests/Inputs/fn-selection/sample.ll
+60-36 files

LLVM/project 841be17llvm/utils/lit/lit/llvm fn_extract.py, llvm/utils/lit/tests fn-extract.py fn-filter-checks.py

[lit] Add lit.llvm.fn_extract: --param fn=NAMES prepends llvm-extract
DeltaFile
+26-0llvm/utils/lit/tests/fn-extract.py
+19-0llvm/utils/lit/tests/Inputs/fn-extract/lit.cfg
+19-0llvm/utils/lit/lit/llvm/fn_extract.py
+17-0llvm/utils/lit/tests/Inputs/fn-filter-checks/sample.ll
+15-0llvm/utils/lit/tests/Inputs/fn-filter-checks/lit.cfg
+10-0llvm/utils/lit/tests/fn-filter-checks.py
+106-04 files not shown
+114-310 files

LLVM/project 4085538llvm/test lit.cfg.py, llvm/utils/lit/lit/llvm fn_param.py

[lit] Add lit.llvm.fn_param shared helper for --param fn= substitutions
DeltaFile
+46-0llvm/utils/lit/lit/llvm/fn_param.py
+6-0llvm/test/lit.cfg.py
+52-02 files

LLVM/project ec42c02llvm/include/llvm/FileCheck FileCheck.h, llvm/lib/FileCheck FileCheck.cpp FileCheckImpl.h

[FileCheck] Add --filter-label to drop CHECKs outside selected CHECK-LABEL sections
DeltaFile
+51-0llvm/test/FileCheck/filter-label.txt
+24-0llvm/lib/FileCheck/FileCheck.cpp
+12-0llvm/utils/FileCheck/FileCheck.cpp
+5-0llvm/lib/FileCheck/FileCheckImpl.h
+5-0llvm/include/llvm/FileCheck/FileCheck.h
+97-05 files

LLVM/project 830b8c0utils/bazel/llvm-project-overlay/clang/include/clang/Config config.h

[bazel] Add CLANG_USE_EXPERIMENTAL_CONST_INTERP (fixup for #199396)
DeltaFile
+3-0utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
+3-01 files

LLVM/project 3fc7e96llvm/utils/lit/lit/llvm fn_selection.py fn_param.py, llvm/utils/lit/tests fn-selection.py fn-filter-checks.py

[lit] Add lit.llvm.fn_selection: opt-in select-function pass via --param fn-pass
DeltaFile
+25-0llvm/utils/lit/tests/fn-selection.py
+16-0llvm/utils/lit/lit/llvm/fn_selection.py
+10-0llvm/utils/lit/tests/Inputs/fn-selection/lit.cfg
+3-3llvm/utils/lit/lit/llvm/fn_param.py
+4-0llvm/utils/lit/tests/fn-filter-checks.py
+2-0llvm/utils/lit/tests/Inputs/fn-selection/sample.ll
+60-36 files

LLVM/project d924db3llvm/utils/lit/lit/llvm fn_extract.py, llvm/utils/lit/tests fn-extract.py fn-filter-checks.py

[lit] Add lit.llvm.fn_extract: --param fn=NAMES prepends llvm-extract
DeltaFile
+26-0llvm/utils/lit/tests/fn-extract.py
+19-0llvm/utils/lit/lit/llvm/fn_extract.py
+19-0llvm/utils/lit/tests/Inputs/fn-extract/lit.cfg
+17-0llvm/utils/lit/tests/Inputs/fn-filter-checks/sample.ll
+15-0llvm/utils/lit/tests/Inputs/fn-filter-checks/lit.cfg
+10-0llvm/utils/lit/tests/fn-filter-checks.py
+106-04 files not shown
+114-310 files

LLVM/project b510548compiler-rt/lib/asan asan_allocator.cpp

[asan] NFC: tag ambiguous literal args at Allocate call sites (#200615)

Groundwork for #200478

Add /*name=*/ comments to ambiguous literal call-site arguments in
compiler-rt/lib/asan/asan_allocator.cpp so the parameter name is visible
at the call site for the Allocate / instance.Allocate uses. Covers the
can_fill flag and the bare alignment literals (8, 16, 0) used by:

  asan_malloc / asan_vec_malloc / asan_realloc / asan_valloc /
  asan_pvalloc / asan_memalign / asan_aligned_alloc /
  asan_posix_memalign / asan_new / asan_new_aligned

and the internal Reallocate / Calloc paths.

NFC.

Assisted by: Claude Opus 4.7
DeltaFile
+25-17compiler-rt/lib/asan/asan_allocator.cpp
+25-171 files

LLVM/project 80ed9c8llvm/test lit.cfg.py, llvm/utils/lit/lit/llvm fn_param.py

[lit] Add lit.llvm.fn_param shared helper for --param fn= substitutions
DeltaFile
+46-0llvm/utils/lit/lit/llvm/fn_param.py
+6-0llvm/test/lit.cfg.py
+52-02 files