[flang-commits] [flang] [mlir] [mlir][IR] Add rewriter API for moving operations (PR #78988)
Mehdi Amini via flang-commits
flang-commits at lists.llvm.org
Wed Jan 24 15:05:10 PST 2024
================
@@ -366,3 +366,31 @@ void RewriterBase::cloneRegionBefore(Region ®ion, Region &parent,
void RewriterBase::cloneRegionBefore(Region ®ion, Block *before) {
cloneRegionBefore(region, *before->getParent(), before->getIterator());
}
+
+void RewriterBase::moveOpBefore(Operation *op, Operation *existingOp) {
+ moveOpBefore(op, existingOp->getBlock(), existingOp->getIterator());
+}
+
+void RewriterBase::moveOpBefore(Operation *op, Block *block,
+ Block::iterator iterator) {
+ Block *currentBlock = op->getBlock();
+ Block::iterator currentIterator = op->getIterator();
+ op->moveBefore(block, iterator);
+ if (listener)
+ listener->notifyOperationInserted(
+ op, /*previous=*/InsertPoint(currentBlock, currentIterator));
----------------
joker-eph wrote:
OK!
https://github.com/llvm/llvm-project/pull/78988
More information about the flang-commits
mailing list