[Mlir-commits] [mlir] [mlir] Use `OpBuilder::createBlock` in op builders and patterns (PR #82770)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Fri Feb 23 06:32:51 PST 2024
================
@@ -1904,23 +1902,23 @@ bool ToExtentTensorOp::areCastCompatible(TypeRange inputs, TypeRange outputs) {
void ReduceOp::build(OpBuilder &builder, OperationState &result, Value shape,
ValueRange initVals) {
+ OpBuilder::InsertionGuard g(builder);
result.addOperands(shape);
result.addOperands(initVals);
Region *bodyRegion = result.addRegion();
- bodyRegion->push_back(new Block);
- Block &bodyBlock = bodyRegion->front();
- bodyBlock.addArgument(builder.getIndexType(), result.location);
+ Block *bodyBlock = builder.createBlock(bodyRegion);
+ bodyBlock->addArgument(builder.getIndexType(), result.location);
----------------
ftynse wrote:
Ditto.
https://github.com/llvm/llvm-project/pull/82770
More information about the Mlir-commits
mailing list