[Mlir-commits] [mlir] [mlir][LLVMIR] Check number of elements in `mlir.constant` verifier (PR #102906)
Tobias Gysi
llvmlistbot at llvm.org
Mon Aug 12 08:23:10 PDT 2024
================
@@ -2728,13 +2740,30 @@ LogicalResult LLVM::ConstantOp::verify() {
if (isa<IntegerType>(getType()) && !getType().isInteger(floatWidth)) {
return emitOpError() << "expected integer type of width " << floatWidth;
}
- }
- if (auto splatAttr = dyn_cast<SplatElementsAttr>(getValue())) {
- if (!isa<VectorType>(getType()) && !isa<LLVM::LLVMArrayType>(getType()) &&
- !isa<LLVM::LLVMFixedVectorType>(getType()) &&
- !isa<LLVM::LLVMScalableVectorType>(getType()))
+ } else if (isa<ElementsAttr, ArrayAttr>(getValue())) {
+ if (isa<LLVM::LLVMScalableVectorType>(getType())) {
----------------
gysit wrote:
The arith constant seems to check if the attribute is a splat elements attribute. A size check is not needed in the arith case since result and value type are equivalent...
I would suggest to keep the PR as is for now except you are up to figure out the exact semantics here. I assume the right thing would be to check for a splat elements attribute and matching scalable sizes?
https://github.com/llvm/llvm-project/pull/102906
More information about the Mlir-commits
mailing list