Skip to content

Commit 4651b68

Browse files
committed
[mlir] Use {} instead of std::nullopt to initialize empty ArrayRef
Follow up to llvm#109133.
1 parent 5b4c80f commit 4651b68

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+75
-72
lines changed

mlir/include/mlir/AsmParser/AsmParserState.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class AsmParserState {
195195
/// Finalize the most recently started operation definition.
196196
void finalizeOperationDefinition(
197197
Operation *op, SMRange nameLoc, SMLoc endLoc,
198-
ArrayRef<std::pair<unsigned, SMLoc>> resultGroups = std::nullopt);
198+
ArrayRef<std::pair<unsigned, SMLoc>> resultGroups = {});
199199

200200
/// Start a definition for a region nested under the current operation.
201201
void startRegionDefinition();

mlir/include/mlir/CAPI/Wrap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static llvm::ArrayRef<CppTy> unwrapList(size_t size, CTy *first,
4444
"incompatible C and C++ types");
4545

4646
if (size == 0)
47-
return std::nullopt;
47+
return {};
4848

4949
assert(storage.empty() && "expected to populate storage");
5050
storage.reserve(size);

mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ def LLVM_LoadOp : LLVM_MemAccessOpBase<"load",
371371
auto *inst = builder.CreateLoad($_resultType, $addr, $volatile_);
372372
$res = inst;
373373
if ($invariant) {
374-
llvm::MDNode *metadata = llvm::MDNode::get(inst->getContext(), std::nullopt);
374+
llvm::MDNode *metadata = llvm::MDNode::get(inst->getContext(), {});
375375
inst->setMetadata(llvm::LLVMContext::MD_invariant_load, metadata);
376376
}
377377
}] # setOrderingCode

mlir/include/mlir/Dialect/PDL/IR/PDLOps.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def PDL_OperationOp : PDL_Op<"operation", [AttrSizedOperandSegments]> {
363363
let builders = [
364364
OpBuilder<(ins CArg<"std::optional<StringRef>", "std::nullopt">:$name,
365365
CArg<"ValueRange", "std::nullopt">:$operandValues,
366-
CArg<"ArrayRef<StringRef>", "std::nullopt">:$attrNames,
366+
CArg<"ArrayRef<StringRef>", "{}">:$attrNames,
367367
CArg<"ValueRange", "std::nullopt">:$attrValues,
368368
CArg<"ValueRange", "std::nullopt">:$resultTypes), [{
369369
auto nameAttr = name ? $_builder.getStringAttr(*name) : StringAttr();

mlir/include/mlir/ExecutionEngine/ExecutionEngine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class ExecutionEngine {
158158
/// Invokes the function with the given name passing it the list of opaque
159159
/// pointers to the actual arguments.
160160
llvm::Error invokePacked(StringRef name,
161-
MutableArrayRef<void *> args = std::nullopt);
161+
MutableArrayRef<void *> args = {});
162162

163163
/// Trait that defines how a given type is passed to the JIT code. This
164164
/// defaults to passing the address but can be specialized.

mlir/include/mlir/IR/BlockSupport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class BlockRange final
106106
Block *, Block *, Block *> {
107107
public:
108108
using RangeBaseT::RangeBaseT;
109-
BlockRange(ArrayRef<Block *> blocks = std::nullopt);
109+
BlockRange(ArrayRef<Block *> blocks = {});
110110
BlockRange(SuccessorRange successors);
111111
template <typename Arg, typename = std::enable_if_t<std::is_constructible<
112112
ArrayRef<Block *>, Arg>::value>>

mlir/include/mlir/IR/Builders.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,14 +463,14 @@ class OpBuilder : public Builder {
463463
/// should match the size of `argTypes`.
464464
Block *createBlock(Region *parent, Region::iterator insertPt = {},
465465
TypeRange argTypes = std::nullopt,
466-
ArrayRef<Location> locs = std::nullopt);
466+
ArrayRef<Location> locs = {});
467467

468468
/// Add new block with 'argTypes' arguments and set the insertion point to the
469469
/// end of it. The block is placed before 'insertBefore'. `locs` contains the
470470
/// locations of the inserted arguments, and should match the size of
471471
/// `argTypes`.
472472
Block *createBlock(Block *insertBefore, TypeRange argTypes = std::nullopt,
473-
ArrayRef<Location> locs = std::nullopt);
473+
ArrayRef<Location> locs = {});
474474

475475
//===--------------------------------------------------------------------===//
476476
// Operation Creation

mlir/include/mlir/IR/BuiltinAttributes.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ def Builtin_DictionaryAttr : Builtin_Attr<"Dictionary", "dictionary"> {
516516
}];
517517
let parameters = (ins ArrayRefParameter<"NamedAttribute", "">:$value);
518518
let builders = [
519-
AttrBuilder<(ins CArg<"ArrayRef<NamedAttribute>", "std::nullopt">:$value)>
519+
AttrBuilder<(ins CArg<"ArrayRef<NamedAttribute>", "{}">:$value)>
520520
];
521521
let extraClassDeclaration = [{
522522
using ValueType = ArrayRef<NamedAttribute>;

mlir/include/mlir/IR/BuiltinTypes.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ def Builtin_UnrankedMemRef : Builtin_Type<"UnrankedMemRef", "unranked_memref", [
10701070
using ShapedType::Trait<UnrankedMemRefType>::getDimSize;
10711071
using ShapedType::Trait<UnrankedMemRefType>::getDynamicDimIndex;
10721072

1073-
ArrayRef<int64_t> getShape() const { return std::nullopt; }
1073+
ArrayRef<int64_t> getShape() const { return {}; }
10741074

10751075
/// [deprecated] Returns the memory space in old raw integer representation.
10761076
/// New `Attribute getMemorySpace()` method should be used instead.
@@ -1129,7 +1129,7 @@ def Builtin_UnrankedTensor : Builtin_Type<"UnrankedTensor", "unranked_tensor", [
11291129
using ShapedType::Trait<UnrankedTensorType>::getDimSize;
11301130
using ShapedType::Trait<UnrankedTensorType>::getDynamicDimIndex;
11311131

1132-
ArrayRef<int64_t> getShape() const { return std::nullopt; }
1132+
ArrayRef<int64_t> getShape() const { return {}; }
11331133
}];
11341134
let skipDefaultBuilders = 1;
11351135
let genVerifyDecl = 1;

mlir/include/mlir/IR/Matchers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ struct constant_op_binder {
8888

8989
// Fold the constant to an attribute.
9090
SmallVector<OpFoldResult, 1> foldedOp;
91-
LogicalResult result = op->fold(/*operands=*/std::nullopt, foldedOp);
91+
LogicalResult result = op->fold(/*operands=*/{}, foldedOp);
9292
(void)result;
9393
assert(succeeded(result) && "expected ConstantLike op to be foldable");
9494

mlir/include/mlir/IR/PatternMatch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ class RewritePatternSet {
847847
RewritePatternSet &add(ConstructorArg &&arg, ConstructorArgs &&...args) {
848848
// The following expands a call to emplace_back for each of the pattern
849849
// types 'Ts'.
850-
(addImpl<Ts>(/*debugLabels=*/std::nullopt,
850+
(addImpl<Ts>(/*debugLabels=*/{},
851851
std::forward<ConstructorArg>(arg),
852852
std::forward<ConstructorArgs>(args)...),
853853
...);
@@ -931,7 +931,7 @@ class RewritePatternSet {
931931
RewritePatternSet &insert(ConstructorArg &&arg, ConstructorArgs &&...args) {
932932
// The following expands a call to emplace_back for each of the pattern
933933
// types 'Ts'.
934-
(addImpl<Ts>(/*debugLabels=*/std::nullopt, arg, args...), ...);
934+
(addImpl<Ts>(/*debugLabels=*/{}, arg, args...), ...);
935935
return *this;
936936
}
937937

mlir/include/mlir/IR/Region.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ class RegionRange
353353
public:
354354
using RangeBaseT::RangeBaseT;
355355

356-
RegionRange(MutableArrayRef<Region> regions = std::nullopt);
356+
RegionRange(MutableArrayRef<Region> regions = {});
357357

358358
template <typename Arg, typename = std::enable_if_t<std::is_constructible<
359359
ArrayRef<std::unique_ptr<Region>>, Arg>::value>>

mlir/include/mlir/IR/SymbolTable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ class SymbolUserMap {
395395
/// Return the users of the provided symbol operation.
396396
ArrayRef<Operation *> getUsers(Operation *symbol) const {
397397
auto it = symbolToUsers.find(symbol);
398-
return it != symbolToUsers.end() ? it->second.getArrayRef() : std::nullopt;
398+
return it != symbolToUsers.end() ? it->second.getArrayRef() : ArrayRef<Operation *>();
399399
}
400400

401401
/// Return true if the given symbol has no uses.

mlir/include/mlir/IR/TypeRange.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class TypeRange : public llvm::detail::indexed_accessor_range_base<
3636
Type, Type, Type> {
3737
public:
3838
using RangeBaseT::RangeBaseT;
39-
TypeRange(ArrayRef<Type> types = std::nullopt);
39+
TypeRange(ArrayRef<Type> types = {});
4040
explicit TypeRange(OperandRange values);
4141
explicit TypeRange(ResultRange values);
4242
explicit TypeRange(ValueRange values);
@@ -47,6 +47,8 @@ class TypeRange : public llvm::detail::indexed_accessor_range_base<
4747
template <typename Arg, typename = std::enable_if_t<std::is_constructible<
4848
ArrayRef<Type>, Arg>::value>>
4949
TypeRange(Arg &&arg) : TypeRange(ArrayRef<Type>(std::forward<Arg>(arg))) {}
50+
TypeRange(std::nullopt_t)
51+
: TypeRange(ArrayRef<Type>()) {}
5052
TypeRange(std::initializer_list<Type> types)
5153
: TypeRange(ArrayRef<Type>(types)) {}
5254

mlir/include/mlir/IR/ValueRange.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class MutableOperandRange {
123123
/// and range length. `operandSegments` is an optional set of operand segments
124124
/// to be updated when mutating the operand list.
125125
MutableOperandRange(Operation *owner, unsigned start, unsigned length,
126-
ArrayRef<OperandSegment> operandSegments = std::nullopt);
126+
ArrayRef<OperandSegment> operandSegments = {});
127127
MutableOperandRange(Operation *owner);
128128

129129
/// Construct a new mutable range for the given OpOperand.
@@ -392,6 +392,7 @@ class ValueRange final
392392
std::is_constructible<ArrayRef<Value>, Arg>::value &&
393393
!std::is_convertible<Arg, Value>::value>>
394394
ValueRange(Arg &&arg) : ValueRange(ArrayRef<Value>(std::forward<Arg>(arg))) {}
395+
ValueRange(std::nullopt_t) : ValueRange(ArrayRef<Value>()) {}
395396
ValueRange(const Value &value) : ValueRange(&value, /*count=*/1) {}
396397
ValueRange(const std::initializer_list<Value> &values)
397398
: ValueRange(ArrayRef<Value>(values)) {}
@@ -401,7 +402,7 @@ class ValueRange final
401402
: ValueRange(ResultRange(values)) {}
402403
ValueRange(ArrayRef<BlockArgument> values)
403404
: ValueRange(ArrayRef<Value>(values.data(), values.size())) {}
404-
ValueRange(ArrayRef<Value> values = std::nullopt);
405+
ValueRange(ArrayRef<Value> values = {});
405406
ValueRange(OperandRange values);
406407
ValueRange(ResultRange values);
407408

mlir/include/mlir/Rewrite/FrozenRewritePatternSet.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ class FrozenRewritePatternSet {
4949
/// their type name.
5050
FrozenRewritePatternSet(
5151
RewritePatternSet &&patterns,
52-
ArrayRef<std::string> disabledPatternLabels = std::nullopt,
53-
ArrayRef<std::string> enabledPatternLabels = std::nullopt);
52+
ArrayRef<std::string> disabledPatternLabels = {},
53+
ArrayRef<std::string> enabledPatternLabels = {});
5454

5555
/// Return the op specific native patterns held by this list.
5656
const OpSpecificNativePatternListT &getOpSpecificNativePatterns() const {

mlir/include/mlir/Support/StorageUniquer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class StorageUniquer {
9797
template <typename T>
9898
ArrayRef<T> copyInto(ArrayRef<T> elements) {
9999
if (elements.empty())
100-
return std::nullopt;
100+
return {};
101101
auto result = allocator.Allocate<T>(elements.size());
102102
std::uninitialized_copy(elements.begin(), elements.end(), result);
103103
return ArrayRef<T>(result, elements.size());

mlir/include/mlir/Tools/PDLL/AST/Nodes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ class UserConstraintDecl final
897897
ArrayRef<VariableDecl *> results,
898898
const CompoundStmt *body,
899899
Type resultType) {
900-
return createImpl(ctx, name, inputs, /*nativeInputTypes=*/std::nullopt,
900+
return createImpl(ctx, name, inputs, /*nativeInputTypes=*/{},
901901
results, /*codeBlock=*/std::nullopt, body, resultType);
902902
}
903903

mlir/include/mlir/Tools/PDLL/AST/Types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ class TupleType : public Type::TypeBase<detail::TupleTypeStorage> {
254254
static TupleType get(Context &context, ArrayRef<Type> elementTypes,
255255
ArrayRef<StringRef> elementNames);
256256
static TupleType get(Context &context,
257-
ArrayRef<Type> elementTypes = std::nullopt);
257+
ArrayRef<Type> elementTypes = {});
258258

259259
/// Return the element types of this tuple.
260260
ArrayRef<Type> getElementTypes() const;

mlir/include/mlir/Transforms/Passes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ std::unique_ptr<Pass> createCanonicalizerPass();
6161
/// set to their type name.
6262
std::unique_ptr<Pass>
6363
createCanonicalizerPass(const GreedyRewriteConfig &config,
64-
ArrayRef<std::string> disabledPatterns = std::nullopt,
65-
ArrayRef<std::string> enabledPatterns = std::nullopt);
64+
ArrayRef<std::string> disabledPatterns = {},
65+
ArrayRef<std::string> enabledPatterns = {});
6666

6767
/// Creates a pass to perform control-flow sinking.
6868
std::unique_ptr<Pass> createControlFlowSinkPass();

mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ void PDLToPDLInterpPass::runOnOperation() {
991991
module.getLoc(), pdl_interp::PDLInterpDialect::getMatcherFunctionName(),
992992
builder.getFunctionType(builder.getType<pdl::OperationType>(),
993993
/*results=*/std::nullopt),
994-
/*attrs=*/std::nullopt);
994+
/*attrs=*/ArrayRef<NamedAttribute>());
995995

996996
// Create a nested module to hold the functions invoked for rewriting the IR
997997
// after a successful match.

mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static Value createLinalgBodyCalculationForElementwiseOp(
250250
rewriter.create<arith::ShRSIOp>(loc, resultTypes, args[0], subtract)
251251
->getResults();
252252
auto truncated =
253-
rewriter.create<arith::TruncIOp>(loc, i1Ty, shifted, std::nullopt);
253+
rewriter.create<arith::TruncIOp>(loc, i1Ty, shifted, llvm::ArrayRef<NamedAttribute>());
254254
auto isInputOdd =
255255
rewriter.create<arith::AndIOp>(loc, i1Ty, truncated, i1one);
256256

@@ -453,20 +453,20 @@ static Value createLinalgBodyCalculationForElementwiseOp(
453453

454454
if (isa<FloatType>(srcTy) && isa<FloatType>(dstTy) && bitExtend)
455455
return rewriter.create<arith::ExtFOp>(loc, resultTypes, args,
456-
std::nullopt);
456+
llvm::ArrayRef<NamedAttribute>());
457457

458458
if (isa<FloatType>(srcTy) && isa<FloatType>(dstTy) && !bitExtend)
459459
return rewriter.create<arith::TruncFOp>(loc, resultTypes, args,
460-
std::nullopt);
460+
llvm::ArrayRef<NamedAttribute>());
461461

462462
// 1-bit integers need to be treated as signless.
463463
if (srcTy.isInteger(1) && arith::UIToFPOp::areCastCompatible(srcTy, dstTy))
464464
return rewriter.create<arith::UIToFPOp>(loc, resultTypes, args,
465-
std::nullopt);
465+
llvm::ArrayRef<NamedAttribute>());
466466

467467
if (srcTy.isInteger(1) && isa<IntegerType>(dstTy) && bitExtend)
468468
return rewriter.create<arith::ExtUIOp>(loc, resultTypes, args,
469-
std::nullopt);
469+
llvm::ArrayRef<NamedAttribute>());
470470

471471
// Unsigned integers need an unrealized cast so that they can be passed
472472
// to UIToFP.
@@ -484,7 +484,7 @@ static Value createLinalgBodyCalculationForElementwiseOp(
484484
// All other si-to-fp conversions should be handled by SIToFP.
485485
if (arith::SIToFPOp::areCastCompatible(srcTy, dstTy))
486486
return rewriter.create<arith::SIToFPOp>(loc, resultTypes, args,
487-
std::nullopt);
487+
llvm::ArrayRef<NamedAttribute>());
488488

489489
// Casting to boolean, floats need to only be checked as not-equal to zero.
490490
if (isa<FloatType>(srcTy) && dstTy.isInteger(1)) {
@@ -590,7 +590,7 @@ static Value createLinalgBodyCalculationForElementwiseOp(
590590

591591
if (isa<IntegerType>(srcTy) && isa<IntegerType>(dstTy) && bitExtend)
592592
return rewriter.create<arith::ExtSIOp>(loc, resultTypes, args,
593-
std::nullopt);
593+
llvm::ArrayRef<NamedAttribute>());
594594

595595
if (isa<IntegerType>(srcTy) && isa<IntegerType>(dstTy) && !bitExtend) {
596596
return rewriter.create<arith::TruncIOp>(loc, dstTy, args[0]);

mlir/lib/Dialect/Async/IR/Async.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ void FuncOp::build(OpBuilder &builder, OperationState &state, StringRef name,
309309
return;
310310
assert(type.getNumInputs() == argAttrs.size());
311311
function_interface_impl::addArgAndResultAttrs(
312-
builder, state, argAttrs, /*resultAttrs=*/std::nullopt,
312+
builder, state, argAttrs, /*resultAttrs=*/{},
313313
getArgAttrsAttrName(state.name), getResAttrsAttrName(state.name));
314314
}
315315

mlir/lib/Dialect/EmitC/IR/EmitC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ void FuncOp::build(OpBuilder &builder, OperationState &state, StringRef name,
530530
return;
531531
assert(type.getNumInputs() == argAttrs.size());
532532
function_interface_impl::addArgAndResultAttrs(
533-
builder, state, argAttrs, /*resultAttrs=*/std::nullopt,
533+
builder, state, argAttrs, /*resultAttrs=*/{},
534534
getArgAttrsAttrName(state.name), getResAttrsAttrName(state.name));
535535
}
536536

mlir/lib/Dialect/Func/IR/FuncOps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ void FuncOp::build(OpBuilder &builder, OperationState &state, StringRef name,
191191
return;
192192
assert(type.getNumInputs() == argAttrs.size());
193193
function_interface_impl::addArgAndResultAttrs(
194-
builder, state, argAttrs, /*resultAttrs=*/std::nullopt,
194+
builder, state, argAttrs, /*resultAttrs=*/{},
195195
getArgAttrsAttrName(state.name), getResAttrsAttrName(state.name));
196196
}
197197

mlir/lib/Dialect/GPU/Transforms/DecomposeMemRefs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static bool isInsideLaunch(Operation *op) {
4444
static std::tuple<Value, OpFoldResult, SmallVector<OpFoldResult>>
4545
getFlatOffsetAndStrides(OpBuilder &rewriter, Location loc, Value source,
4646
ArrayRef<OpFoldResult> subOffsets,
47-
ArrayRef<OpFoldResult> subStrides = std::nullopt) {
47+
ArrayRef<OpFoldResult> subStrides = {}) {
4848
auto sourceType = cast<MemRefType>(source.getType());
4949
auto sourceRank = static_cast<unsigned>(sourceType.getRank());
5050

@@ -100,7 +100,7 @@ static Value getFlatMemref(OpBuilder &rewriter, Location loc, Value source,
100100
getFlatOffsetAndStrides(rewriter, loc, source, offsetsTemp);
101101
auto retType = cast<MemRefType>(base.getType());
102102
return rewriter.create<memref::ReinterpretCastOp>(loc, retType, base, offset,
103-
std::nullopt, std::nullopt);
103+
llvm::ArrayRef<OpFoldResult>(), llvm::ArrayRef<OpFoldResult>());
104104
}
105105

106106
static bool needFlatten(Value val) {

mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2304,7 +2304,7 @@ void LLVMFuncOp::build(OpBuilder &builder, OperationState &result,
23042304
assert(llvm::cast<LLVMFunctionType>(type).getNumParams() == argAttrs.size() &&
23052305
"expected as many argument attribute lists as arguments");
23062306
function_interface_impl::addArgAndResultAttrs(
2307-
builder, result, argAttrs, /*resultAttrs=*/std::nullopt,
2307+
builder, result, argAttrs, /*resultAttrs=*/{},
23082308
getArgAttrsAttrName(result.name), getResAttrsAttrName(result.name));
23092309
}
23102310

mlir/lib/Dialect/LLVMIR/IR/TypeDetail.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct LLVMStructTypeStorage : public TypeStorage {
6969
class Key {
7070
public:
7171
/// Constructs a key for an identified struct.
72-
Key(StringRef name, bool opaque, ArrayRef<Type> types = std::nullopt)
72+
Key(StringRef name, bool opaque, ArrayRef<Type> types = {})
7373
: types(types), name(name), identified(true), packed(false),
7474
opaque(opaque) {}
7575
/// Constructs a key for a literal struct.

mlir/lib/Dialect/Shape/IR/Shape.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ void FuncOp::build(OpBuilder &builder, OperationState &state, StringRef name,
12901290
return;
12911291
assert(type.getNumInputs() == argAttrs.size());
12921292
function_interface_impl::addArgAndResultAttrs(
1293-
builder, state, argAttrs, /*resultAttrs=*/std::nullopt,
1293+
builder, state, argAttrs, /*resultAttrs=*/{},
12941294
getArgAttrsAttrName(state.name), getResAttrsAttrName(state.name));
12951295
}
12961296

mlir/lib/IR/Diagnostics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ SourceMgrDiagnosticVerifierHandlerImpl::computeExpectedDiags(
710710
raw_ostream &os, llvm::SourceMgr &mgr, const llvm::MemoryBuffer *buf) {
711711
// If the buffer is invalid, return an empty list.
712712
if (!buf)
713-
return std::nullopt;
713+
return {};
714714
auto &expectedDiags = expectedDiagsPerFile[buf->getBufferIdentifier()];
715715

716716
// The number of the last line that did not correlate to a designator.

mlir/lib/Interfaces/FunctionInterfaces.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ function_interface_impl::getResultAttrDict(FunctionOpInterface op,
4444
ArrayRef<NamedAttribute>
4545
function_interface_impl::getArgAttrs(FunctionOpInterface op, unsigned index) {
4646
auto argDict = getArgAttrDict(op, index);
47-
return argDict ? argDict.getValue() : std::nullopt;
47+
return argDict ? argDict.getValue() : ArrayRef<NamedAttribute>();
4848
}
4949

5050
ArrayRef<NamedAttribute>
5151
function_interface_impl::getResultAttrs(FunctionOpInterface op,
5252
unsigned index) {
5353
auto resultDict = getResultAttrDict(op, index);
54-
return resultDict ? resultDict.getValue() : std::nullopt;
54+
return resultDict ? resultDict.getValue() : ArrayRef<NamedAttribute>();
5555
}
5656

5757
/// Get either the argument or result attributes array.

0 commit comments

Comments
 (0)