[Mlir-commits] [mlir] [IR] `SingleBlock::push_back` operations to the back of the block (PR #66655)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Sep 18 07:59:27 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-core

<details>
<summary>Changes</summary>

Instead of checking whether the last operation might be a terminator, always insert operations to the end of the block.

---
Full diff: https://github.com/llvm/llvm-project/pull/66655.diff


1 Files Affected:

- (modified) mlir/include/mlir/IR/OpDefinition.h (-4) 


``````````diff
diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h
index 306b3789a044f83..82d0e93a8ee2fa9 100644
--- a/mlir/include/mlir/IR/OpDefinition.h
+++ b/mlir/include/mlir/IR/OpDefinition.h
@@ -932,10 +932,6 @@ struct SingleBlock : public TraitBase<ConcreteType, SingleBlock> {
   }
   template <typename OpT = ConcreteType>
   enable_if_single_region<OpT> insert(Block::iterator insertPt, Operation *op) {
-    Block *body = getBody();
-    // Insert op before the block's terminator if it has one
-    if (insertPt == body->end() && body->hasTerminator())
-      insertPt = Block::iterator(body->getTerminator());
     getBody()->getOperations().insert(insertPt, op);
   }
 };

``````````

</details>


https://github.com/llvm/llvm-project/pull/66655


More information about the Mlir-commits mailing list