[Mlir-commits] [mlir] [mlir][SME][nfc] Clarify the usage of insertion guard (PR #67668)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Thu Sep 28 05:53:10 PDT 2023
https://github.com/banach-space created https://github.com/llvm/llvm-project/pull/67668
Added extra comment that should clarify the need for an insertion guard
when using `getLoopOverTileSlices`. Also removed some redundant calls to
`setInsertionPointAfter` - the insertion guard would overwrite that on
destruction anyway.
>From 19bca56a8b1cd1253755eb143c8e14b951daea14 Mon Sep 17 00:00:00 2001
From: Andrzej Warzynski <andrzej.warzynski at arm.com>
Date: Thu, 28 Sep 2023 12:50:20 +0000
Subject: [PATCH] [mlir][SME][nfc] Clarify the usage of insertion guard
Added extra comment that should clarify the need for an insertion guard
when using `getLoopOverTileSlices`. Also removed some redundant calls to
`setInsertionPointAfter` - the insertion guard would overwrite that on
destruction anyway.
---
mlir/lib/Conversion/VectorToArmSME/VectorToArmSME.cpp | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/mlir/lib/Conversion/VectorToArmSME/VectorToArmSME.cpp b/mlir/lib/Conversion/VectorToArmSME/VectorToArmSME.cpp
index 20c9fb6621eb610..bba71829f703aa2 100644
--- a/mlir/lib/Conversion/VectorToArmSME/VectorToArmSME.cpp
+++ b/mlir/lib/Conversion/VectorToArmSME/VectorToArmSME.cpp
@@ -26,7 +26,8 @@ static bool isSplatZero(Type elemType, DenseElementsAttr val) {
}
/// Generates a for loop over ZA tile slices where the induction variable is
-/// the tile slice index.
+/// the tile slice index. Sets the IR Builder insertion point as the loop body.
+/// Callers of this method are responsible for restoring it if needed.
static scf::ForOp getLoopOverTileSlices(PatternRewriter &rewriter, Location loc,
Type eltType) {
auto step = rewriter.create<arith::ConstantIndexOp>(loc, 1);
@@ -226,8 +227,6 @@ struct ConstantOpToArmSMELowering : public OpRewritePattern<arith::ConstantOp> {
rewriter.create<arm_sme::MoveVectorToTileSliceOp>(
loc, tileType, constantOp1D, tile, tileSliceIndex);
- rewriter.setInsertionPointAfter(forOp);
-
rewriter.replaceOp(constantOp, tile);
return success();
@@ -293,8 +292,6 @@ struct BroadcastOpToArmSMELowering
rewriter.create<arm_sme::MoveVectorToTileSliceOp>(
loc, tileType, broadcastOp1D, tile, tileSliceIndex);
- rewriter.setInsertionPointAfter(forOp);
-
rewriter.replaceOp(broadcastOp, tile);
return success();
More information about the Mlir-commits
mailing list