[AArch64][PAC] Emit `!dbg` locations in `*_vfpthunk_` functions (#179688)
The usage of pointers to member functions with Pointer Authentication
requires generation of `*_vfpthunk_` functions. These thunk functions
can be later inlined and optimized by replacing the indirect call
instruction with a direct one and then inlining that function call.
In absence of `!dbg` metadata attached to the original call instruction,
such inlining ultimately results in an assertion "!dbg attachment points
at wrong subprogram for function" in the assertions-enabled builds. By
manually executing `opt` with `-verify-each` option on the LLVM IR
produced by the frontend, an actual issue can be observed: "inlinable
function call in a function with debug info must have a !dbg location"
after the replacement of indirect call instruction with the direct one
takes place.
This commit fixes the issue by attaching artificial `!dbg` locations to
the original call instruction (as well as most other instructions in
`*_vfpthunk_` function) the same way it is done for other
compiler-generated helper functions.
[mlir][affine] Fix crash in linearize_index fold when multi-index is ub.poison (#183816)
`AffineLinearizeIndexOp::fold` guarded the constant-folding path with
`llvm::is_contained(adaptor.getMultiIndex(), nullptr)`, which only
catches operands that have not been evaluated at all. When an operand
folds to `ub.PoisonAttr`, the attribute is non-null so the guard passed,
and the subsequent `cast<IntegerAttr>(indexAttr)` call crashed with an
assertion failure.
Fix by replacing the null-only check with one that requires every
multi-index attribute to be a concrete `IntegerAttr`, returning
`nullptr` for any other attribute (including null and PoisonAttr).
Fixes #178204
[mlir] Fix crash in testNoSkipErasureCallbacks on empty blocks (#183757)
The `noSkipBlockErasure` callback in `testNoSkipErasureCallbacks` called
`block->front().getParentRegion()` to get the parent region of a block.
This dereferences the ilist sentinel node when the block has no
operations, triggering an assertion failure.
Use `block->getParent()` instead, which directly returns the region
containing the block without requiring any operations to be present.
Fixes #183511
[mlir][test-ir-visitors] Fix noSkipBlockErasure crash with block args used across blocks (#183828)
The noSkipBlockErasure callback in TestVisitors.cpp dropped uses of op
results within the same region before erasing a block, but did not drop
uses of the block's own arguments (e.g. function entry block arguments).
When the block was subsequently erased its block arguments were
destroyed while their use-lists were still non-empty, triggering the
assertion in IRObjectWithUseList::~IRObjectWithUseList().
Fix this by also iterating over the block's arguments and dropping any
uses that belong to the same parent region. This mirrors the existing
logic for op result uses and makes the block-erasure walk handle IRs
where function arguments are consumed by ops in sibling blocks.
Also replace `block->front().getParentRegion()` with
`block->getParent()` for robustness (avoids UB when the block has no
ops).
Add a regression test based on the reproducer from
[2 lines not shown]
[mlir][tensor] Fix crash in expand_shape fold with dynamic result type (#183785)
`foldReshapeOp` (in `ReshapeOpsUtils.h`) and `FoldReshapeWithConstant`
(in `TensorOps.cpp`) both tried to create a new `DenseElementsAttr`
constant when folding a reshape op whose operand is a constant. Neither
checked that the result type was statically shaped before doing so, but
`DenseElementsAttr::reshape()` and
`DenseElementsAttr::getFromRawBuffer()` both assert `hasStaticShape()`.
Guard both fold paths with a `hasStaticShape()` check so they return
early when the result type contains a dynamic dimension.
Fixes #177845
[CMake][LLVM] Disable PCH on Clang for file with custom flags too (#183813)
Precompiled headers are already skipped when building ConstantFolding.cpp with MSVC, they cause problems with Clang too so disable it there the same way.
[ARM][MVE] Add SLI and SRI recognition. (#183471)
This uses the newly added code from #182051 to optimize to MVE sli and
sri. The only major difference is the legal types supported, but we also
lower intrinsics via VSLIIMM/VSLIIMM, so that only one tablegen pattern
is needed.
[llvm][DebugInfo] Bump DWARFListTable maximum DWARF version (#183859)
Bumps `.debug_rnglists` maximum supported version to DWARFv6.
This does not mean we officially support DWARFv6. It just enables us
testing the features gradually.
Added unit-test since there was no prior test in the entire LLVM
test-suite that checked this.
[llvm][DebugInfo] Bump DWARFDebugLine maximum DWARF version (#183841)
Bumps `.debug_line` maximum supported version to DWARFv6.
This does not mean we officially support DWARFv6. It just enables us
testing the features gradually.
[llvm][DebugInfo] Bump DWARFContext maximum DWARF version (#183838)
In order to start testing DWARFv6 feature support we need to bump this
version for tooling to work.
This does not mean we officially support DWARFv6. It just enables us
testing the features gradually.
[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
[clang] Backport: stop error recovery in SFINAE for narrowing in converted constant expressions
A narrowing conversion in a converted constant expression should produce an
invalid expression so that [temp.deduct.general]p7 is satisfied, by stopping
substitution at this point.
Fixes #167709
[clang] create local instantiation scope for matching template template parameters
This fixes a bug where a partial substitution from the enclosing scope
is used to prepopulate an unrelated template argument deduction.
Backport from #183219
Fixes #181166
[analyzer] Fix crash in MallocChecker when a function has both ownership_returns and ownership_takes (#183583)
When a function was annotated with both `ownership_returns` and
`ownership_takes` (or `ownership_holds`), MallocChecker::evalCall would
fall into the freeing-only branch (isFreeingOwnershipAttrCall) and call
checkOwnershipAttr without first calling MallocBindRetVal. That meant no
heap symbol had been conjured for the return value, so
checkOwnershipAttr later dereferenced a null/invalid symbol and crashed.
Fix: merge the two dispatch branches so that MallocBindRetVal is always
called first whenever ownership_returns is present, regardless of
whether the function also carries ownership_takes/ownership_holds.
The crash was introduced in #106081
339282d49f5310a2837da45c0ccc19da15675554.
Released in clang-20, and crashing ever since.
Fixes #183344.
[2 lines not shown]
[Clang] Don't diagnose missing members when looking at the instantiating class template
This backports https://github.com/llvm/llvm-project/pull/180725 to Clang
22.
The perfect matching patch revealed another bug where recursive
instantiations could lead to the escape of SFINAE errors, as shown in
the issue.
RISCVMCAsmInfo: Remove redundant `UseAtForSpecifier = false`. NFC (#183890)
UseAtForSpecifier defaults to false in MCAsmInfo, and RISCVMCAsmInfo
never calls initializeAtSpecifiers (which sets it to true).
[Hexagon] Fix extractHvxSubvectorPred shuffle mask for small predicates (#181364)
The loop generating the shuffle mask in extractHvxSubvectorPred used
HwLen/ResLen as the iteration count, but each iteration produces 8
elements (ResLen * Rep where Rep = 8/ResLen). This means the total mask
size was (HwLen/ResLen) * 8, which only equals HwLen when ResLen == 8.
For smaller predicate subvectors (e.g., <4 x i1> or <2 x i1>), the mask
was too large, causing an assertion failure in getVectorShuffle.
Fix by using HwLen/8 as the loop bound, which correctly produces HwLen
elements regardless of ResLen.
(cherry picked from commit c3a86ff2d0b397d757345fad7e29c2a6e7dbc823)
[mlir][IR] Generalize `DenseElementsAttr` to custom element types (#179122)
`DenseElementsAttr` supports only a hard-coded list of element types:
`int`, `index`, `float`, `complex`. This commit generalizes the
`DenseElementsAttr` infrastructure: it now supports arbitrary element
types, as long as they implement the new `DenseElementTypeInterface`.
The `DenseElementTypeInterface` has the following helper functions:
- `getDenseElementBitSize`: Query the size of an element in bits. (When
storing an element in memory, each element is padded to a full byte.
This is an existing limitation of the `DenseElementsAttr`; with an
exception for `i1`.)
- `convertToAttribute`: Attribute factory / deserializer. Converts bytes
into an MLIR attribute. The attribute provides the assembly format /
printer for a single element.
- `convertFromAttribute`: Serializer. Converts an MLIR attribute into
bytes.
Note: `convertToAttribute` / `convertFromAttribute` are mainly for
[23 lines not shown]
InstCombine: Stop applying nofpclass from use nofpclass attribute (#183835)
Functionally reverts a80d4329ce96856a02bd279c800c3d08619da4c9, with new
test.
This should be applied somewhere, but this is the wrong place.
Fixes regression reported after #182444
[lldb/test] Skip TestDelayInitDependency on remote platforms (#183885)
This test exercises macOS-specific linker functionality (-delay_library)
and uses a hardcoded local working directory for the launch info. It
should not run against a remote platform where neither condition holds.
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
[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