[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
This commit is contained in:
Oleg Shyshkov
2023-03-30 23:18:21 +02:00
parent b1e5d0d671
commit f080f1122f

View File

@@ -37,7 +37,9 @@ scf::SCFTilingOptions::setTileSizes(ArrayRef<int64_t> ts) {
tileSizeComputationFunction = [tileSizes](OpBuilder &b, Operation *op) {
OpBuilder::InsertionGuard guard(b);
b.setInsertionPointToStart(
&op->getParentOfType<func::FuncOp>().getBody().front());
&op->getParentWithTrait<OpTrait::IsIsolatedFromAbove>()
->getRegion(0)
.front());
return llvm::to_vector<4>(map_range(tileSizes, [&](int64_t s) {
Value v = b.create<arith::ConstantIndexOp>(op->getLoc(), s);
return v;