[Mlir-commits] [mlir] 35dd3a6 - [mlir][SME][nfc] Clarify the usage of insertion guard (#67668)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Sep 29 09:34:01 PDT 2023


Author: Andrzej WarzyƄski
Date: 2023-09-29T17:33:57+01:00
New Revision: 35dd3a6475ba968872bda99b70f63b74c4a0535f

URL: https://github.com/llvm/llvm-project/commit/35dd3a6475ba968872bda99b70f63b74c4a0535f
DIFF: https://github.com/llvm/llvm-project/commit/35dd3a6475ba968872bda99b70f63b74c4a0535f.diff

LOG: [mlir][SME][nfc] Clarify the usage of insertion guard (#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.

Added: 
    

Modified: 
    mlir/lib/Conversion/VectorToArmSME/VectorToArmSME.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/VectorToArmSME/VectorToArmSME.cpp b/mlir/lib/Conversion/VectorToArmSME/VectorToArmSME.cpp
index 46527d38b9bd456..6f95c8eb6b4264f 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