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

Benoit Jacob via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 19 07:33:48 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) {
----------------
bjacob wrote:

+1, i have a bunch of things I want to do that depend on this, thanks for deferring improvements to follow-up PRs!

I'm also available to help with C++ templates if needed.

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


More information about the llvm-commits mailing list