[Mlir-commits] [mlir] [mlir] Fix handling of "no rank reduction" case in two Patterns (PR #71293)

Felix Schneider llvmlistbot at llvm.org
Sun Nov 5 02:13:24 PST 2023


https://github.com/ubfx updated https://github.com/llvm/llvm-project/pull/71293

>From b0bd8a26d6c4babcc693a3addaa70910289ead3e Mon Sep 17 00:00:00 2001
From: Felix Schneider <fx.schn at gmail.com>
Date: Sat, 4 Nov 2023 17:30:44 +0100
Subject: [PATCH] [mlir] Fix handling of "no rank reduction" case in two
 Patterns

This patch fixes two checks where a `SmallBitVector` containing
the potential dropped dims of a SubView/ExtractSlice operation was
queried via `empty()` instead of `none()`.
---
 mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp                        | 2 +-
 .../Transforms/MergeConsecutiveInsertExtractSlicePatterns.cpp   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
index 215a8f5e7d18be0..aba46dc0a0d33ca 100644
--- a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
+++ b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
@@ -3099,7 +3099,7 @@ struct SubViewReturnTypeCanonicalizer {
 
     // Directly return the non-rank reduced type if there are no dropped dims.
     llvm::SmallBitVector droppedDims = op.getDroppedDims();
-    if (droppedDims.empty())
+    if (droppedDims.none())
       return nonReducedType;
 
     // Take the strides and offset from the non-rank reduced type.
diff --git a/mlir/lib/Dialect/Tensor/Transforms/MergeConsecutiveInsertExtractSlicePatterns.cpp b/mlir/lib/Dialect/Tensor/Transforms/MergeConsecutiveInsertExtractSlicePatterns.cpp
index e32ddf08a769fe0..5257310f5b005b9 100644
--- a/mlir/lib/Dialect/Tensor/Transforms/MergeConsecutiveInsertExtractSlicePatterns.cpp
+++ b/mlir/lib/Dialect/Tensor/Transforms/MergeConsecutiveInsertExtractSlicePatterns.cpp
@@ -91,7 +91,7 @@ struct DropRedundantInsertSliceRankExpansion
                                 PatternRewriter &rewriter) const override {
     // Nothing to do if no dims are dropped.
     llvm::SmallBitVector droppedDims = extractSliceOp.getDroppedDims();
-    if (droppedDims.empty())
+    if (droppedDims.none())
       return failure();
 
     // Look for tensor.insert_slice op that has an inverse rank expansion.



More information about the Mlir-commits mailing list