[Mlir-commits] [mlir] 51a0718 - Setup OpBuilder to support detached block in loopUnrollByFactor (NFC)
Mehdi Amini
llvmlistbot at llvm.org
Thu Apr 1 16:36:00 PDT 2021
Author: Mehdi Amini
Date: 2021-04-01T23:34:03Z
New Revision: 51a07182b3ea48b2a26970b5e145e193e27a8521
URL: https://github.com/llvm/llvm-project/commit/51a07182b3ea48b2a26970b5e145e193e27a8521
DIFF: https://github.com/llvm/llvm-project/commit/51a07182b3ea48b2a26970b5e145e193e27a8521.diff
LOG: Setup OpBuilder to support detached block in loopUnrollByFactor (NFC)
Setting the builder from a block is looking up for a parent operation
to get a context, instead by setting up the builder with an explicit
context we can support invoking this helper in absence of a parent
operation.
Added:
Modified:
mlir/lib/Transforms/Utils/LoopUtils.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Transforms/Utils/LoopUtils.cpp b/mlir/lib/Transforms/Utils/LoopUtils.cpp
index 5aaa8fa0daad..e9bc2eb4fb2e 100644
--- a/mlir/lib/Transforms/Utils/LoopUtils.cpp
+++ b/mlir/lib/Transforms/Utils/LoopUtils.cpp
@@ -1268,8 +1268,9 @@ LogicalResult mlir::loopUnrollByFactor(scf::ForOp forOp,
// Create epilogue clean up loop starting at 'upperBoundUnrolled'.
if (generateEpilogueLoop) {
- OpBuilder epilogueBuilder(forOp->getBlock(),
- std::next(Block::iterator(forOp)));
+ OpBuilder epilogueBuilder(forOp->getContext());
+ epilogueBuilder.setInsertionPoint(forOp->getBlock(),
+ std::next(Block::iterator(forOp)));
auto epilogueForOp = cast<scf::ForOp>(epilogueBuilder.clone(*forOp));
epilogueForOp.setLowerBound(upperBoundUnrolled);
More information about the Mlir-commits
mailing list