[Mlir-commits] [mlir] [mlir][tosa] CONCAT_SHAPE Op folder (PR #183293)
Luke Hutton
llvmlistbot at llvm.org
Wed Feb 25 05:21:41 PST 2026
================
@@ -2020,6 +2020,40 @@ OpFoldResult tosa::DimOp::fold(FoldAdaptor adaptor) {
return DenseElementsAttr::get(resultAttrTy, dimSize);
}
+OpFoldResult concatShapeFold(tosa::ConcatShapeOp *op) {
+ auto const inputs = op->getInput();
+
+ if (inputs.empty())
+ return {};
+
+ SmallVector<APInt> concatDims;
+ concatDims.reserve(/*max elem*/ 64);
+ for (auto const &v : inputs) {
+ auto vConstShape = dyn_cast<tosa::ConstShapeOp>(v.getDefiningOp());
+ if (!vConstShape)
+ return {};
+
+ const auto vAttr = cast<DenseElementsAttr>(vConstShape.getValues());
----------------
lhutton1 wrote:
Needs to be `dyn_cast`?
https://github.com/llvm/llvm-project/pull/183293
More information about the Mlir-commits
mailing list