[Mlir-commits] [mlir] [mlir][NFC] update `mlir/Dialect` create APIs (21/n) (PR #149928)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Jul 21 15:47:26 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-sparse
Author: Maksim Levental (makslevental)
<details>
<summary>Changes</summary>
See https://github.com/llvm/llvm-project/pull/147168 for more info.
---
Patch is 249.29 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/149928.diff
22 Files Affected:
- (modified) mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp (+3-2)
- (modified) mlir/lib/Dialect/SparseTensor/IR/SparseTensorInterfaces.cpp (+2-2)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseAssembler.cpp (+13-12)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp (+225-219)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp (+146-139)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseIterationToScf.cpp (+18-18)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseReinterpretMap.cpp (+15-14)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseSpaceCollapse.cpp (+2-2)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseStorageSpecifierToLLVM.cpp (+9-9)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp (+105-100)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp (+30-30)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp (+140-136)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp (+35-35)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp (+42-39)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/StageSparseOperations.cpp (+2-2)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/Utils/CodegenUtils.cpp (+46-45)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/Utils/CodegenUtils.h (+17-17)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp (+31-31)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorDescriptor.cpp (+11-9)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorDescriptor.h (+1-1)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorIterator.cpp (+50-49)
- (modified) mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp (+60-60)
``````````diff
diff --git a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
index 38246b96977c8..1a9d9e158ee75 100644
--- a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
+++ b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp
@@ -559,7 +559,8 @@ SparseTensorEncodingAttr::translateCrds(OpBuilder &builder, Location loc,
SmallVector<Type> retType(
dir == CrdTransDirectionKind::lvl2dim ? getDimRank() : getLvlRank(),
builder.getIndexType());
- auto transOp = builder.create<CrdTranslateOp>(loc, retType, crds, dir, *this);
+ auto transOp =
+ CrdTranslateOp::create(builder, loc, retType, crds, dir, *this);
return transOp.getOutCrds();
}
@@ -1481,7 +1482,7 @@ LogicalResult CrdTranslateOp::fold(FoldAdaptor adaptor,
void LvlOp::build(OpBuilder &builder, OperationState &state, Value source,
int64_t index) {
- Value val = builder.create<arith::ConstantIndexOp>(state.location, index);
+ Value val = arith::ConstantIndexOp::create(builder, state.location, index);
return build(builder, state, source, val);
}
diff --git a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorInterfaces.cpp b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorInterfaces.cpp
index 9c84f4c25866f..abb37a5e10b9a 100644
--- a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorInterfaces.cpp
+++ b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorInterfaces.cpp
@@ -41,8 +41,8 @@ LogicalResult sparse_tensor::detail::stageWithSortImpl(
// -> sort
Type dstCOOTp = dstStt.getCOOType(/*ordered=*/true);
- Value dstCOO = rewriter.create<ReorderCOOOp>(
- loc, dstCOOTp, srcCOO, SparseTensorSortKind::HybridQuickSort);
+ Value dstCOO = ReorderCOOOp::create(rewriter, loc, dstCOOTp, srcCOO,
+ SparseTensorSortKind::HybridQuickSort);
// -> dest.
if (dstCOO.getType() == finalTp) {
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseAssembler.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseAssembler.cpp
index 8ee801ba46349..40c182f9dbb37 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseAssembler.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseAssembler.cpp
@@ -88,13 +88,13 @@ static void convVals(OpBuilder &builder, Location loc, TypeRange types,
} else if (directOut) {
Value mem;
if (kind == SparseTensorFieldKind::PosMemRef)
- mem = builder.create<sparse_tensor::ToPositionsOp>(loc, inputs[0],
- lv);
+ mem = sparse_tensor::ToPositionsOp::create(builder, loc, inputs[0],
+ lv);
else if (kind == SparseTensorFieldKind::CrdMemRef)
- mem = builder.create<sparse_tensor::ToCoordinatesOp>(loc, inputs[0],
- lv);
+ mem = sparse_tensor::ToCoordinatesOp::create(builder, loc,
+ inputs[0], lv);
else
- mem = builder.create<sparse_tensor::ToValuesOp>(loc, inputs[0]);
+ mem = sparse_tensor::ToValuesOp::create(builder, loc, inputs[0]);
toVals.push_back(mem);
} else {
ShapedType rtp = cast<ShapedType>(t);
@@ -109,7 +109,7 @@ static void convVals(OpBuilder &builder, Location loc, TypeRange types,
if (isIn) {
// Assemble multiple inputs into a single sparse tensor.
- auto a = builder.create<sparse_tensor::AssembleOp>(loc, rtp, inputs);
+ auto a = sparse_tensor::AssembleOp::create(builder, loc, rtp, inputs);
toVals.push_back(a.getResult());
} else if (!directOut) {
// Disassemble a single sparse input into multiple outputs.
@@ -117,7 +117,7 @@ static void convVals(OpBuilder &builder, Location loc, TypeRange types,
unsigned len = retTypes.size();
retTypes.append(cntTypes);
auto d =
- builder.create<sparse_tensor::DisassembleOp>(loc, retTypes, inputs);
+ sparse_tensor::DisassembleOp::create(builder, loc, retTypes, inputs);
for (unsigned i = 0; i < len; i++)
toVals.push_back(d.getResult(i));
}
@@ -199,8 +199,9 @@ struct SparseFuncAssembler : public OpRewritePattern<func::FuncOp> {
OpBuilder moduleBuilder(modOp.getBodyRegion());
unsigned extra = inputTypes.size();
inputTypes.append(extraTypes);
- auto func = moduleBuilder.create<func::FuncOp>(
- loc, orgName, FunctionType::get(context, inputTypes, outputTypes));
+ auto func = func::FuncOp::create(
+ moduleBuilder, loc, orgName,
+ FunctionType::get(context, inputTypes, outputTypes));
func.setPublic();
// Construct new wrapper method body.
@@ -216,14 +217,14 @@ struct SparseFuncAssembler : public OpRewritePattern<func::FuncOp> {
// Call the original, now private method. A subsequent inlining pass can
// determine whether cloning the method body in place is worthwhile.
auto org = SymbolRefAttr::get(context, wrapper);
- auto call = rewriter.create<func::CallOp>(loc, funcOp.getResultTypes(), org,
- inputs);
+ auto call = func::CallOp::create(rewriter, loc, funcOp.getResultTypes(),
+ org, inputs);
// Convert outputs and return.
SmallVector<Value> outputs;
convVals(rewriter, loc, funcOp.getResultTypes(), call.getResults(),
body->getArguments(), outputs, extra, /*isIn=*/false, directOut);
- rewriter.create<func::ReturnOp>(loc, outputs);
+ func::ReturnOp::create(rewriter, loc, outputs);
// Finally, migrate a potential c-interface property.
if (funcOp->getAttrOfType<UnitAttr>(
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
index 0c5912bb73772..02623198c25b5 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp
@@ -94,8 +94,8 @@ static FlatSymbolRefAttr getMangledSortHelperFunc(
OpBuilder::InsertionGuard insertionGuard(builder);
builder.setInsertionPoint(insertPoint);
Location loc = insertPoint.getLoc();
- func = builder.create<func::FuncOp>(
- loc, nameOstream.str(),
+ func = func::FuncOp::create(
+ builder, loc, nameOstream.str(),
FunctionType::get(context, operands.getTypes(), resultTypes));
func.setPrivate();
createFunc(builder, module, func, xPerm, ny, nTrailingP);
@@ -111,13 +111,13 @@ static void forEachIJPairInXs(
uint64_t ny,
function_ref<void(uint64_t, Value, Value, Value)> bodyBuilder) {
Value cstep = constantIndex(builder, loc, xPerm.getNumResults() + ny);
- Value iOffset = builder.create<arith::MulIOp>(loc, args[0], cstep);
- Value jOffset = builder.create<arith::MulIOp>(loc, args[1], cstep);
+ Value iOffset = arith::MulIOp::create(builder, loc, args[0], cstep);
+ Value jOffset = arith::MulIOp::create(builder, loc, args[1], cstep);
for (unsigned k = 0, e = xPerm.getNumResults(); k < e; k++) {
unsigned actualK = cast<AffineDimExpr>(xPerm.getResult(k)).getPosition();
Value ak = constantIndex(builder, loc, actualK);
- Value i = builder.create<arith::AddIOp>(loc, ak, iOffset);
- Value j = builder.create<arith::AddIOp>(loc, ak, jOffset);
+ Value i = arith::AddIOp::create(builder, loc, ak, iOffset);
+ Value j = arith::AddIOp::create(builder, loc, ak, jOffset);
Value buffer = args[xStartIdx];
bodyBuilder(k, i, j, buffer);
@@ -165,10 +165,10 @@ static void forEachIJPairInAllBuffers(
static void createSwap(OpBuilder &builder, Location loc, ValueRange args,
AffineMap xPerm, uint64_t ny) {
auto swapOnePair = [&](uint64_t unused, Value i, Value j, Value buffer) {
- Value vi = builder.create<memref::LoadOp>(loc, buffer, i);
- Value vj = builder.create<memref::LoadOp>(loc, buffer, j);
- builder.create<memref::StoreOp>(loc, vj, buffer, i);
- builder.create<memref::StoreOp>(loc, vi, buffer, j);
+ Value vi = memref::LoadOp::create(builder, loc, buffer, i);
+ Value vj = memref::LoadOp::create(builder, loc, buffer, j);
+ memref::StoreOp::create(builder, loc, vj, buffer, i);
+ memref::StoreOp::create(builder, loc, vi, buffer, j);
};
forEachIJPairInAllBuffers(builder, loc, args, xPerm, ny, swapOnePair);
@@ -193,7 +193,7 @@ static Value createInlinedCompareImplementation(
OpBuilder::InsertionGuard insertionGuard(builder);
auto ifOp = cast<scf::IfOp>(val.getDefiningOp());
builder.setInsertionPointAfter(ifOp);
- builder.create<scf::YieldOp>(loc, ifOp.getResult(0));
+ scf::YieldOp::create(builder, loc, ifOp.getResult(0));
}
};
@@ -207,25 +207,25 @@ static Value createInlinedCompareImplementation(
/// result of the comparison.
static Value createEqCompare(OpBuilder &builder, Location loc, Value i, Value j,
Value x, bool isFirstDim, bool isLastDim) {
- Value vi = builder.create<memref::LoadOp>(loc, x, i);
- Value vj = builder.create<memref::LoadOp>(loc, x, j);
+ Value vi = memref::LoadOp::create(builder, loc, x, i);
+ Value vj = memref::LoadOp::create(builder, loc, x, j);
Value res;
if (isLastDim) {
- res = builder.create<arith::CmpIOp>(loc, arith::CmpIPredicate::eq, vi, vj);
+ res = arith::CmpIOp::create(builder, loc, arith::CmpIPredicate::eq, vi, vj);
// For 1D, we create a compare without any control flow. Otherwise, we
// create YieldOp to return the result in the nested if-stmt.
if (!isFirstDim)
- builder.create<scf::YieldOp>(loc, res);
+ scf::YieldOp::create(builder, loc, res);
} else {
Value ne =
- builder.create<arith::CmpIOp>(loc, arith::CmpIPredicate::ne, vi, vj);
- scf::IfOp ifOp = builder.create<scf::IfOp>(loc, builder.getIntegerType(1),
- ne, /*else=*/true);
+ arith::CmpIOp::create(builder, loc, arith::CmpIPredicate::ne, vi, vj);
+ scf::IfOp ifOp = scf::IfOp::create(builder, loc, builder.getIntegerType(1),
+ ne, /*else=*/true);
// If (x[i] != x[j]).
builder.setInsertionPointToStart(&ifOp.getThenRegion().front());
Value f = constantI1(builder, loc, false);
- builder.create<scf::YieldOp>(loc, f);
+ scf::YieldOp::create(builder, loc, f);
// If (x[i] == x[j]). Set up the insertion point for the nested if-stmt that
// checks the remaining dimensions.
@@ -261,26 +261,27 @@ static Value createInlinedEqCompare(OpBuilder &builder, Location loc,
static Value createLessThanCompare(OpBuilder &builder, Location loc, Value i,
Value j, Value x, bool isFirstDim,
bool isLastDim) {
- Value vi = builder.create<memref::LoadOp>(loc, x, i);
- Value vj = builder.create<memref::LoadOp>(loc, x, j);
+ Value vi = memref::LoadOp::create(builder, loc, x, i);
+ Value vj = memref::LoadOp::create(builder, loc, x, j);
Value res;
if (isLastDim) {
- res = builder.create<arith::CmpIOp>(loc, arith::CmpIPredicate::ult, vi, vj);
+ res =
+ arith::CmpIOp::create(builder, loc, arith::CmpIPredicate::ult, vi, vj);
// For 1D, we create a compare without any control flow. Otherwise, we
// create YieldOp to return the result in the nested if-stmt.
if (!isFirstDim)
- builder.create<scf::YieldOp>(loc, res);
+ scf::YieldOp::create(builder, loc, res);
} else {
Value ne =
- builder.create<arith::CmpIOp>(loc, arith::CmpIPredicate::ne, vi, vj);
- scf::IfOp ifOp = builder.create<scf::IfOp>(loc, builder.getIntegerType(1),
- ne, /*else=*/true);
+ arith::CmpIOp::create(builder, loc, arith::CmpIPredicate::ne, vi, vj);
+ scf::IfOp ifOp = scf::IfOp::create(builder, loc, builder.getIntegerType(1),
+ ne, /*else=*/true);
// If (x[i] != x[j]).
builder.setInsertionPointToStart(&ifOp.getThenRegion().front());
Value lt =
- builder.create<arith::CmpIOp>(loc, arith::CmpIPredicate::ult, vi, vj);
- builder.create<scf::YieldOp>(loc, lt);
+ arith::CmpIOp::create(builder, loc, arith::CmpIPredicate::ult, vi, vj);
+ scf::YieldOp::create(builder, loc, lt);
// If (x[i] == x[j]). Set up the insertion point for the nested if-stmt that
// checks the remaining dimensions.
@@ -337,17 +338,17 @@ static void createBinarySearchFunc(OpBuilder &builder, ModuleOp module,
ValueRange args = entryBlock->getArguments();
Value p = args[hiIdx];
SmallVector<Type, 2> types(2, p.getType()); // Only two types.
- scf::WhileOp whileOp = builder.create<scf::WhileOp>(
- loc, types, SmallVector<Value, 2>{args[loIdx], args[hiIdx]});
+ scf::WhileOp whileOp = scf::WhileOp::create(
+ builder, loc, types, SmallVector<Value, 2>{args[loIdx], args[hiIdx]});
// The before-region of the WhileOp.
Block *before =
builder.createBlock(&whileOp.getBefore(), {}, types, {loc, loc});
builder.setInsertionPointToEnd(before);
- Value cond1 = builder.create<arith::CmpIOp>(loc, arith::CmpIPredicate::ult,
- before->getArgument(0),
- before->getArgument(1));
- builder.create<scf::ConditionOp>(loc, cond1, before->getArguments());
+ Value cond1 =
+ arith::CmpIOp::create(builder, loc, arith::CmpIPredicate::ult,
+ before->getArgument(0), before->getArgument(1));
+ scf::ConditionOp::create(builder, loc, cond1, before->getArguments());
// The after-region of the WhileOp.
Block *after =
@@ -357,9 +358,9 @@ static void createBinarySearchFunc(OpBuilder &builder, ModuleOp module,
Value hi = after->getArgument(1);
// Compute mid = (lo + hi) >> 1.
Value c1 = constantIndex(builder, loc, 1);
- Value mid = builder.create<arith::ShRUIOp>(
- loc, builder.create<arith::AddIOp>(loc, lo, hi), c1);
- Value midp1 = builder.create<arith::AddIOp>(loc, mid, c1);
+ Value mid = arith::ShRUIOp::create(
+ builder, loc, arith::AddIOp::create(builder, loc, lo, hi), c1);
+ Value midp1 = arith::AddIOp::create(builder, loc, mid, c1);
// Compare xs[p] < xs[mid].
SmallVector<Value> compareOperands{p, mid};
@@ -372,12 +373,12 @@ static void createBinarySearchFunc(OpBuilder &builder, ModuleOp module,
// hi = mid;
// else
// lo = mid + 1;
- Value newLo = builder.create<arith::SelectOp>(loc, cond2, lo, midp1);
- Value newHi = builder.create<arith::SelectOp>(loc, cond2, mid, hi);
- builder.create<scf::YieldOp>(loc, ValueRange{newLo, newHi});
+ Value newLo = arith::SelectOp::create(builder, loc, cond2, lo, midp1);
+ Value newHi = arith::SelectOp::create(builder, loc, cond2, mid, hi);
+ scf::YieldOp::create(builder, loc, ValueRange{newLo, newHi});
builder.setInsertionPointAfter(whileOp);
- builder.create<func::ReturnOp>(loc, whileOp.getResult(0));
+ func::ReturnOp::create(builder, loc, whileOp.getResult(0));
}
/// Creates code to advance i in a loop based on xs[p] as follows:
@@ -393,7 +394,7 @@ static std::pair<Value, Value> createScanLoop(OpBuilder &builder,
uint64_t ny, int step) {
Location loc = func.getLoc();
scf::WhileOp whileOp =
- builder.create<scf::WhileOp>(loc, TypeRange{i.getType()}, ValueRange{i});
+ scf::WhileOp::create(builder, loc, TypeRange{i.getType()}, ValueRange{i});
Block *before =
builder.createBlock(&whileOp.getBefore(), {}, {i.getType()}, {loc});
@@ -409,14 +410,14 @@ static std::pair<Value, Value> createScanLoop(OpBuilder &builder,
}
compareOperands.append(xs.begin(), xs.end());
Value cond = createInlinedLessThan(builder, loc, compareOperands, xPerm, ny);
- builder.create<scf::ConditionOp>(loc, cond, before->getArguments());
+ scf::ConditionOp::create(builder, loc, cond, before->getArguments());
Block *after =
builder.createBlock(&whileOp.getAfter(), {}, {i.getType()}, {loc});
builder.setInsertionPointToEnd(after);
Value cs = constantIndex(builder, loc, step);
- i = builder.create<arith::AddIOp>(loc, after->getArgument(0), cs);
- builder.create<scf::YieldOp>(loc, ValueRange{i});
+ i = arith::AddIOp::create(builder, loc, after->getArgument(0), cs);
+ scf::YieldOp::create(builder, loc, ValueRange{i});
i = whileOp.getResult(0);
builder.setInsertionPointAfter(whileOp);
@@ -440,7 +441,7 @@ static scf::IfOp createCompareThenSwap(OpBuilder &builder, Location loc,
compareOperands[0] = b;
compareOperands[1] = a;
Value cond = createInlinedLessThan(builder, loc, compareOperands, xPerm, ny);
- scf::IfOp ifOp = builder.create<scf::IfOp>(loc, cond, /*else=*/false);
+ scf::IfOp ifOp = scf::IfOp::create(builder, loc, cond, /*else=*/false);
builder.setInsertionPointToStart(&ifOp.getThenRegion().front());
swapOperands[0] = b;
swapOperands[1] = a;
@@ -517,12 +518,12 @@ static void createChoosePivot(OpBuilder &builder, ModuleOp module,
swapOperands.append(args.begin() + xStartIdx, args.end());
Location loc = func.getLoc();
Value c1 = constantIndex(builder, loc, 1);
- Value hiP1 = builder.create<arith::AddIOp>(loc, hi, c1);
- Value len = builder.create<arith::SubIOp>(loc, hiP1, lo);
+ Value hiP1 = arith::AddIOp::create(builder, loc, hi, c1);
+ Value len = arith::SubIOp::create(builder, loc, hiP1, lo);
Value lenThreshold = constantIndex(builder, loc, 1000);
- Value lenCond = builder.create<arith::CmpIOp>(loc, arith::CmpIPredicate::ult,
- len, lenThreshold);
- scf::IfOp lenIf = builder.create<scf::IfOp>(loc, lenCond, /*else=*/true);
+ Value lenCond = arith::CmpIOp::create(builder, loc, arith::CmpIPredicate::ult,
+ len, lenThreshold);
+ scf::IfOp lenIf = scf::IfOp::create(builder, loc, lenCond, /*else=*/true);
// When len < 1000, choose pivot from median of 3 values.
builder.setInsertionPointToStart(&lenIf.getThenRegion().front());
@@ -531,13 +532,13 @@ static void createChoosePivot(OpBuilder &builder, ModuleOp module,
// When len >= 1000, choose pivot from median of 5 values.
builder.setInsertionPointToStart(&lenIf.getElseRegion().front());
- Value miP1 = builder.create<arith::AddIOp>(loc, hi, c1);
- Value a = builder.create<arith::AddIOp>(loc, lo, miP1);
+ Value miP1 = arith::AddIOp::create(builder, loc, hi, c1);
+ Value a = arith::AddIOp::create(builder, loc, lo, miP1);
// Value a is the middle between [loc, mi].
- a = builder.create<arith::ShRUIOp>(loc, a, c1);
- Value b = builder.create<arith::AddIOp>(loc, mi, hiP1);
+ a = arith::ShRUIOp::create(builder, loc, a, c1);
+ Value b = arith::AddIOp::create(builder, loc, mi, hiP1);
// Value b is the middle between [mi, hi].
- b = builder.create<arith::ShRUIOp>(loc, b, c1);
+ b = arith::ShRUIOp::create(builder, loc, b, c1);
createSort5(builder, loc, xPerm, ny, swapOperands, compareOperands, lo, a, mi,
b, hi);
@@ -589,25 +590,25 @@ static void createPartitionFunc(OpBuilder &builder, ModuleOp module,
ValueRange args = entryBlock->getArguments();
Value lo = args[loIdx];
Value hi = args[hiIdx];
- Value sum = builder.create<arith::AddIOp>(loc, lo, hi);
+ Value sum = arith::AddIOp::create(builder, loc, lo, hi);
Value c1 = constantIndex(builder, loc, 1);
- Value p = builder.create<arith::ShRUIOp>(loc, sum, c1);
+ Value p = arith::ShRUIOp::create(builder, loc, sum, c1);
Value i = lo;
- Value j = builder.create<arith::SubIOp>(loc, hi, c1);
+ Value j = arith::SubIOp::create(builder, loc, hi, c1);
createChoosePivot(builder, module, func, xPerm, ny, i, j, p, args);
Value trueVal = constantI1(builder, loc, true); // The value for while (true)
SmallVector<Value, 4> operands{i, j, p, trueVal}; // Exactly four values.
SmallVector<Type, 4> types{i.getType(), j.getType(), p.getType(),
trueVal.getType()};
- scf::WhileOp whileOp = builder.create<scf::WhileOp>(loc, types, operands);
+ scf::WhileOp whileOp = scf::WhileOp::create(builder, loc, types, operands);
// The before-region of the WhileOp.
Block *befo...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/149928
More information about the Mlir-commits
mailing list