Skip to content

[mlir][NFC] update mlir/lib create APIs (35/n) #150708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,8 @@ LLVM::CallOp FunctionCallBuilder::create(Location loc, OpBuilder &builder,
auto function = [&] {
if (auto function = module.lookupSymbol<LLVM::LLVMFuncOp>(functionName))
return function;
return OpBuilder::atBlockEnd(module.getBody())
.create<LLVM::LLVMFuncOp>(loc, functionName, functionType);
auto builder = OpBuilder::atBlockEnd(module.getBody());
return LLVM::LLVMFuncOp::create(builder, loc, functionName, functionType);
}();
return LLVM::CallOp::create(builder, loc, function, arguments);
}
Expand Down
3 changes: 2 additions & 1 deletion mlir/lib/Conversion/MathToFuncs/MathToFuncs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,8 @@ static func::FuncOp createCtlzFunc(ModuleOp *module, Type elementType) {
scf::IfOp ifOp =
scf::IfOp::create(builder, elementType, inputEqZero,
/*addThenBlock=*/true, /*addElseBlock=*/true);
ifOp.getThenBodyBuilder().create<scf::YieldOp>(loc, bitWidthValue);
auto thenBuilder = ifOp.getThenBodyBuilder();
scf::YieldOp::create(thenBuilder, loc, bitWidthValue);

auto elseBuilder =
ImplicitLocOpBuilder::atBlockEnd(loc, &ifOp.getElseRegion().front());
Expand Down
8 changes: 5 additions & 3 deletions mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@ struct SPIRVInlinerInterface : public DialectInlinerInterface {
/// as necessary.
void handleTerminator(Operation *op, Block *newDest) const final {
if (auto returnOp = dyn_cast<spirv::ReturnOp>(op)) {
OpBuilder(op).create<spirv::BranchOp>(op->getLoc(), newDest);
auto builder = OpBuilder(op);
spirv::BranchOp::create(builder, op->getLoc(), newDest);
op->erase();
} else if (auto retValOp = dyn_cast<spirv::ReturnValueOp>(op)) {
OpBuilder(op).create<spirv::BranchOp>(retValOp->getLoc(), newDest,
retValOp->getOperands());
auto builder = OpBuilder(op);
spirv::BranchOp::create(builder, retValOp->getLoc(), newDest,
retValOp->getOperands());
op->erase();
}
}
Expand Down