diff --git a/mlir/include/mlir/IR/Builders.h b/mlir/include/mlir/IR/Builders.h index 9205f16f97bbb..3ba6818204ba0 100644 --- a/mlir/include/mlir/IR/Builders.h +++ b/mlir/include/mlir/IR/Builders.h @@ -502,6 +502,7 @@ class OpBuilder : public Builder { public: /// Create an operation of specific op type at the current insertion point. template + [[deprecated("Use OpTy::create instead")]] OpTy create(Location location, Args &&...args) { OperationState state(location, getCheckRegisteredInfo(location.getContext())); @@ -517,9 +518,9 @@ class OpBuilder : public Builder { /// the results of the operation. /// /// Note: This performs opportunistic eager folding during IR construction. - /// The folders are designed to operate efficiently on canonical IR, which + /// The folders are designed to operate efficiently on canonical IR, which /// this API does not enforce. Complete folding isn't only expected in the - /// context of canonicalization which intertwine folders with pattern + /// context of canonicalization which intertwine folders with pattern /// rewrites until fixed-point. template void createOrFold(SmallVectorImpl &results, Location location, diff --git a/mlir/lib/Dialect/OpenMP/Transforms/OpenMPOffloadPrivatizationPrepare.cpp b/mlir/lib/Dialect/OpenMP/Transforms/OpenMPOffloadPrivatizationPrepare.cpp index db54eaa2628a8..735b905bffb85 100644 --- a/mlir/lib/Dialect/OpenMP/Transforms/OpenMPOffloadPrivatizationPrepare.cpp +++ b/mlir/lib/Dialect/OpenMP/Transforms/OpenMPOffloadPrivatizationPrepare.cpp @@ -205,14 +205,14 @@ class PrepareForOMPOffloadPrivatizationPass assert(!region.empty() && "region cannot be empty"); LLVM::LLVMFuncOp func = createFuncOpForRegion( loc, mod, region, funcName, rewriter, returnsValue); - auto call = rewriter.create(loc, func, args); + auto call = LLVM::CallOp::create(rewriter, loc, func, args); return call.getResult(); }; Value moldArg, newArg; if (isPrivatizedByValue) { - moldArg = rewriter.create(loc, varType, varPtr); - newArg = rewriter.create(loc, varType, heapMem); + moldArg = LLVM::LoadOp::create(rewriter, loc, varType, varPtr); + newArg = LLVM::LoadOp::create(rewriter, loc, varType, heapMem); } else { moldArg = varPtr; newArg = heapMem; @@ -234,7 +234,7 @@ class PrepareForOMPOffloadPrivatizationPass {moldArg, initializedVal}, /*returnsValue=*/true); if (isPrivatizedByValue) - (void)rewriter.create(loc, initializedVal, heapMem); + (void)LLVM::StoreOp::create(rewriter, loc, initializedVal, heapMem); // clone origOp, replace all uses of varPtr with heapMem and // erase origOp. @@ -275,8 +275,8 @@ class PrepareForOMPOffloadPrivatizationPass // targetOp. if (isPrivatizedByValue) { rewriter.setInsertionPoint(targetOp); - auto newPrivVar = rewriter.create(mapInfoOp.getLoc(), - varType, heapMem); + auto newPrivVar = LLVM::LoadOp::create(rewriter, mapInfoOp.getLoc(), + varType, heapMem); newPrivVars.push_back(newPrivVar); } @@ -294,7 +294,7 @@ class PrepareForOMPOffloadPrivatizationPass cleanupTaskOp = omp::TaskOp::create(rewriter, loc, taskOperands); Block *taskBlock = rewriter.createBlock(&cleanupTaskOp.getRegion()); rewriter.setInsertionPointToEnd(taskBlock); - rewriter.create(cleanupTaskOp.getLoc()); + omp::TerminatorOp::create(rewriter, cleanupTaskOp.getLoc()); } rewriter.setInsertionPointToStart( &*cleanupTaskOp.getRegion().getBlocks().begin()); @@ -307,8 +307,8 @@ class PrepareForOMPOffloadPrivatizationPass LLVM::lookupOrCreateFreeFn(rewriter, mod); assert(llvm::succeeded(freeFunc) && "Could not find free in the module"); - (void)rewriter.create(loc, freeFunc.value(), - ValueRange{heapMem}); + (void)LLVM::CallOp::create(rewriter, loc, freeFunc.value(), + ValueRange{heapMem}); } } assert(newPrivVars.size() == privateVars.size() && @@ -390,11 +390,11 @@ class PrepareForOMPOffloadPrivatizationPass const DataLayout &dl = DataLayout(mod); std::int64_t distance = getSizeInBytes(dl, varType); - Value sizeBytes = rewriter.create( - loc, mallocFn.getFunctionType().getParamType(0), distance); + Value sizeBytes = LLVM::ConstantOp::create( + rewriter, loc, mallocFn.getFunctionType().getParamType(0), distance); auto mallocCallOp = - rewriter.create(loc, mallocFn, ValueRange{sizeBytes}); + LLVM::CallOp::create(rewriter, loc, mallocFn, ValueRange{sizeBytes}); return mallocCallOp.getResult(); }