[LV] Handle sunk reverse VPInstruction in planContainsAdditionalSimps.
Licm can now sink reverse VPInstructions outside the loop region; they
won't be considered when computing costs. Account for that in
planContainsAdditionalSimplifications.
Fixes https://github.com/llvm/llvm-project/issues/183592.
[DAG] isKnownToBeAPowerOfTwo - add ISD::EXTRACT_VECTOR_ELT handling (#183924)
Initialize DemandedElts mask when the index is constant and inbounds, otherwise check all elements.
[mlir][tensor] Remove hard-coded types from `ConstantOpExtractSliceFolder` (#184013)
Use the `Attribute` API, which works with arbitrary element types.
[clang][NFC][diagnostics] Remove several uses of `getCustomDiagID()` (#172532)
This change converts all existing uses of `getCustomDiagID()` within the
`clang/AST` library into regular diagnostics defined in
`DiagnosticASTKinds.td`.
This is mostly just cleanup, but it will also help with future changes
to the diagnostic system by letting us focus on the custom diagnostic
scenarios that _don't_ fit into the usual pre-declared diagnostic
scenario.
[VPlan] Support arbitrary predicated early exits. (#182396)
This removes the restriction requiring a single predicated early exit.
Using MaskedCond, we only combine early-exit conditions with block
masks from non-exiting control flow.
This means we have to ensure that we check the early exit conditions in
program order, to make sure we take the first exit in program order that
exits at the first lane for the combined exit condition.
To do so, sort the exits by their reverse post-order numbers.
Depends on https://github.com/llvm/llvm-project/pull/182395
PR: https://github.com/llvm/llvm-project/pull/182396
[SLP]Do not vectorize select nodes with scalar and vector conditions
If the select nodes contains selects with mixed scalar/vector
conditions, such nodes should not be revectorized.
Fixes #170836
[VectorCombine] Fold sign-bit check for multiple vectors (#182911)
## Alive2 proofs
| Reduction | Shift | Cmp | Sources | Proof |
|-----------|-------|----------|---------|-------|
| add | lshr | == 0 | 2 | [proof](https://alive2.llvm.org/ce/z/f44vco) |
| add | lshr | == 8 | 2 | [proof](https://alive2.llvm.org/ce/z/Ks_nea) |
| add | ashr | == 0 | 2 | [proof](https://alive2.llvm.org/ce/z/ZsXJ5k) |
| add | ashr | == -8 | 2 | [proof](https://alive2.llvm.org/ce/z/HZfans)
|
| add | lshr | == 0 | 3 | [proof](https://alive2.llvm.org/ce/z/x-dEdz) |
| add | lshr | == 12 | 3 | [proof](https://alive2.llvm.org/ce/z/sfNvhr)
|
These proofs are not very exhaustive, but somewhat show that it works
for addition. Apart from the fact that we use multiple vectors, the
proofs from the previous changes generally apply here as well because we
effectively match on reductions of size M x N.
[mlir][python] Add stable ABI (abi3) support (#183856)
Add `MLIR_ENABLE_PYTHON_STABLE_ABI` cmake flag to build bindings against
the Python limited/stable API (abi3 / PEP 384). This allow for
compatibility across different >=3.12 versions with a single .so /
wheel. We also require CMake >=3.26.
The stable ABI restricts usage to a subset of the CPython C API: frame
and code object structs are opaque, so introspection APIs like
`PyCode_Addr2Location`, `PyFrame_GetLasti`, and `PyFrame_GetCode` are
unavailable. The traceback-based auto-location logic is dropped because
we don’t have stable ABI to produce complete locations.
Assisted-by: claude
[mlir][test] Fix crash in ReifyBoundOp with invalid 'type' attribute (#184004)
The `ReifyBoundOp::getBoundType()` called `llvm_unreachable("invalid
bound type")` when the `type` attribute was set to a value other than
"EQ", "LB", or "UB" (e.g., "scalable"). This caused an abort instead of
a user-visible diagnostic.
Add a verification check that rejects invalid `type` values with a
proper error message before `getBoundType()` is ever called.
Fixes #128805
[MLIR][ODS] Fix AllElementCountsMatch crash on dynamic shaped types (#183948)
The AllElementCountsMatch trait called ShapedType::getNumElements() on
operands or results with dynamic dimensions, which unconditionally
asserts hasStaticShape(). This caused mlir-opt to crash instead of
failing gracefully when the trait was used with dynamically-shaped
types.
Fix this by rewriting AllElementCountsMatch to use an And<> predicate
combining Neg<AnyMatchOperatorPred> (requiring all types to be
statically shaped) with AllMatchSameOperatorPred (requiring equal
element counts). When any type has dynamic dimensions the verification
now fails with a diagnostic instead of crashing.
Update the regression test to expect a verification failure rather than
success when dynamic shapes are present.
Fixes #159740
[mlir][scf] Fix crash in ForOp verifier when body block has no arguments (#183946)
A malformed `scf.for` whose body block contains no arguments caused
`getRegionIterArgs()` to crash via an out-of-bounds `drop_front(1)`
call. This happened because `verifyLoopLikeOpInterface` (a
`verifyRegionTrait`) invokes `getRegionIterArgs()` during
`verifyRegionInvariants`, which runs before `verifyRegions()` has a
chance to report a proper diagnostic.
Fix by adding an explicit check in `ForOp::verify()` (which runs in
`verifyInvariants`, before any region trait verifiers execute) that
ensures the body block has at least as many arguments as there are
induction variables. This prevents the crash and produces a clear error
message.
Fixes #159737
[ARM] tADDrSPi no side effects change (#183071)
This is pulled out of #182771 in case it causes issues. The mis-compile
I believe is no longer present, as tADDrSPi is used in several test
cases which do not change due to of marking tADDrSPi as not affect side
effects.
[TTI] Remove TargetLibraryInfo from IntrinsicCostAttributes (NFC) (#183764)
This is a remnant from when `sincos` costs used the vector mappings from
`TargetLibraryInfo::getVectorMappingInfo`.
[MLIR][SymbolTable] Fix crash when SymbolTable is built on unverified IR (#183945)
The SymbolTable::SymbolTable constructor asserted that all symbol names
in the region were unique. This could cause mlir-opt to crash instead of
producing a proper diagnostic when the IR contained both:
1. An IsolatedFromAbove op (e.g., irdl.dialect) with a symbol user that
looks up symbols in an ancestor symbol table, and
2. Duplicate symbols in that ancestor (e.g., two func.func @test).
The crash occurred because IsolatedFromAbove ops are verified in
verifyOnExit() before verifyRegionInvariants() runs the SymbolTable
trait's verifyRegionTrait (which produces the proper duplicate-symbol
diagnostic). When the isolated op's symbol use verification triggered
SymbolTableCollection::getSymbolTable() on the ancestor, the constructor
would assert instead of gracefully handling the invalid-but-not-yet-
reported duplicate symbols.
The fix removes the assertion and silently skips duplicate symbol
[7 lines not shown]