[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]
[ARM] Explicitly mark certain instructions as having no side effects. (#182771)
This goes through some Arm instructions and adds hasSideEffects = 0 to
ones where it was not already implied. This should help with scheduling
and instruction movement.
Attributor: Avoid calling identifyDefaultAbstractAttributes on declarations (#182663)
Previously it would be called and inserted into a visited map,
but would never be used. This could possibly go one step further
and never add declarations to the SetVector of Functions. If I try
that, only one call graph printing test fails.
[clang-repl] fix CleanUpPTU by removing decl according to C implicitly FuncitonDecl. (#178648)
fix #171440
---------
Co-authored-by: Vassil Vassilev <v.g.vassilev at gmail.com>
[mlir][IR] Generalize `DenseElementsAttr` to custom element types (#183920)
`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
[26 lines not shown]
[AArch64][test] Add i256 codegen baseline tests (#183587)
## Summary
Add baseline codegen tests for i256 operations on AArch64:
- `bitcnt-i256.ll`: ctpop, ctlz, cttz, Hamming distance, parity (3 RUN
lines: +neon, +sve, +cssc)
- `cmp-i256.ll`: 8 icmp variants (slt/sgt/sle/sge/ult/ugt/ule/uge) +
select
- `div-i256.ll`: udiv, sdiv, urem, srem, power-of-2, and constant
division
- `mul-i256.ll`: multiply, multiply-by-constant, add, sub, and, or, xor
- `shift-i256.ll`: variable shl/lshr/ashr, constant shifts, narrow (i32)
amounts
These are test-only NFC pre-patches for `__int256` builtin type support
(#182733). i256 is already a valid LLVM IR type; these tests capture the
current baseline codegen. The main PR will update the CHECK lines to
show codegen improvements (e.g., direct libcall routing for
[17 lines not shown]
[ASan] Mark recent integration tests as accordingly for MSVC (#135889)
Both of these tests will cause an unsuccessful pass when using msvc.
`shadowed-stack-serialization.cpp` - XFAIL due to the metadata not being
generated.
`fakeframe-right-redzone.cpp` - UNSUPPORTED due to the optimization
limitations of the msvc compiler.
---------
Co-authored-by: MacGyver Codilla <mcodilla at microsoft.com>
[compiler-rt][CMake] Fix build when specifying --stdlib= (with 2 dashes) (#136111)
You can pass the stdlib argument either as -stdlib and --stdlib - the
previous regex did not account for this however - which caused the build
to fail, as a --stdlib argument would be replaced with a single dash,
causing clang to assume reading from stdin and the build to fail:
clang++: error: -E or -x required when input is from standard input
clang++: error: cannot specify -o when generating multiple output files
The files
[libcxxabi/CMakeLists.txt](https://github.com/llvm/llvm-project/blob/bf6986f9f09f79da38006a83c339226c429bb686/libcxxabi/CMakeLists.txt#L261)
and
[libunwind/CMakeLists.txt](https://github.com/llvm/llvm-project/blob/bf6986f9f09f79da38006a83c339226c429bb686/libunwind/CMakeLists.txt#L257)
account for this by removing --stdlib first.
Co-authored-by: Vitaly Buka <vitalybuka at google.com>
[Clang][TableGen] Sort undocumented builtins after documented ones in generated docs (#183938)
The builtin documentation emitter previously sorted all categories
purely alphabetically, which placed the "Undocumented" section before
categories like "WMMA" in the generated RST. This made the output
confusing since stub entries appeared before real documentation.
Push the "Undocumented" category to the end of the output so that all
documented categories appear first, regardless of their names.
[MLIR][Python] Add support of `convert_region_types` and the bf integration test (#183664)
This PR adds the `convert_region_types` API to
`ConversionPatternRewriter` and introduces a new integration test,
`bf.py`, which demonstrates how to combine a Python-defined dialect, the
dialect conversion API, the pass manager, and the execution engine to
build a pure-Python JIT compilation pipeline.
[AMDGPU] Stop treating AMDGPU_CS_ChainPreserve as a module entry funtion (#183718)
Starting with AMD PAL metadata v3.6, pipeline ELFs cannot have a
`.shader_functions` section. However, dynamic VGPR retry helpers use
the `AMDGPU_CS_ChainPreserve` calling convention, which LLVM previously
treated as a module entrypoint, incorrectly emitting this metadata.