Skip to content

Commit 1f1167d

Browse files
authored
[StableHLO] Fix ArrayRef(std::nullopt) deprecation warnings (iree-org#21257)
1 parent e43555e commit 1f1167d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

compiler/plugins/input/StableHLO/Conversion/MapStableHLOToScalarOp.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ struct MapStableHloOpToScalarOpImpl<StdScalarOp> {
197197
Value operator()(Location loc, ArrayRef<Type> resultTypes,
198198
ArrayRef<Type> /*argTypes*/, ValueRange args, OpBuilder *b) {
199199
return b->template create<StdScalarOp>(loc, resultTypes, args,
200-
std::nullopt);
200+
ArrayRef<NamedAttribute>{});
201201
}
202202
};
203203

@@ -208,7 +208,7 @@ struct MapStableHloOpToScalarOpImpl<SupportedType, StdScalarOp, Args...> {
208208
Type elementType = getElementTypeOrSelf(argTypes.front());
209209
if (SupportedType{}(elementType)) {
210210
return b->template create<StdScalarOp>(loc, resultTypes, args,
211-
std::nullopt);
211+
ArrayRef<NamedAttribute>{});
212212
}
213213
return MapStableHloOpToScalarOpImpl<Args...>{}(loc, resultTypes, argTypes,
214214
args, b);
@@ -683,22 +683,22 @@ inline Value mapConvertOpToStdScalarOp(Location loc, ArrayRef<Type> targetTypes,
683683
mlir::arith::UIToFPOp::areCastCompatible(convertedSourceType,
684684
targetType)) {
685685
return b->create<mlir::arith::UIToFPOp>(loc, resultTypes, args,
686-
std::nullopt);
686+
ArrayRef<NamedAttribute>{});
687687
}
688688
if (mlir::arith::SIToFPOp::areCastCompatible(sourceType, targetType)) {
689689
return b->create<mlir::arith::SIToFPOp>(loc, resultTypes, args,
690-
std::nullopt);
690+
ArrayRef<NamedAttribute>{});
691691
}
692692
if (isa<FloatType>(sourceType) && isa<FloatType>(targetType)) {
693693
auto src = cast<FloatType>(sourceType);
694694
auto res = cast<FloatType>(targetType);
695695
if (src.getWidth() > res.getWidth()) {
696696
return b->create<mlir::arith::TruncFOp>(loc, resultTypes, args,
697-
std::nullopt);
697+
ArrayRef<NamedAttribute>{});
698698
}
699699
if (src.getWidth() < res.getWidth()) {
700700
return b->create<mlir::arith::ExtFOp>(loc, resultTypes, args,
701-
std::nullopt);
701+
ArrayRef<NamedAttribute>{});
702702
}
703703
// There's no direct conversion between different 16 bit floating point
704704
// types, so go through 32 bit float.
@@ -731,16 +731,16 @@ inline Value mapConvertOpToStdScalarOp(Location loc, ArrayRef<Type> targetTypes,
731731
auto res = cast<IntegerType>(targetType);
732732
if (src.getWidth() > res.getWidth()) {
733733
return b->create<mlir::arith::TruncIOp>(loc, resultTypes, args,
734-
std::nullopt);
734+
ArrayRef<NamedAttribute>{});
735735
}
736736
if (src.getWidth() < res.getWidth()) {
737737
// Special case boolean values, so they get casted to `1` instead of `-1`.
738738
if (IsUnsignedIntegerType{}(src)) {
739739
return b->create<mlir::arith::ExtUIOp>(loc, resultTypes, args,
740-
std::nullopt);
740+
ArrayRef<NamedAttribute>{});
741741
}
742742
return b->create<mlir::arith::ExtSIOp>(loc, resultTypes, args,
743-
std::nullopt);
743+
ArrayRef<NamedAttribute>{});
744744
}
745745
// No conversion is needed for the same width integers
746746
return args.front();
@@ -749,12 +749,12 @@ inline Value mapConvertOpToStdScalarOp(Location loc, ArrayRef<Type> targetTypes,
749749
mlir::arith::FPToUIOp::areCastCompatible(convertedSourceType,
750750
targetType)) {
751751
return b->create<mlir::arith::FPToUIOp>(loc, resultTypes, args,
752-
std::nullopt);
752+
ArrayRef<NamedAttribute>{});
753753
}
754754
if (mlir::arith::FPToSIOp::areCastCompatible(convertedSourceType,
755755
targetType)) {
756756
return b->create<mlir::arith::FPToSIOp>(loc, resultTypes, args,
757-
std::nullopt);
757+
ArrayRef<NamedAttribute>{});
758758
}
759759
if (isa<ComplexType>(targetType)) {
760760
Type targetElementType = cast<ComplexType>(targetType).getElementType();

0 commit comments

Comments
 (0)