Skip to content

Commit 1d837af

Browse files
committed
[mlir][NFC] update flang/lib create APIs (12/n) (llvm#149687)
See llvm#147168 for more info.
1 parent b7e332d commit 1d837af

25 files changed

+448
-448
lines changed

flang/lib/Frontend/FrontendActions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static void addDependentLibs(mlir::ModuleOp mlirModule, CompilerInstance &ci) {
164164
// Add linker options specified by --dependent-lib
165165
auto builder = mlir::OpBuilder(mlirModule.getRegion());
166166
for (const std::string &lib : libs) {
167-
builder.create<mlir::LLVM::LinkerOptionsOp>(
167+
mlir::LLVM::LinkerOptionsOp::create(builder,
168168
mlirModule.getLoc(), builder.getStrArrayAttr({"/DEFAULTLIB:" + lib}));
169169
}
170170
}

flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class BoxprocTypeRewriter : public mlir::TypeConverter {
180180
mlir::ValueRange inputs,
181181
mlir::Location loc) {
182182
assert(inputs.size() == 1);
183-
return builder.create<ConvertOp>(loc, unwrapRefType(type.getEleTy()),
183+
return ConvertOp::create(builder, loc, unwrapRefType(type.getEleTy()),
184184
inputs[0]);
185185
}
186186

@@ -282,16 +282,16 @@ class BoxedProcedurePass
282282
// 32 bytes.
283283
fir::SequenceType::Extent thunkSize = triple.getTrampolineSize();
284284
mlir::Type buffTy = SequenceType::get({thunkSize}, i8Ty);
285-
auto buffer = builder.create<AllocaOp>(loc, buffTy);
285+
auto buffer = AllocaOp::create(builder, loc, buffTy);
286286
mlir::Value closure =
287287
builder.createConvert(loc, i8Ptr, embox.getHost());
288288
mlir::Value tramp = builder.createConvert(loc, i8Ptr, buffer);
289289
mlir::Value func =
290290
builder.createConvert(loc, i8Ptr, embox.getFunc());
291-
builder.create<fir::CallOp>(
291+
fir::CallOp::create(builder,
292292
loc, factory::getLlvmInitTrampoline(builder),
293293
llvm::ArrayRef<mlir::Value>{tramp, func, closure});
294-
auto adjustCall = builder.create<fir::CallOp>(
294+
auto adjustCall = fir::CallOp::create(builder,
295295
loc, factory::getLlvmAdjustTrampoline(builder),
296296
llvm::ArrayRef<mlir::Value>{tramp});
297297
rewriter.replaceOpWithNewOp<ConvertOp>(embox, toTy,

flang/lib/Optimizer/CodeGen/CodeGen.cpp

Lines changed: 166 additions & 166 deletions
Large diffs are not rendered by default.

flang/lib/Optimizer/CodeGen/FIROpPatterns.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ mlir::LLVM::ConstantOp ConvertFIRToLLVMPattern::genI32Constant(
4848
int value) const {
4949
mlir::Type i32Ty = rewriter.getI32Type();
5050
mlir::IntegerAttr attr = rewriter.getI32IntegerAttr(value);
51-
return rewriter.create<mlir::LLVM::ConstantOp>(loc, i32Ty, attr);
51+
return mlir::LLVM::ConstantOp::create(rewriter, loc, i32Ty, attr);
5252
}
5353

5454
mlir::LLVM::ConstantOp ConvertFIRToLLVMPattern::genConstantOffset(
5555
mlir::Location loc, mlir::ConversionPatternRewriter &rewriter,
5656
int offset) const {
5757
mlir::Type ity = lowerTy().offsetType();
5858
mlir::IntegerAttr cattr = rewriter.getI32IntegerAttr(offset);
59-
return rewriter.create<mlir::LLVM::ConstantOp>(loc, ity, cattr);
59+
return mlir::LLVM::ConstantOp::create(rewriter, loc, ity, cattr);
6060
}
6161

6262
/// Perform an extension or truncation as needed on an integer value. Lowering
@@ -80,9 +80,9 @@ mlir::Value ConvertFIRToLLVMPattern::integerCast(
8080
return rewriter.createOrFold<mlir::LLVM::SExtOp>(loc, ty, val);
8181
} else {
8282
if (toSize < fromSize)
83-
return rewriter.create<mlir::LLVM::TruncOp>(loc, ty, val);
83+
return mlir::LLVM::TruncOp::create(rewriter, loc, ty, val);
8484
if (toSize > fromSize)
85-
return rewriter.create<mlir::LLVM::SExtOp>(loc, ty, val);
85+
return mlir::LLVM::SExtOp::create(rewriter, loc, ty, val);
8686
}
8787
return val;
8888
}
@@ -100,16 +100,16 @@ mlir::Value ConvertFIRToLLVMPattern::getValueFromBox(
100100
mlir::ConversionPatternRewriter &rewriter, int boxValue) const {
101101
if (mlir::isa<mlir::LLVM::LLVMPointerType>(box.getType())) {
102102
auto pty = getLlvmPtrType(resultTy.getContext());
103-
auto p = rewriter.create<mlir::LLVM::GEPOp>(
103+
auto p = mlir::LLVM::GEPOp::create(rewriter,
104104
loc, pty, boxTy.llvm, box,
105105
llvm::ArrayRef<mlir::LLVM::GEPArg>{0, boxValue});
106106
auto fldTy = getBoxEleTy(boxTy.llvm, {boxValue});
107-
auto loadOp = rewriter.create<mlir::LLVM::LoadOp>(loc, fldTy, p);
107+
auto loadOp = mlir::LLVM::LoadOp::create(rewriter, loc, fldTy, p);
108108
auto castOp = integerCast(loc, rewriter, resultTy, loadOp);
109109
attachTBAATag(loadOp, boxTy.fir, nullptr, p);
110110
return castOp;
111111
}
112-
return rewriter.create<mlir::LLVM::ExtractValueOp>(loc, box, boxValue);
112+
return mlir::LLVM::ExtractValueOp::create(rewriter, loc, box, boxValue);
113113
}
114114

115115
/// Method to construct code sequence to get the triple for dimension `dim`
@@ -147,7 +147,7 @@ mlir::Value ConvertFIRToLLVMPattern::loadDimFieldFromBox(
147147
"in memory");
148148
mlir::LLVM::GEPOp p = genGEP(loc, boxTy.llvm, rewriter, box, 0,
149149
static_cast<int>(kDimsPosInBox), dim, off);
150-
auto loadOp = rewriter.create<mlir::LLVM::LoadOp>(loc, ty, p);
150+
auto loadOp = mlir::LLVM::LoadOp::create(rewriter, loc, ty, p);
151151
attachTBAATag(loadOp, boxTy.fir, nullptr, p);
152152
return loadOp;
153153
}
@@ -158,11 +158,11 @@ mlir::Value ConvertFIRToLLVMPattern::getDimFieldFromBox(
158158
if (mlir::isa<mlir::LLVM::LLVMPointerType>(box.getType())) {
159159
mlir::LLVM::GEPOp p = genGEP(loc, boxTy.llvm, rewriter, box, 0,
160160
static_cast<int>(kDimsPosInBox), dim, off);
161-
auto loadOp = rewriter.create<mlir::LLVM::LoadOp>(loc, ty, p);
161+
auto loadOp = mlir::LLVM::LoadOp::create(rewriter, loc, ty, p);
162162
attachTBAATag(loadOp, boxTy.fir, nullptr, p);
163163
return loadOp;
164164
}
165-
return rewriter.create<mlir::LLVM::ExtractValueOp>(
165+
return mlir::LLVM::ExtractValueOp::create(rewriter,
166166
loc, box, llvm::ArrayRef<std::int64_t>{kDimsPosInBox, dim, off});
167167
}
168168

@@ -251,9 +251,9 @@ mlir::Value ConvertFIRToLLVMPattern::genBoxAttributeCheck(
251251
getValueFromBox(loc, boxTy, box, attrTy, rewriter, kAttributePosInBox);
252252
mlir::LLVM::ConstantOp attrMask = genConstantOffset(loc, rewriter, maskValue);
253253
auto maskRes =
254-
rewriter.create<mlir::LLVM::AndOp>(loc, attrTy, attribute, attrMask);
254+
mlir::LLVM::AndOp::create(rewriter, loc, attrTy, attribute, attrMask);
255255
mlir::LLVM::ConstantOp c0 = genConstantOffset(loc, rewriter, 0);
256-
return rewriter.create<mlir::LLVM::ICmpOp>(loc, mlir::LLVM::ICmpPredicate::ne,
256+
return mlir::LLVM::ICmpOp::create(rewriter, loc, mlir::LLVM::ICmpPredicate::ne,
257257
maskRes, c0);
258258
}
259259

@@ -281,9 +281,9 @@ mlir::Value ConvertFIRToLLVMPattern::computeBoxSize(
281281
firBoxType.getBoxTypeWithNewShape(1)))) &&
282282
"descriptor layout requires adding padding for dim field");
283283
mlir::Value sizePerDim = genConstantOffset(loc, rewriter, sizePerDimCst);
284-
mlir::Value dimsSize = rewriter.create<mlir::LLVM::MulOp>(
284+
mlir::Value dimsSize = mlir::LLVM::MulOp::create(rewriter,
285285
loc, sizePerDim.getType(), sizePerDim, rank);
286-
mlir::Value size = rewriter.create<mlir::LLVM::AddOp>(
286+
mlir::Value size = mlir::LLVM::AddOp::create(rewriter,
287287
loc, scalarBoxSize.getType(), scalarBoxSize, dimsSize);
288288
return size;
289289
}
@@ -324,7 +324,7 @@ mlir::Value ConvertFIRToLLVMPattern::genAllocaAndAddrCastWithType(
324324
unsigned allocaAs = getAllocaAddressSpace(rewriter);
325325
unsigned programAs = getProgramAddressSpace(rewriter);
326326

327-
mlir::Value al = rewriter.create<mlir::LLVM::AllocaOp>(
327+
mlir::Value al = mlir::LLVM::AllocaOp::create(rewriter,
328328
loc, ::getLlvmPtrType(llvmObjectTy.getContext(), allocaAs), llvmObjectTy,
329329
size, alignment);
330330

@@ -334,7 +334,7 @@ mlir::Value ConvertFIRToLLVMPattern::genAllocaAndAddrCastWithType(
334334
// the numeric value 5 (private), and the program address space is 0
335335
// (generic).
336336
if (allocaAs != programAs) {
337-
al = rewriter.create<mlir::LLVM::AddrSpaceCastOp>(
337+
al = mlir::LLVM::AddrSpaceCastOp::create(rewriter,
338338
loc, ::getLlvmPtrType(llvmObjectTy.getContext(), programAs), al);
339339
}
340340

flang/lib/Optimizer/CodeGen/LowerRepackArrays.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,20 @@ PackArrayConversion::matchAndRewrite(fir::PackArrayOp op,
152152

153153
// For now we have to always check if the box is present.
154154
auto isPresent =
155-
builder.create<fir::IsPresentOp>(loc, builder.getI1Type(), box);
155+
fir::IsPresentOp::create(builder, loc, builder.getI1Type(), box);
156156

157-
fir::IfOp ifOp = builder.create<fir::IfOp>(loc, boxType, isPresent,
157+
fir::IfOp ifOp = fir::IfOp::create(builder, loc, boxType, isPresent,
158158
/*withElseRegion=*/true);
159159
builder.setInsertionPointToStart(&ifOp.getThenRegion().front());
160160
// The box is present.
161161
auto newBox = genRepackedBox(builder, loc, op);
162162
if (mlir::failed(newBox))
163163
return newBox;
164-
builder.create<fir::ResultOp>(loc, *newBox);
164+
fir::ResultOp::create(builder, loc, *newBox);
165165

166166
// The box is not present. Return original box.
167167
builder.setInsertionPointToStart(&ifOp.getElseRegion().front());
168-
builder.create<fir::ResultOp>(loc, box);
168+
fir::ResultOp::create(builder, loc, box);
169169

170170
rewriter.replaceOp(op, ifOp.getResult(0));
171171
return mlir::success();
@@ -199,7 +199,7 @@ mlir::Value PackArrayConversion::allocateTempBuffer(
199199
// We need to reset the CFI_attribute_allocatable before
200200
// returning the temporary box to avoid any mishandling
201201
// of the temporary box in Fortran runtime.
202-
base = builder.create<fir::BoxAddrOp>(loc, fir::boxMemRefType(tempBoxType),
202+
base = fir::BoxAddrOp::create(builder, loc, fir::boxMemRefType(tempBoxType),
203203
base);
204204
ptrType = base.getType();
205205
}
@@ -263,22 +263,22 @@ PackArrayConversion::genRepackedBox(fir::FirOpBuilder &builder,
263263

264264
// Create a temporay iff the original is not contigous and is not empty.
265265
auto isNotContiguous = builder.genNot(
266-
loc, builder.create<fir::IsContiguousBoxOp>(loc, box, op.getInnermost()));
266+
loc, fir::IsContiguousBoxOp::create(builder, loc, box, op.getInnermost()));
267267
auto dataAddr =
268-
builder.create<fir::BoxAddrOp>(loc, fir::boxMemRefType(boxType), box);
268+
fir::BoxAddrOp::create(builder, loc, fir::boxMemRefType(boxType), box);
269269
auto isNotEmpty =
270-
builder.create<fir::IsPresentOp>(loc, builder.getI1Type(), dataAddr);
270+
fir::IsPresentOp::create(builder, loc, builder.getI1Type(), dataAddr);
271271
auto doPack =
272-
builder.create<mlir::arith::AndIOp>(loc, isNotContiguous, isNotEmpty);
272+
mlir::arith::AndIOp::create(builder, loc, isNotContiguous, isNotEmpty);
273273

274274
fir::IfOp ifOp =
275-
builder.create<fir::IfOp>(loc, boxType, doPack, /*withElseRegion=*/true);
275+
fir::IfOp::create(builder, loc, boxType, doPack, /*withElseRegion=*/true);
276276
// Assume that the repacking is unlikely.
277277
ifOp.setUnlikelyIfWeights();
278278

279279
// Return original box.
280280
builder.setInsertionPointToStart(&ifOp.getElseRegion().front());
281-
builder.create<fir::ResultOp>(loc, box);
281+
fir::ResultOp::create(builder, loc, box);
282282

283283
// Create a new box.
284284
builder.setInsertionPointToStart(&ifOp.getThenRegion().front());
@@ -308,7 +308,7 @@ PackArrayConversion::genRepackedBox(fir::FirOpBuilder &builder,
308308
if (!op.getNoCopy())
309309
fir::runtime::genShallowCopy(builder, loc, tempBox, box,
310310
/*resultIsAllocated=*/true);
311-
builder.create<fir::ResultOp>(loc, tempBox);
311+
fir::ResultOp::create(builder, loc, tempBox);
312312

313313
return ifOp.getResult(0);
314314
}
@@ -330,15 +330,15 @@ UnpackArrayConversion::matchAndRewrite(fir::UnpackArrayOp op,
330330

331331
// For now we have to always check if the box is present.
332332
auto isPresent =
333-
builder.create<fir::IsPresentOp>(loc, predicateType, originalBox);
333+
fir::IsPresentOp::create(builder, loc, predicateType, originalBox);
334334

335335
builder.genIfThen(loc, isPresent).genThen([&]() {
336336
mlir::Type addrType =
337337
fir::HeapType::get(fir::extractSequenceType(tempBox.getType()));
338338
mlir::Value tempAddr =
339-
builder.create<fir::BoxAddrOp>(loc, addrType, tempBox);
339+
fir::BoxAddrOp::create(builder, loc, addrType, tempBox);
340340
mlir::Value originalAddr =
341-
builder.create<fir::BoxAddrOp>(loc, addrType, originalBox);
341+
fir::BoxAddrOp::create(builder, loc, addrType, originalBox);
342342

343343
auto isNotSame = builder.genPtrCompare(loc, mlir::arith::CmpIPredicate::ne,
344344
tempAddr, originalAddr);
@@ -356,7 +356,7 @@ UnpackArrayConversion::matchAndRewrite(fir::UnpackArrayOp op,
356356
// to the runtime that uses heap memory, even when the stack
357357
// attribute is set on fir.pack_array.
358358
if (!op.getStack() || !canAllocateTempOnStack(originalBox))
359-
builder.create<fir::FreeMemOp>(loc, tempAddr);
359+
fir::FreeMemOp::create(builder, loc, tempAddr);
360360
})
361361
.getIfOp()
362362
.setUnlikelyIfWeights();

flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ class EmboxConversion : public mlir::OpRewritePattern<fir::EmboxOp> {
103103
auto idxTy = rewriter.getIndexType();
104104
for (auto ext : seqTy.getShape()) {
105105
auto iAttr = rewriter.getIndexAttr(ext);
106-
auto extVal = rewriter.create<mlir::arith::ConstantOp>(loc, idxTy, iAttr);
106+
auto extVal = mlir::arith::ConstantOp::create(rewriter, loc, idxTy, iAttr);
107107
shapeOpers.push_back(extVal);
108108
}
109-
auto xbox = rewriter.create<fir::cg::XEmboxOp>(
109+
auto xbox = fir::cg::XEmboxOp::create(rewriter,
110110
loc, embox.getType(), embox.getMemref(), shapeOpers, mlir::ValueRange{},
111111
mlir::ValueRange{}, mlir::ValueRange{}, mlir::ValueRange{},
112112
embox.getTypeparams(), embox.getSourceBox(),
@@ -143,7 +143,7 @@ class EmboxConversion : public mlir::OpRewritePattern<fir::EmboxOp> {
143143
substrOpers.assign(sliceOp.getSubstr().begin(),
144144
sliceOp.getSubstr().end());
145145
}
146-
auto xbox = rewriter.create<fir::cg::XEmboxOp>(
146+
auto xbox = fir::cg::XEmboxOp::create(rewriter,
147147
loc, embox.getType(), embox.getMemref(), shapeOpers, shiftOpers,
148148
sliceOpers, subcompOpers, substrOpers, embox.getTypeparams(),
149149
embox.getSourceBox(), embox.getAllocatorIdxAttr());
@@ -201,7 +201,7 @@ class ReboxConversion : public mlir::OpRewritePattern<fir::ReboxOp> {
201201
sliceOp.getSubstr().end());
202202
}
203203

204-
auto xRebox = rewriter.create<fir::cg::XReboxOp>(
204+
auto xRebox = fir::cg::XReboxOp::create(rewriter,
205205
loc, rebox.getType(), rebox.getBox(), shapeOpers, shiftOpers,
206206
sliceOpers, subcompOpers, substrOpers);
207207
LLVM_DEBUG(llvm::dbgs()
@@ -259,7 +259,7 @@ class ArrayCoorConversion : public mlir::OpRewritePattern<fir::ArrayCoorOp> {
259259
"Don't allow substring operations on array_coor. This "
260260
"restriction may be lifted in the future.");
261261
}
262-
auto xArrCoor = rewriter.create<fir::cg::XArrayCoorOp>(
262+
auto xArrCoor = fir::cg::XArrayCoorOp::create(rewriter,
263263
loc, arrCoor.getType(), arrCoor.getMemref(), shapeOpers, shiftOpers,
264264
sliceOpers, subcompOpers, arrCoor.getIndices(),
265265
arrCoor.getTypeparams());
@@ -301,7 +301,7 @@ class DeclareOpConversion : public mlir::OpRewritePattern<fir::DeclareOp> {
301301
return mlir::failure();
302302
}
303303
// FIXME: Add FortranAttrs and CudaAttrs
304-
auto xDeclOp = rewriter.create<fir::cg::XDeclareOp>(
304+
auto xDeclOp = fir::cg::XDeclareOp::create(rewriter,
305305
loc, declareOp.getType(), declareOp.getMemref(), shapeOpers, shiftOpers,
306306
declareOp.getTypeparams(), declareOp.getDummyScope(),
307307
declareOp.getUniqName());

flang/lib/Optimizer/Dialect/FIRDialect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct FIRInlinerInterface : public mlir::DialectInlinerInterface {
5656
mlir::Value input,
5757
mlir::Type resultType,
5858
mlir::Location loc) const final {
59-
return builder.create<fir::ConvertOp>(loc, resultType, input);
59+
return fir::ConvertOp::create(builder, loc, resultType, input);
6060
}
6161
};
6262
} // namespace

flang/lib/Optimizer/Dialect/FIROps.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ struct SimplifyArrayCoorOp : public mlir::OpRewritePattern<fir::ArrayCoorOp> {
782782
return nullptr;
783783
mlir::OpBuilder::InsertionGuard guard(rewriter);
784784
rewriter.setInsertionPoint(shapeShiftOp);
785-
return rewriter.create<fir::ShapeOp>(shapeShiftOp.getLoc(),
785+
return fir::ShapeOp::create(rewriter, shapeShiftOp.getLoc(),
786786
shapeShiftOp.getExtents());
787787
}
788788

@@ -797,19 +797,19 @@ struct SimplifyArrayCoorOp : public mlir::OpRewritePattern<fir::ArrayCoorOp> {
797797
rewriter.setInsertionPoint(op);
798798
mlir::Location loc = op->getLoc();
799799
mlir::Type idxTy = rewriter.getIndexType();
800-
mlir::Value one = rewriter.create<mlir::arith::ConstantOp>(
800+
mlir::Value one = mlir::arith::ConstantOp::create(rewriter,
801801
loc, idxTy, rewriter.getIndexAttr(1));
802802
rewriter.restoreInsertionPoint(savedIP);
803803
auto nsw = mlir::arith::IntegerOverflowFlags::nsw;
804804

805805
IndicesVectorTy shiftedIndices;
806806
for (auto [lb, idx] : llvm::zip(lbs, indices)) {
807-
mlir::Value extLb = rewriter.create<fir::ConvertOp>(loc, idxTy, lb);
808-
mlir::Value extIdx = rewriter.create<fir::ConvertOp>(loc, idxTy, idx);
807+
mlir::Value extLb = fir::ConvertOp::create(rewriter, loc, idxTy, lb);
808+
mlir::Value extIdx = fir::ConvertOp::create(rewriter, loc, idxTy, idx);
809809
mlir::Value add =
810-
rewriter.create<mlir::arith::AddIOp>(loc, extIdx, extLb, nsw);
810+
mlir::arith::AddIOp::create(rewriter, loc, extIdx, extLb, nsw);
811811
mlir::Value sub =
812-
rewriter.create<mlir::arith::SubIOp>(loc, add, one, nsw);
812+
mlir::arith::SubIOp::create(rewriter, loc, add, one, nsw);
813813
shiftedIndices.push_back(sub);
814814
}
815815

@@ -4711,7 +4711,7 @@ mlir::func::FuncOp fir::createFuncOp(mlir::Location loc, mlir::ModuleOp module,
47114711
return f;
47124712
mlir::OpBuilder modBuilder(module.getBodyRegion());
47134713
modBuilder.setInsertionPointToEnd(module.getBody());
4714-
auto result = modBuilder.create<mlir::func::FuncOp>(loc, name, type, attrs);
4714+
auto result = mlir::func::FuncOp::create(modBuilder, loc, name, type, attrs);
47154715
result.setVisibility(mlir::SymbolTable::Visibility::Private);
47164716
return result;
47174717
}
@@ -4731,7 +4731,7 @@ fir::GlobalOp fir::createGlobalOp(mlir::Location loc, mlir::ModuleOp module,
47314731
if (auto g = module.lookupSymbol<fir::GlobalOp>(name))
47324732
return g;
47334733
mlir::OpBuilder modBuilder(module.getBodyRegion());
4734-
auto result = modBuilder.create<fir::GlobalOp>(loc, name, type, attrs);
4734+
auto result = fir::GlobalOp::create(modBuilder, loc, name, type, attrs);
47354735
result.setVisibility(mlir::SymbolTable::Visibility::Private);
47364736
return result;
47374737
}

flang/lib/Optimizer/HLFIR/IR/HLFIRDialect.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,13 @@ mlir::Value hlfir::genExprShape(mlir::OpBuilder &builder,
201201
for (std::int64_t extent : expr.getShape()) {
202202
if (extent == hlfir::ExprType::getUnknownExtent())
203203
return {};
204-
extents.emplace_back(builder.create<mlir::arith::ConstantOp>(
204+
extents.emplace_back(mlir::arith::ConstantOp::create(builder,
205205
loc, indexTy, builder.getIntegerAttr(indexTy, extent)));
206206
}
207207

208208
fir::ShapeType shapeTy =
209209
fir::ShapeType::get(builder.getContext(), expr.getRank());
210-
fir::ShapeOp shape = builder.create<fir::ShapeOp>(loc, shapeTy, extents);
210+
fir::ShapeOp shape = fir::ShapeOp::create(builder, loc, shapeTy, extents);
211211
return shape.getResult();
212212
}
213213

0 commit comments

Comments
 (0)