diff options
Diffstat (limited to 'mlir/lib/Transforms')
-rw-r--r-- | mlir/lib/Transforms/LoopInvariantCodeMotion.cpp | 8 | ||||
-rw-r--r-- | mlir/lib/Transforms/LowerAffine.cpp | 11 | ||||
-rw-r--r-- | mlir/lib/Transforms/Utils/LoopUtils.cpp | 18 |
3 files changed, 18 insertions, 19 deletions
diff --git a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp index 48e97f4..d8b5b2d 100644 --- a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp +++ b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp @@ -186,13 +186,13 @@ bool checkInvarianceOfNestedIfOps(Operation *op, Value *indVar, assert(isa<AffineIfOp>(op)); auto ifOp = cast<AffineIfOp>(op); - if (!areAllOpsInTheBlockListInvariant(ifOp.getThenBlocks(), indVar, - definedOps, opsToHoist)) { + if (!areAllOpsInTheBlockListInvariant(ifOp.thenRegion(), indVar, definedOps, + opsToHoist)) { return false; } - if (!areAllOpsInTheBlockListInvariant(ifOp.getElseBlocks(), indVar, - definedOps, opsToHoist)) { + if (!areAllOpsInTheBlockListInvariant(ifOp.elseRegion(), indVar, definedOps, + opsToHoist)) { return false; } diff --git a/mlir/lib/Transforms/LowerAffine.cpp b/mlir/lib/Transforms/LowerAffine.cpp index 20a9134..f35f963 100644 --- a/mlir/lib/Transforms/LowerAffine.cpp +++ b/mlir/lib/Transforms/LowerAffine.cpp @@ -318,7 +318,7 @@ public: Value *step = rewriter.create<ConstantIndexOp>(loc, op.getStep()); auto f = rewriter.create<loop::ForOp>(loc, lowerBound, upperBound, step); f.region().getBlocks().clear(); - rewriter.inlineRegionBefore(op.getRegion(), f.region(), f.region().end()); + rewriter.inlineRegionBefore(op.region(), f.region(), f.region().end()); rewriter.replaceOp(op, {}); return matchSuccess(); } @@ -335,7 +335,7 @@ public: // Now we just have to handle the condition logic. auto integerSet = op.getIntegerSet(); Value *zeroConstant = rewriter.create<ConstantIndexOp>(loc, 0); - SmallVector<Value *, 8> operands(op.getOperands()); + SmallVector<Value *, 8> operands(op.getOperation()->getOperands()); auto operandsRef = llvm::makeArrayRef(operands); // Calculate cond as a conjunction without short-circuiting. @@ -360,13 +360,12 @@ public: cond = cond ? cond : rewriter.create<ConstantIntOp>(loc, /*value=*/1, /*width=*/1); - bool hasElseRegion = !op.getElseBlocks().empty(); + bool hasElseRegion = !op.elseRegion().empty(); auto ifOp = rewriter.create<loop::IfOp>(loc, cond, hasElseRegion); - rewriter.inlineRegionBefore(op.getThenBlocks(), &ifOp.thenRegion().back()); + rewriter.inlineRegionBefore(op.thenRegion(), &ifOp.thenRegion().back()); ifOp.thenRegion().back().erase(); if (hasElseRegion) { - rewriter.inlineRegionBefore(op.getElseBlocks(), - &ifOp.elseRegion().back()); + rewriter.inlineRegionBefore(op.elseRegion(), &ifOp.elseRegion().back()); ifOp.elseRegion().back().erase(); } diff --git a/mlir/lib/Transforms/Utils/LoopUtils.cpp b/mlir/lib/Transforms/Utils/LoopUtils.cpp index d77f9bf..242538d 100644 --- a/mlir/lib/Transforms/Utils/LoopUtils.cpp +++ b/mlir/lib/Transforms/Utils/LoopUtils.cpp @@ -825,22 +825,22 @@ static void tile(MutableArrayRef<loop::ForOp> forOps, ArrayRef<Value *> sizes) { auto outerForOp = builder.create<loop::ForOp>(forOps[i].getLoc(), forOps[i].lowerBound(), forOps[i].upperBound(), newSteps[i]); - builder.setInsertionPointToStart(outerForOp.body()); + builder.setInsertionPointToStart(outerForOp.getBody()); outerForOps.push_back(outerForOp); } // Move the outermost original loop into the innermost new outer loop. Thus // the body of the original loops does not need updating. auto lastOuterForOp = outerForOps.back(); - lastOuterForOp.body()->getOperations().splice( - lastOuterForOp.body()->getOperations().begin(), + lastOuterForOp.getBody()->getOperations().splice( + lastOuterForOp.getBody()->getOperations().begin(), rootForOp.getOperation()->getBlock()->getOperations(), rootForOp.getOperation()); // Immediately before the (now sunk) outermost original loop, insert the // computation of the upper bounds of the inner loops. Update the bounds of // the orginial loops to make them point loops. - builder.setInsertionPointToStart(lastOuterForOp.body()); + builder.setInsertionPointToStart(lastOuterForOp.getBody()); for (unsigned i = 0, e = sizes.size(); i < e; ++i) { Value *stepped = builder.create<AddIOp>( forOps[i].getLoc(), outerForOps[i].getInductionVar(), newSteps[i]); @@ -992,7 +992,7 @@ static void normalizeLoop(loop::ForOp loop, loop::ForOp outer, // Insert code computing the value of the original loop induction variable // from the "normalized" one. - builder.setInsertionPointToStart(inner.body()); + builder.setInsertionPointToStart(inner.getBody()); Value *scaled = isStepOne ? loop.getInductionVar() : builder.create<MulIOp>(loc, loop.getInductionVar(), step); @@ -1025,7 +1025,7 @@ void mlir::coalesceLoops(MutableArrayRef<loop::ForOp> loops) { upperBound = builder.create<MulIOp>(loc, upperBound, loop.upperBound()); outermost.setUpperBound(upperBound); - builder.setInsertionPointToStart(outermost.body()); + builder.setInsertionPointToStart(outermost.getBody()); // 3. Remap induction variables. For each original loop, the value of the // induction variable can be obtained by dividing the induction variable of @@ -1052,9 +1052,9 @@ void mlir::coalesceLoops(MutableArrayRef<loop::ForOp> loops) { // 4. Move the operations from the innermost just above the second-outermost // loop, delete the extra terminator and the second-outermost loop. loop::ForOp second = loops[1]; - innermost.body()->back().erase(); - outermost.body()->getOperations().splice( + innermost.getBody()->back().erase(); + outermost.getBody()->getOperations().splice( Block::iterator(second.getOperation()), - innermost.body()->getOperations()); + innermost.getBody()->getOperations()); second.erase(); } |