Skip to content

Commit 9e7834c

Browse files
authored
[mlir][NFC] update mlir/lib create APIs (35/n) (#150708)
See #147168 for more info.
1 parent 1299bba commit 9e7834c

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,8 @@ LLVM::CallOp FunctionCallBuilder::create(Location loc, OpBuilder &builder,
579579
auto function = [&] {
580580
if (auto function = module.lookupSymbol<LLVM::LLVMFuncOp>(functionName))
581581
return function;
582-
return OpBuilder::atBlockEnd(module.getBody())
583-
.create<LLVM::LLVMFuncOp>(loc, functionName, functionType);
582+
auto builder = OpBuilder::atBlockEnd(module.getBody());
583+
return LLVM::LLVMFuncOp::create(builder, loc, functionName, functionType);
584584
}();
585585
return LLVM::CallOp::create(builder, loc, function, arguments);
586586
}

mlir/lib/Conversion/MathToFuncs/MathToFuncs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,8 @@ static func::FuncOp createCtlzFunc(ModuleOp *module, Type elementType) {
698698
scf::IfOp ifOp =
699699
scf::IfOp::create(builder, elementType, inputEqZero,
700700
/*addThenBlock=*/true, /*addElseBlock=*/true);
701-
ifOp.getThenBodyBuilder().create<scf::YieldOp>(loc, bitWidthValue);
701+
auto thenBuilder = ifOp.getThenBodyBuilder();
702+
scf::YieldOp::create(thenBuilder, loc, bitWidthValue);
702703

703704
auto elseBuilder =
704705
ImplicitLocOpBuilder::atBlockEnd(loc, &ifOp.getElseRegion().front());

mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,13 @@ struct SPIRVInlinerInterface : public DialectInlinerInterface {
9292
/// as necessary.
9393
void handleTerminator(Operation *op, Block *newDest) const final {
9494
if (auto returnOp = dyn_cast<spirv::ReturnOp>(op)) {
95-
OpBuilder(op).create<spirv::BranchOp>(op->getLoc(), newDest);
95+
auto builder = OpBuilder(op);
96+
spirv::BranchOp::create(builder, op->getLoc(), newDest);
9697
op->erase();
9798
} else if (auto retValOp = dyn_cast<spirv::ReturnValueOp>(op)) {
98-
OpBuilder(op).create<spirv::BranchOp>(retValOp->getLoc(), newDest,
99-
retValOp->getOperands());
99+
auto builder = OpBuilder(op);
100+
spirv::BranchOp::create(builder, retValOp->getLoc(), newDest,
101+
retValOp->getOperands());
100102
op->erase();
101103
}
102104
}

0 commit comments

Comments
 (0)