[Mlir-commits] [mlir] f304fd0 - [mlir][tensor][NFC] Remove dead code `tensor.extract_slice` canonicalization pattern (#131903)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Mar 19 00:35:43 PDT 2025
Author: Matthias Springer
Date: 2025-03-19T08:35:40+01:00
New Revision: f304fd0d5c79024954f198a4714df6957cff5eef
URL: https://github.com/llvm/llvm-project/commit/f304fd0d5c79024954f198a4714df6957cff5eef
DIFF: https://github.com/llvm/llvm-project/commit/f304fd0d5c79024954f198a4714df6957cff5eef.diff
LOG: [mlir][tensor][NFC] Remove dead code `tensor.extract_slice` canonicalization pattern (#131903)
Folding a cast into an `extract_slice` does not change the result type.
Added:
Modified:
mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
Removed:
################################################################################
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