[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.
[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.
[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]
[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.
[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>
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
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
[WebAseembly] Fix -Wunused-variable in #181755
This variable ends up being unused in builds without assertions. Mark it
[[maybe_unused]] per the coding standards.
[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)
[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
[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.
[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
Revert "[Metal][HLSL] Add support for dumping reflection" (#183818)
Reverts llvm/llvm-project#181258
`env PATH=""` will prevent finding any binary run by `env`.
[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>
[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
[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
[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