[Mlir-commits] [mlir] [mlir] Allow folding dynamic full size subviews (PR #140619)

Matthias Springer llvmlistbot at llvm.org
Mon May 19 17:20:53 PDT 2025


================
@@ -3206,7 +3215,7 @@ class TrivialSubViewOpFolder final : public OpRewritePattern<SubViewOp> {
 
   LogicalResult matchAndRewrite(SubViewOp subViewOp,
                                 PatternRewriter &rewriter) const override {
-    if (!isTrivialSubViewOp(subViewOp))
+    if (!isTrivialSubViewOp(rewriter, subViewOp))
       return failure();
----------------
matthias-springer wrote:

This is problematic: `isTrivialSubViewOp` creates new IR, but then you return "failure". This is not allowed in a rewrite pattern. You have to make sure that there is no change to the input IR when you return "failure".

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


More information about the Mlir-commits mailing list