LLVM/project 7886257llvm/lib/Analysis BasicAliasAnalysis.cpp

[NFC] Fix use-after-free: track TargetLibraryAnalysis in BasicAAResult invalidation (#183852)

`BasicAAResult` holds a reference to `TargetLibraryInfo` but its
`invalidate()` function did not check `TargetLibraryAnalysis`. When the
pass manager destroyed and re-created `TLI` (e.g. during `CGSCC`
invalidation or `FAM.clear()`), `BasicAAResult` survived with a dangling
`TLI` reference.

This was exposed by #157495 which added `aliasErrno()`, the first code
path that dereferences `TLI` from `BasicAAResult` during the `CGSCC`
pipeline, causing a AV when compiling Rust's core library on Arm64
Windows.

This change adds `TargetLibraryAnalysis` to the invalidation check so
`BasicAAResult` is properly invalidated when its `TLI` reference becomes
stale.
DeltaFile
+2-1llvm/lib/Analysis/BasicAliasAnalysis.cpp
+2-11 files

LLVM/project a99ff99llvm/lib/Transforms/Instrumentation HWAddressSanitizer.cpp, llvm/test/Instrumentation/HWAddressSanitizer use-after-scope.ll

improve

Created using spr 1.3.7
DeltaFile
+8-4llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+4-4llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll
+12-82 files

LLVM/project c59f3ebllvm/include/llvm/Transforms/Utils MemoryTaggingSupport.h, llvm/lib/Transforms/Utils MemoryTaggingSupport.cpp

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

Created using spr 1.3.7

[skip ci]
DeltaFile
+18-51llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll
+11-16llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
+4-3llvm/test/CodeGen/AArch64/stack-tagging.ll
+0-4llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h
+33-744 files

LLVM/project 13954e4llvm/include/llvm/Transforms/Utils MemoryTaggingSupport.h, llvm/lib/Transforms/Instrumentation HWAddressSanitizer.cpp

[𝘀𝗽𝗿] initial version

Created using spr 1.3.7
DeltaFile
+44-52llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll
+11-16llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
+14-5llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+4-3llvm/test/CodeGen/AArch64/stack-tagging.ll
+0-4llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h
+73-805 files

LLVM/project e35fc30clang/lib/Sema HLSLBuiltinTypeDeclBuilder.cpp

Fix `BuiltinTypeMethodBuilder` uninitialized pointer (#183814)

From [this
comment](https://github.com/llvm/llvm-project/pull/176058/changes/BASE..50c5be4bdf19a8a80b7e6e9d3ae46e11ff20a6e0#r2856661750)
on PR #176058, static analysis was flagging `TemplateParams` as not
initialized on all paths. This change fixes it by initializing to
`nullptr` at declaration.
DeltaFile
+2-2clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp
+2-21 files

LLVM/project 0a9b5d5libcxx/include/__algorithm find_if_not.h find.h

[libc++] Forward find* algorithms to find_if (#179938)

This propagates any optimizations to the whole family of `find`
functions.
DeltaFile
+20-4libcxx/include/__algorithm/find_if_not.h
+10-8libcxx/include/__algorithm/find.h
+12-4libcxx/include/__algorithm/find_if.h
+3-12libcxx/include/__algorithm/ranges_find_if.h
+3-8libcxx/include/__algorithm/ranges_find_if_not.h
+2-3libcxx/include/__algorithm/ranges_remove_if.h
+50-396 files

LLVM/project c5588belldb/test/API/lang/cpp/gmodules/alignment TestPchAlignment.py, lldb/test/API/lang/cpp/gmodules/basic TestWithModuleDebugging.py

[lldb] Add skip shared build to more API tests

Fixing test failures on my local desktop with incremental
building.
DeltaFile
+2-0lldb/test/API/lang/cpp/gmodules/alignment/TestPchAlignment.py
+2-0lldb/test/API/lang/cpp/gmodules/basic/TestWithModuleDebugging.py
+2-0lldb/test/API/macosx/add-dsym/TestAddDsymDownload.py
+2-0lldb/test/API/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
+8-04 files

LLVM/project abbba22lldb/examples/python formatter_bytecode.py, lldb/test/Shell/ScriptInterpreter/Python bytecode.test

[lldb] Add synthetic support to formatter_bytecode.py (#183804)

Updates formatter_bytecode.py to support compilation and disassembly for
synthetic formatters, in other words support for multiple functions
(signatures).

This includes a number of other changes:
* String parsing and encoding have bugs fixed
* CLI args are updated, primarily to support an output file
* Added uleb encoding/decoding support

This work is a prelude the ongoing work of a Python to formatter
bytecode compiler. The python compiler to emit assembly, and this module
(formatter_bytecode) will compile it into binary bytecode.
DeltaFile
+272-61lldb/examples/python/formatter_bytecode.py
+0-4lldb/test/Shell/ScriptInterpreter/Python/bytecode.test
+272-652 files

LLVM/project 7ad2c6dmlir/include/mlir/Dialect/Arith/IR ArithOpsInterfaces.td ArithOps.td, mlir/lib/Conversion/ArithToLLVM ArithToLLVM.cpp

[mlir][arith] Add `exact` to `index_cast{,ui}` (#183395)

The `exact` flag with the following semantics

> If the `exact` attribute is present, it is assumed that the index type
width
> is such that the conversion does not lose information. When this
assumption
>    is violated, the result is poison.

can be added to index_cast and index_castui operations. This unlocks
the following lowerings:

*   index_cast (signed) exact    -> trunc nsw
*   index_castui (unsigned) exact -> trunc nuw
*   index_castui nneg exact       -> trunc nuw nsw

Changes:


    [5 lines not shown]
DeltaFile
+64-0mlir/test/Dialect/Arith/canonicalize.mlir
+52-0mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
+47-0mlir/include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.td
+34-5mlir/include/mlir/Dialect/Arith/IR/ArithOps.td
+28-8mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp
+28-0mlir/test/Dialect/Arith/ops.mlir
+253-132 files not shown
+271-248 files

LLVM/project 73d655allvm/lib/Transforms/Vectorize VPlanRecipes.cpp, llvm/test/Transforms/LoopVectorize predicated-early-exits-interleave.ll

[VPlan] Support unrolling/cloning masked VPInstructions.

Account for masked VPInstruction when verifying the operands in the
constructor. Fixes a crash when trying to unroll VPlans for predicated
early exits.
DeltaFile
+254-0llvm/test/Transforms/LoopVectorize/predicated-early-exits-interleave.ll
+2-1llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+256-12 files

LLVM/project 8f268e6offload/plugins-nextgen/level_zero/include L0Program.h

[Offload] Remove unused data type (#183840)

DeltaFile
+0-14offload/plugins-nextgen/level_zero/include/L0Program.h
+0-141 files

LLVM/project cdd4313mlir/include/mlir/Conversion/LLVMCommon Pattern.h, mlir/lib/Conversion/LLVMCommon Pattern.cpp

[mlir][LLVM] Let decomposeValue/composeVale pad out larger types (#183825)

Currently, as pointed out in the reviews for #183405, decomposeValues
and composeValues should be able to emit zexts and truncations for cases
like i48 and vector<3xi16> becoming i32s but currently that's an assert.
This commit fixes that limitation.

Co-authored-by: Claude Opus 4.6 <noreply at anthropic.com>
DeltaFile
+48-0mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl.mlir
+28-9mlir/lib/Conversion/LLVMCommon/Pattern.cpp
+7-2mlir/include/mlir/Conversion/LLVMCommon/Pattern.h
+83-113 files

LLVM/project d7e037cllvm/test/Transforms/LoopVectorize iv-select-cmp-decreasing.ll vector-loop-backedge-elimination.ll, llvm/test/Transforms/LoopVectorize/AArch64 optsize_minsize.ll

Revert "[VPlan] Remove manual region removal when simplifying for VF and UF. (#181252)"

This reverts commit 9c53215d213189d1f62e8f6ee7ba73a089ac2269.

Appears to cause crashes with ordered reductions, revert while I
investigate
DeltaFile
+205-87llvm/test/Transforms/LoopVectorize/iv-select-cmp-decreasing.ll
+0-266llvm/test/Transforms/LoopVectorize/vector-loop-backedge-elimination.ll
+125-84llvm/test/Transforms/LoopVectorize/AArch64/optsize_minsize.ll
+9-187llvm/test/Transforms/LoopVectorize/epilog-vectorization-reductions.ll
+116-63llvm/test/Transforms/LoopVectorize/load-deref-pred-poison-ub-ops-feeding-pointer.ll
+68-42llvm/test/Transforms/LoopVectorize/X86/load-deref-pred.ll
+523-72916 files not shown
+816-92122 files

LLVM/project 079451cclang/lib/Analysis/Scalable/Serialization JSONFormat.cpp, clang/test/CIR/Transforms flatten-try-op.cir

rebase

Created using spr 1.3.7
DeltaFile
+1,389-1,365llvm/test/CodeGen/AMDGPU/amdgcn.bitcast.1024bit.ll
+0-1,182clang/lib/Analysis/Scalable/Serialization/JSONFormat.cpp
+638-502clang/unittests/Analysis/Scalable/Serialization/JSONFormatTest/TUSummaryTest.cpp
+834-33lldb/unittests/DAP/Inputs/linux-x86_64.core.yaml
+737-0clang/test/CIR/Transforms/flatten-try-op.cir
+550-80lldb/unittests/DAP/Inputs/linux-x86_64.out.yaml
+4,148-3,162136 files not shown
+10,645-4,317142 files

LLVM/project 839b435clang/lib/Analysis/Scalable/Serialization JSONFormat.cpp, clang/test/CIR/Transforms flatten-try-op.cir

[𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.7

[skip ci]
DeltaFile
+1,389-1,365llvm/test/CodeGen/AMDGPU/amdgcn.bitcast.1024bit.ll
+0-1,182clang/lib/Analysis/Scalable/Serialization/JSONFormat.cpp
+638-502clang/unittests/Analysis/Scalable/Serialization/JSONFormatTest/TUSummaryTest.cpp
+834-33lldb/unittests/DAP/Inputs/linux-x86_64.core.yaml
+737-0clang/test/CIR/Transforms/flatten-try-op.cir
+550-80lldb/unittests/DAP/Inputs/linux-x86_64.out.yaml
+4,148-3,162136 files not shown
+10,645-4,317142 files

LLVM/project a56f147llvm/lib/Transforms/Vectorize SLPVectorizer.cpp

Fixes

Created using spr 1.3.7
DeltaFile
+13-1llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+13-11 files

LLVM/project 4477bf6llvm/lib/Transforms/InstCombine InstCombineSimplifyDemanded.cpp, llvm/test/Transforms/InstCombine simplify-demanded-fpclass.ll

InstCombine: Stop applying nofpclass from use nofpclass attribute

Functionally reverts a80d4329ce96856a02bd279c800c3d08619da4c9, with new test.
This should be applied somewhere, but this is the wrong place.

Fixes regression reported after #182444
DeltaFile
+21-2llvm/test/Transforms/InstCombine/simplify-demanded-fpclass.ll
+0-5llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+21-72 files

LLVM/project 94bd8b9llvm/test/CodeGen/AArch64 stack-tagging.ll

[NFC] [MTE] add test for duplicated lifetime end



Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/183808
DeltaFile
+29-0llvm/test/CodeGen/AArch64/stack-tagging.ll
+29-01 files

LLVM/project 63ab568llvm/test/Instrumentation/HWAddressSanitizer use-after-scope.ll

[NFC] [HWASan] add test for duplicated lifetime end



Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/183807
DeltaFile
+328-0llvm/test/Instrumentation/HWAddressSanitizer/use-after-scope.ll
+328-01 files

LLVM/project c2f66f2llvm/lib/Target/WebAssembly WebAssemblyFixIrreducibleControlFlow.cpp

[WebAseembly] Fix -Wunused-variable in #181755

This variable ends up being unused in builds without assertions. Mark it
[[maybe_unused]] per the coding standards.
DeltaFile
+1-1llvm/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp
+1-11 files

LLVM/project a71ded3bolt/unittests/Core MCPlusBuilder.cpp

[BOLT][AArch64] Add a unittest for compare-and-branch inversion. (#181177)

Checks that isReversibleBranch() returns false
 - when the immediate value is 63 and needs +1 adjustment
 - when the immediate value is 0 and needs -1 adjustment

Checks that reverseBranchCondition() adjusts
 - the opcode
 - the immediate operand if necessary (+/-1)
 - the register operands if necessary (swap)
DeltaFile
+101-0bolt/unittests/Core/MCPlusBuilder.cpp
+101-01 files

LLVM/project b53cc9fllvm/test/CodeGen/AMDGPU llvm.exp10.f64.ll llvm.exp.f64.ll, llvm/test/CodeGen/RISCV clmul.ll clmulr.ll

Merge branch 'main' into users/evelez7/clang-doc-markdown-mustache
DeltaFile
+25,051-14,920llvm/test/CodeGen/RISCV/clmul.ll
+16,004-0llvm/test/MC/AMDGPU/gfx13_asm_vopd3.s
+13,198-0llvm/test/CodeGen/RISCV/clmulr.ll
+12,863-0llvm/test/CodeGen/RISCV/clmulh.ll
+11,178-0llvm/test/CodeGen/AMDGPU/llvm.exp10.f64.ll
+10,242-0llvm/test/CodeGen/AMDGPU/llvm.exp.f64.ll
+88,536-14,9205,570 files not shown
+407,476-142,2165,576 files

LLVM/project 1073951mlir/lib/Dialect/ControlFlow/IR ControlFlowOps.cpp, mlir/test/Dialect/ControlFlow canonicalize.mlir

[mlir][cf] Fix crash in simplifyBrToBlockWithSinglePred when branch operand is a block argument of its successor (#183797)

When `simplifyBrToBlockWithSinglePred` merges a block into its sole
predecessor, it calls `inlineBlockBefore` which replaces each block
argument with the corresponding value passed by the branch. If one of
those values is itself a block argument of the successor block, the call
`replaceAllUsesWith(arg, arg)` is a no-op. Any uses of that argument
outside the block (e.g. in a downstream block) are therefore not
replaced, and when the successor block is erased the argument is
destroyed while those uses are still live, triggering the assertion
`use_empty() && "Cannot destroy a value that still has uses\!"` in
`IRObjectWithUseList::~IRObjectWithUseList`.

Guard against this by returning early when any branch operand is a block
argument owned by the destination block.

Fixes #126213
DeltaFile
+30-0mlir/test/Dialect/ControlFlow/canonicalize.mlir
+8-0mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp
+38-02 files

LLVM/project d0afaeaclang/lib/Lex HeaderSearch.cpp, clang/test/Modules lazy-by-header-extern.c lazy-by-header-umbrella-dir.c

[clang][modulemap] Lazily load module maps by header name (#181916)

After header search has found a header it looks for module maps that
cover that header. This patch uses the parsed representation of module
maps to do this search instead of relying on FileEntryRef lookups after
stating headers in module maps.

This behavior is currently gated behind the
`-fmodules-lazy-load-module-maps` `-cc1` flag.
DeltaFile
+237-43clang/lib/Lex/HeaderSearch.cpp
+69-0clang/test/Modules/lazy-by-header-extern.c
+66-0clang/test/Modules/lazy-by-header-umbrella-dir.c
+46-0clang/test/Modules/lazy-by-header-umbrella-header.c
+46-0clang/test/Modules/lazy-by-header-nested.c
+41-0clang/test/Modules/lazy-by-header-private.c
+505-439 files not shown
+667-5515 files

LLVM/project 977702cclang/docs ReleaseNotes.rst, clang/lib/Sema SemaExpr.cpp

[clang] fix crash when casting a parenthesized unresolved template-id (#183633)

this fix uses ignoreparens() in checkplaceholderexpr to prevent a crash
when an unresolved template-id is wrapped in parentheses. fixes #183505
DeltaFile
+8-0clang/test/SemaCXX/gh183505.cpp
+2-2clang/lib/Sema/SemaExpr.cpp
+1-0clang/docs/ReleaseNotes.rst
+11-23 files

LLVM/project 2c98566clang/include/clang/Basic DiagnosticDriverKinds.td, clang/include/clang/Options Options.td

Revert "[Metal][HLSL] Add support for dumping reflection" (#183818)

Reverts llvm/llvm-project#181258

`env PATH=""` will prevent finding any binary run by `env`.
DeltaFile
+0-22clang/lib/Driver/ToolChains/HLSL.cpp
+0-8clang/test/Driver/HLSL/fre-errors.hlsl
+0-8clang/test/Driver/HLSL/metal-converter.hlsl
+0-2clang/include/clang/Basic/DiagnosticDriverKinds.td
+0-2clang/include/clang/Options/Options.td
+0-425 files

LLVM/project 02ebe23clang/docs AddressSanitizer.rst

[ASan] Document limitations of container overflow checks (#183590)

Mention that partially poisoning stack objects can
lead to false positives and negatives.

See #182720.

---------

Co-authored-by: Saleem Abdulrasool <compnerd at compnerd.org>
DeltaFile
+5-2clang/docs/AddressSanitizer.rst
+5-21 files

LLVM/project 05c3152clang/lib/AST DeclTemplate.cpp, clang/test/SemaTemplate GH181062.cpp

[clang] Backport: fix transformation of substituted constant template parameters of partial specializations

This fixes a helper so it implements retrieval of the argument replaced
for a template parameter for partial spcializations.

This was left out of the original patch, since it's quite hard to actually test.

This helper implements the retrieval for variable templates, but only for
completeness sake, as no current users rely on this, and I don't think a similar
test case is possible to implement with variable templates.

This fixes a regression introduced in #161029 which will be backported to llvm-22,
so there are no release notes.

Backport from #183348

Fixes #181062
Fixes #181410
DeltaFile
+24-0clang/test/SemaTemplate/GH181062.cpp
+10-10clang/lib/AST/DeclTemplate.cpp
+34-102 files

LLVM/project 1c043afclang/lib/AST ASTContext.cpp, clang/test/SemaTemplate GH183075.cpp

[clang] Backport: allow canonicalizing assumed template names

Assumed template names are part of error recovery and encode just a
declaration name, making them always canonical. This patch allows
them to be canonicalized, which is trivial.

Backport from #183222

Fixes #183075
DeltaFile
+13-0clang/test/SemaTemplate/GH183075.cpp
+5-2clang/lib/AST/ASTContext.cpp
+18-22 files

LLVM/project c8fa3f4clang/lib/Sema SemaCXXScopeSpec.cpp, clang/test/SemaCXX GH167120.cpp

[clang] Backport: NestedNameSpecifier typo correction fix

This stops typo correction from considering template parameters
as candidates for a NestedNameSpecifier when it has a prefix itself.

I think this is better than the alternative of accepting these candidates,
but otherwise droping the prefix, because it seems more far-fetched that
someone would actually try to refer to a template parameter this way.

Since this regression was never released, there are no release notes.

Backport from #181239

Fixes #167120
DeltaFile
+11-4clang/lib/Sema/SemaCXXScopeSpec.cpp
+5-0clang/test/SemaCXX/GH167120.cpp
+16-42 files