[Mlir-commits] [mlir] [mlir][tensor][NFC] Remove dead code `tensor.extract_slice` canonicalization pattern (PR #131903)
Matthias Springer
llvmlistbot at llvm.org
Tue Mar 18 12:52:34 PDT 2025
https://github.com/matthias-springer created https://github.com/llvm/llvm-project/pull/131903
Folding a cast into an `extract_slice` does not change the result type.
>From cb6be7c67e071e4630e2d9f7a602287340165c96 Mon Sep 17 00:00:00 2001
From: Matthias Springer <mspringer at nvidia.com>
Date: Tue, 18 Mar 2025 19:21:27 +0100
Subject: [PATCH] [mlir][tensor] Remove dead code `tensor.extract_slice`
canonicalization pattern
---
mlir/lib/Dialect/Tensor/IR/TensorOps.cpp | 2 --
1 file changed, 2 deletions(-)
diff --git a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
index e5a32c0bbd4e0..2d5df07f8af4b 100644
--- a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
+++ b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
@@ -2476,8 +2476,6 @@ class ExtractSliceOpCastFolder final : public OpRewritePattern<ExtractSliceOp> {
loc, sliceOp.getType(), castOp.getSource(), sliceOp.getOffsets(),
sliceOp.getSizes(), sliceOp.getStrides(), sliceOp.getStaticOffsets(),
sliceOp.getStaticSizes(), sliceOp.getStaticStrides());
- if (newResult.getType() != sliceOp.getType())
- newResult = rewriter.create<CastOp>(loc, sliceOp.getType(), newResult);
rewriter.replaceOp(sliceOp, newResult);
return success();
}
More information about the Mlir-commits
mailing list