Skip to content

Commit 9a805ba

Browse files
authored
[flang][NFC] Fix deprecation warning (#147932)
I started getting deprecation warnings from operations constructors which seem to be doing implicit construction of mlir::ValueRange from a std::nullopt by relying on implicit conversion from std::nullopt into llvm::ArrayRef. ArrayRef{std::nullopt} is what has been deprecated.
1 parent 7eb14d9 commit 9a805ba

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

flang/lib/Optimizer/CodeGen/CodeGen.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,18 +2239,17 @@ struct XReboxOpConversion : public EmboxCommonConversion<fir::cg::XReboxOp> {
22392239
getSubcomponentIndices(rebox, rebox.getBox(), operands, fieldIndices);
22402240
if (!rebox.getSubstr().empty())
22412241
substringOffset = operands[rebox.getSubstrOperandIndex()];
2242-
base =
2243-
genBoxOffsetGep(rewriter, loc, base, llvmBaseObjectType, zero,
2244-
/*cstInteriorIndices=*/llvm::ArrayRef<mlir::Value>(),
2245-
fieldIndices, substringOffset);
2242+
base = genBoxOffsetGep(rewriter, loc, base, llvmBaseObjectType, zero,
2243+
/*cstInteriorIndices=*/{}, fieldIndices,
2244+
substringOffset);
22462245
}
22472246

22482247
if (rebox.getSlice().empty())
22492248
// The array section is of the form array[%component][substring], keep
22502249
// the input array extents and strides.
22512250
return finalizeRebox(rebox, adaptor, destBoxTy, dest, base,
2252-
/*lbounds*/ llvm::ArrayRef<mlir::Value>(),
2253-
inputExtents, inputStrides, rewriter);
2251+
/*lbounds*/ {}, inputExtents, inputStrides,
2252+
rewriter);
22542253

22552254
// The slice is of the form array(i:j:k)[%component]. Compute new extents
22562255
// and strides.
@@ -2298,8 +2297,8 @@ struct XReboxOpConversion : public EmboxCommonConversion<fir::cg::XReboxOp> {
22982297
}
22992298
}
23002299
return finalizeRebox(rebox, adaptor, destBoxTy, dest, base,
2301-
/*lbounds*/ llvm::ArrayRef<mlir::Value>(),
2302-
slicedExtents, slicedStrides, rewriter);
2300+
/*lbounds*/ {}, slicedExtents, slicedStrides,
2301+
rewriter);
23032302
}
23042303

23052304
/// Apply a new shape to the data described by a box given the base address,
@@ -3397,8 +3396,7 @@ static void genBrOp(A caseOp, mlir::Block *dest, std::optional<B> destOps,
33973396
if (destOps)
33983397
rewriter.replaceOpWithNewOp<mlir::LLVM::BrOp>(caseOp, *destOps, dest);
33993398
else
3400-
rewriter.replaceOpWithNewOp<mlir::LLVM::BrOp>(
3401-
caseOp, llvm::ArrayRef<mlir::Value>(), dest);
3399+
rewriter.replaceOpWithNewOp<mlir::LLVM::BrOp>(caseOp, B{}, dest);
34023400
}
34033401

34043402
static void genCaseLadderStep(mlir::Location loc, mlir::Value cmp,

flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,8 @@ class EmboxConversion : public mlir::OpRewritePattern<fir::EmboxOp> {
107107
shapeOpers.push_back(extVal);
108108
}
109109
auto xbox = rewriter.create<fir::cg::XEmboxOp>(
110-
loc, embox.getType(), embox.getMemref(), shapeOpers,
111-
llvm::ArrayRef<mlir::Value>(), llvm::ArrayRef<mlir::Value>(),
112-
llvm::ArrayRef<mlir::Value>(), llvm::ArrayRef<mlir::Value>(),
110+
loc, embox.getType(), embox.getMemref(), shapeOpers, mlir::ValueRange{},
111+
mlir::ValueRange{}, mlir::ValueRange{}, mlir::ValueRange{},
113112
embox.getTypeparams(), embox.getSourceBox(),
114113
embox.getAllocatorIdxAttr());
115114
LLVM_DEBUG(llvm::dbgs() << "rewriting " << embox << " to " << xbox << '\n');

0 commit comments

Comments
 (0)