diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp --- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp +++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp @@ -65,6 +65,15 @@ for (unsigned i = 0, e = t.getRank(); i < e; ++i) res.push_back(b.create(loc, v, i)); } + if (getNumInitTensors() == 0 && getOperation()->getNumResults() != 0) { + OpBuilder::InsertionGuard guard(b); + b.setInsertionPointAfter(getOperation()); + for (Value v : getOperation()->getResults()) { + ShapedType t = v.getType().template cast(); + for (unsigned i = 0, e = t.getRank(); i < e; ++i) + res.push_back(b.create(loc, v, i)); + } + } return res; }