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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Nov 9 23:20:56 PST 2023


Author: Felix Schneider
Date: 2023-11-10T08:20:51+01:00
New Revision: 6343ee7292f75cbd331510cb7fbef265d775083c

URL: https://github.com/llvm/llvm-project/commit/6343ee7292f75cbd331510cb7fbef265d775083c
DIFF: https://github.com/llvm/llvm-project/commit/6343ee7292f75cbd331510cb7fbef265d775083c.diff

LOG: [mlir] Fix handling of "no rank reduction" case in two Patterns (#71293)

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()`.

Added: 
    

Modified: 
    mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
    mlir/lib/Dialect/Tensor/Transforms/MergeConsecutiveInsertExtractSlicePatterns.cpp

Removed: 
    


################################################################################
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