[Mlir-commits] [mlir] [MLIR][ODS] Fix AllElementCountsMatch crash on dynamic shaped types (PR #183948)
Matthias Springer
llvmlistbot at llvm.org
Sun Mar 1 00:32:39 PST 2026
================
@@ -543,9 +543,18 @@ class AnyMatchOperatorTrait<list<string> names, string operator,
list<string> values = names;
}
+// Verifies that all named operands/results of a shaped type have the same
+// element count. Fails if any operand or result has dynamic dimensions, since
+// the element count cannot be determined statically.
class AllElementCountsMatch<list<string> names> :
- AllMatchSameOperatorTrait<names, ElementCount<"_self">.result,
- "element count">;
+ PredOpTrait<"all of {" # !interleave(names, ", ") # "} have same element count",
+ And<[
+ // Fail if any type has dynamic dimensions.
+ Neg<AnyMatchOperatorPred<names,
+ "!::llvm::cast<::mlir::ShapedType>($_self.getType()).hasStaticShape()">>,
----------------
matthias-springer wrote:
What happens if the operand is not a shaped type?
https://github.com/llvm/llvm-project/pull/183948
More information about the Mlir-commits
mailing list