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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Sep 19 06:24:39 PDT 2023


Author: vic
Date: 2023-09-19T15:06:22+02:00
New Revision: 6d1c6ecbdc4e94cafd51ade0331d7112161a4cf3

URL: https://github.com/llvm/llvm-project/commit/6d1c6ecbdc4e94cafd51ade0331d7112161a4cf3
DIFF: https://github.com/llvm/llvm-project/commit/6d1c6ecbdc4e94cafd51ade0331d7112161a4cf3.diff

LOG: [IR] `SingleBlock::push_back` operations to the back of the block (#66655)

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

Signed-off-by: Victor Perez <victor.perez at codeplay.com>

Added: 
    

Modified: 
    mlir/include/mlir/IR/OpDefinition.h

Removed: 
    


################################################################################
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);
   }
 };


        


More information about the Mlir-commits mailing list