From f080f1122f42ec71571081343f7ef2dcc237a02c Mon Sep 17 00:00:00 2001 From: Oleg Shyshkov Date: Thu, 30 Mar 2023 23:18:21 +0200 Subject: [PATCH] [mlir][scf] Create constants for tiling in parent with isolated region. FuncOp is IsolatedFromAbove, so this change doesn't alter current behaviour, but the current code fails if the tile op is in an op with IsolatedFromAbove trait. An alternative would be to create constant in the same region where they're used a rely on CSE to figure out where to move them. Differential Revision: https://reviews.llvm.org/D147273 --- mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp index ec116df700aa..544a863c8ffe 100644 --- a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp +++ b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp @@ -37,7 +37,9 @@ scf::SCFTilingOptions::setTileSizes(ArrayRef ts) { tileSizeComputationFunction = [tileSizes](OpBuilder &b, Operation *op) { OpBuilder::InsertionGuard guard(b); b.setInsertionPointToStart( - &op->getParentOfType().getBody().front()); + &op->getParentWithTrait() + ->getRegion(0) + .front()); return llvm::to_vector<4>(map_range(tileSizes, [&](int64_t s) { Value v = b.create(op->getLoc(), s); return v;