[llvm] [mlir] [MLIR] Generalize expand_shape to take shape as explicit input (PR #69267)

Gaurav Shukla via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 19 07:31:40 PDT 2024


================
@@ -952,8 +952,15 @@ struct ReshapeRewriter : public OpRewritePattern<ReshapeOp> {
       auto rtp = getRankedTensorType(op.getResult());
       auto denseTp =
           RankedTensorType::get(rtp.getShape(), rtp.getElementType());
-      auto reshape = rewriter.create<ReshapeOp>(loc, denseTp, op.getSrc(),
-                                                op.getReassociation());
+      ReshapeOp reshape;
+      if constexpr (std::is_same<ReshapeOp, tensor::ExpandShapeOp>::value) {
----------------
Shukla-Gaurav wrote:

There are issues with templated helper. There are few more things which has to be handled for this patch like fusion, I can raise a PR with this and other issues fixed. It has lots of changes, so trying to not hold it for longer. Thanks :) 

https://github.com/llvm/llvm-project/pull/69267


More information about the llvm-commits mailing list