summaryrefslogtreecommitdiff
path: root/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
diff options
context:
space:
mode:
authorAndrzej WarzyƄski <andrzej.warzynski@arm.com>2024-07-24 14:40:19 +0100
committerGitHub <noreply@github.com>2024-07-24 14:40:19 +0100
commit1f5807eb359fb172575e18bb063fd85e4dc836e9 (patch)
treeb5b73a22af23d2ad5f0b0ec5a515d3930311071c /mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
parentde8c4bef3329ce0045b8167cdb96d53b2a1509df (diff)
[mlir][vector][nfc] Simplify `in_bounds` attr update (#100334)
Since the `in_bounds` attribute is mandatory, there's no need for logic like this (`readOp.getInBounds()` is guaranteed to return a non-empty ArrayRef): ```cpp ArrayAttr inBoundsAttr = readOp.getInBounds() ? rewriter.getArrayAttr( readOp.getInBoundsAttr().getValue().drop_back(dimsToDrop)) : ArrayAttr(); ``` Instead, we can do this: ```cpp ArrayAttr inBoundsAttr = rewriter.getArrayAttr( readOp.getInBoundsAttr().getValue().drop_back(dimsToDrop)); ``` This is a small follow-up for #97049 - this change should've been included there.
Diffstat (limited to 'mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp')
-rw-r--r--mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
index 2686277bba59..6777e589795c 100644
--- a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
@@ -1321,11 +1321,8 @@ class DropInnerMostUnitDimsTransferRead
cast<MemRefType>(memref::SubViewOp::inferRankReducedResultType(
srcType.getShape().drop_back(dimsToDrop), srcType, offsets, sizes,
strides));
- ArrayAttr inBoundsAttr =
- readOp.getInBounds()
- ? rewriter.getArrayAttr(
- readOp.getInBoundsAttr().getValue().drop_back(dimsToDrop))
- : ArrayAttr();
+ ArrayAttr inBoundsAttr = rewriter.getArrayAttr(
+ readOp.getInBoundsAttr().getValue().drop_back(dimsToDrop));
Value rankedReducedView = rewriter.create<memref::SubViewOp>(
loc, resultMemrefType, readOp.getSource(), offsets, sizes, strides);
auto permMap = getTransferMinorIdentityMap(
@@ -1415,11 +1412,8 @@ class DropInnerMostUnitDimsTransferWrite
cast<MemRefType>(memref::SubViewOp::inferRankReducedResultType(
srcType.getShape().drop_back(dimsToDrop), srcType, offsets, sizes,
strides));
- ArrayAttr inBoundsAttr =
- writeOp.getInBounds()
- ? rewriter.getArrayAttr(
- writeOp.getInBoundsAttr().getValue().drop_back(dimsToDrop))
- : ArrayAttr();
+ ArrayAttr inBoundsAttr = rewriter.getArrayAttr(
+ writeOp.getInBoundsAttr().getValue().drop_back(dimsToDrop));
Value rankedReducedView = rewriter.create<memref::SubViewOp>(
loc, resultMemrefType, writeOp.getSource(), offsets, sizes, strides);