-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[mlir] Use {} instead of std::nullopt to initialize empty ArrayRef #109527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-mlir-tosa @llvm/pr-subscribers-mlir-llvm Author: Jay Foad (jayfoad) ChangesFollow up to #109133. Patch is 40.64 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/109527.diff 43 Files Affected:
diff --git a/mlir/include/mlir/AsmParser/AsmParserState.h b/mlir/include/mlir/AsmParser/AsmParserState.h
index 98bdc4696b846b..e47cb32ee4027f 100644
--- a/mlir/include/mlir/AsmParser/AsmParserState.h
+++ b/mlir/include/mlir/AsmParser/AsmParserState.h
@@ -195,7 +195,7 @@ class AsmParserState {
/// Finalize the most recently started operation definition.
void finalizeOperationDefinition(
Operation *op, SMRange nameLoc, SMLoc endLoc,
- ArrayRef<std::pair<unsigned, SMLoc>> resultGroups = std::nullopt);
+ ArrayRef<std::pair<unsigned, SMLoc>> resultGroups = {});
/// Start a definition for a region nested under the current operation.
void startRegionDefinition();
diff --git a/mlir/include/mlir/CAPI/Wrap.h b/mlir/include/mlir/CAPI/Wrap.h
index 5b68f417a3df4e..fd5b6e18d49520 100644
--- a/mlir/include/mlir/CAPI/Wrap.h
+++ b/mlir/include/mlir/CAPI/Wrap.h
@@ -44,7 +44,7 @@ static llvm::ArrayRef<CppTy> unwrapList(size_t size, CTy *first,
"incompatible C and C++ types");
if (size == 0)
- return std::nullopt;
+ return {};
assert(storage.empty() && "expected to populate storage");
storage.reserve(size);
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index 8584a25f8b3d6c..18dbdba746269e 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -371,7 +371,7 @@ def LLVM_LoadOp : LLVM_MemAccessOpBase<"load",
auto *inst = builder.CreateLoad($_resultType, $addr, $volatile_);
$res = inst;
if ($invariant) {
- llvm::MDNode *metadata = llvm::MDNode::get(inst->getContext(), std::nullopt);
+ llvm::MDNode *metadata = llvm::MDNode::get(inst->getContext(), {});
inst->setMetadata(llvm::LLVMContext::MD_invariant_load, metadata);
}
}] # setOrderingCode
diff --git a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
index 1e108c3d8ac77a..22d905ebb0a406 100644
--- a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
+++ b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
@@ -363,7 +363,7 @@ def PDL_OperationOp : PDL_Op<"operation", [AttrSizedOperandSegments]> {
let builders = [
OpBuilder<(ins CArg<"std::optional<StringRef>", "std::nullopt">:$name,
CArg<"ValueRange", "std::nullopt">:$operandValues,
- CArg<"ArrayRef<StringRef>", "std::nullopt">:$attrNames,
+ CArg<"ArrayRef<StringRef>", "{}">:$attrNames,
CArg<"ValueRange", "std::nullopt">:$attrValues,
CArg<"ValueRange", "std::nullopt">:$resultTypes), [{
auto nameAttr = name ? $_builder.getStringAttr(*name) : StringAttr();
diff --git a/mlir/include/mlir/ExecutionEngine/ExecutionEngine.h b/mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
index 66f49c787c1905..96ccebcd5685eb 100644
--- a/mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
+++ b/mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
@@ -157,8 +157,7 @@ class ExecutionEngine {
/// Invokes the function with the given name passing it the list of opaque
/// pointers to the actual arguments.
- llvm::Error invokePacked(StringRef name,
- MutableArrayRef<void *> args = std::nullopt);
+ llvm::Error invokePacked(StringRef name, MutableArrayRef<void *> args = {});
/// Trait that defines how a given type is passed to the JIT code. This
/// defaults to passing the address but can be specialized.
diff --git a/mlir/include/mlir/IR/BlockSupport.h b/mlir/include/mlir/IR/BlockSupport.h
index ff508891ac2ffc..c8a70a5a1d9593 100644
--- a/mlir/include/mlir/IR/BlockSupport.h
+++ b/mlir/include/mlir/IR/BlockSupport.h
@@ -106,7 +106,7 @@ class BlockRange final
Block *, Block *, Block *> {
public:
using RangeBaseT::RangeBaseT;
- BlockRange(ArrayRef<Block *> blocks = std::nullopt);
+ BlockRange(ArrayRef<Block *> blocks = {});
BlockRange(SuccessorRange successors);
template <typename Arg, typename = std::enable_if_t<std::is_constructible<
ArrayRef<Block *>, Arg>::value>>
diff --git a/mlir/include/mlir/IR/Builders.h b/mlir/include/mlir/IR/Builders.h
index 196d34e12d9b28..c2bfe84d5093fa 100644
--- a/mlir/include/mlir/IR/Builders.h
+++ b/mlir/include/mlir/IR/Builders.h
@@ -463,14 +463,14 @@ class OpBuilder : public Builder {
/// should match the size of `argTypes`.
Block *createBlock(Region *parent, Region::iterator insertPt = {},
TypeRange argTypes = std::nullopt,
- ArrayRef<Location> locs = std::nullopt);
+ ArrayRef<Location> locs = {});
/// Add new block with 'argTypes' arguments and set the insertion point to the
/// end of it. The block is placed before 'insertBefore'. `locs` contains the
/// locations of the inserted arguments, and should match the size of
/// `argTypes`.
Block *createBlock(Block *insertBefore, TypeRange argTypes = std::nullopt,
- ArrayRef<Location> locs = std::nullopt);
+ ArrayRef<Location> locs = {});
//===--------------------------------------------------------------------===//
// Operation Creation
diff --git a/mlir/include/mlir/IR/BuiltinAttributes.td b/mlir/include/mlir/IR/BuiltinAttributes.td
index f0d41754001400..9aa46b978cb03e 100644
--- a/mlir/include/mlir/IR/BuiltinAttributes.td
+++ b/mlir/include/mlir/IR/BuiltinAttributes.td
@@ -516,7 +516,7 @@ def Builtin_DictionaryAttr : Builtin_Attr<"Dictionary", "dictionary"> {
}];
let parameters = (ins ArrayRefParameter<"NamedAttribute", "">:$value);
let builders = [
- AttrBuilder<(ins CArg<"ArrayRef<NamedAttribute>", "std::nullopt">:$value)>
+ AttrBuilder<(ins CArg<"ArrayRef<NamedAttribute>", "{}">:$value)>
];
let extraClassDeclaration = [{
using ValueType = ArrayRef<NamedAttribute>;
diff --git a/mlir/include/mlir/IR/BuiltinTypes.td b/mlir/include/mlir/IR/BuiltinTypes.td
index c283c20f36e91e..40894236d3242d 100644
--- a/mlir/include/mlir/IR/BuiltinTypes.td
+++ b/mlir/include/mlir/IR/BuiltinTypes.td
@@ -1070,7 +1070,7 @@ def Builtin_UnrankedMemRef : Builtin_Type<"UnrankedMemRef", "unranked_memref", [
using ShapedType::Trait<UnrankedMemRefType>::getDimSize;
using ShapedType::Trait<UnrankedMemRefType>::getDynamicDimIndex;
- ArrayRef<int64_t> getShape() const { return std::nullopt; }
+ ArrayRef<int64_t> getShape() const { return {}; }
/// [deprecated] Returns the memory space in old raw integer representation.
/// New `Attribute getMemorySpace()` method should be used instead.
@@ -1129,7 +1129,7 @@ def Builtin_UnrankedTensor : Builtin_Type<"UnrankedTensor", "unranked_tensor", [
using ShapedType::Trait<UnrankedTensorType>::getDimSize;
using ShapedType::Trait<UnrankedTensorType>::getDynamicDimIndex;
- ArrayRef<int64_t> getShape() const { return std::nullopt; }
+ ArrayRef<int64_t> getShape() const { return {}; }
}];
let skipDefaultBuilders = 1;
let genVerifyDecl = 1;
diff --git a/mlir/include/mlir/IR/Matchers.h b/mlir/include/mlir/IR/Matchers.h
index 6fa5a47109d20d..41a8ce2d58cb9a 100644
--- a/mlir/include/mlir/IR/Matchers.h
+++ b/mlir/include/mlir/IR/Matchers.h
@@ -88,7 +88,7 @@ struct constant_op_binder {
// Fold the constant to an attribute.
SmallVector<OpFoldResult, 1> foldedOp;
- LogicalResult result = op->fold(/*operands=*/std::nullopt, foldedOp);
+ LogicalResult result = op->fold(/*operands=*/{}, foldedOp);
(void)result;
assert(succeeded(result) && "expected ConstantLike op to be foldable");
diff --git a/mlir/include/mlir/IR/PatternMatch.h b/mlir/include/mlir/IR/PatternMatch.h
index 896fdf1c899e3d..93ca1d9d5aa3c4 100644
--- a/mlir/include/mlir/IR/PatternMatch.h
+++ b/mlir/include/mlir/IR/PatternMatch.h
@@ -847,8 +847,7 @@ class RewritePatternSet {
RewritePatternSet &add(ConstructorArg &&arg, ConstructorArgs &&...args) {
// The following expands a call to emplace_back for each of the pattern
// types 'Ts'.
- (addImpl<Ts>(/*debugLabels=*/std::nullopt,
- std::forward<ConstructorArg>(arg),
+ (addImpl<Ts>(/*debugLabels=*/{}, std::forward<ConstructorArg>(arg),
std::forward<ConstructorArgs>(args)...),
...);
return *this;
@@ -931,7 +930,7 @@ class RewritePatternSet {
RewritePatternSet &insert(ConstructorArg &&arg, ConstructorArgs &&...args) {
// The following expands a call to emplace_back for each of the pattern
// types 'Ts'.
- (addImpl<Ts>(/*debugLabels=*/std::nullopt, arg, args...), ...);
+ (addImpl<Ts>(/*debugLabels=*/{}, arg, args...), ...);
return *this;
}
diff --git a/mlir/include/mlir/IR/Region.h b/mlir/include/mlir/IR/Region.h
index 93fc9dbb430eec..cfcd920b33460e 100644
--- a/mlir/include/mlir/IR/Region.h
+++ b/mlir/include/mlir/IR/Region.h
@@ -353,7 +353,7 @@ class RegionRange
public:
using RangeBaseT::RangeBaseT;
- RegionRange(MutableArrayRef<Region> regions = std::nullopt);
+ RegionRange(MutableArrayRef<Region> regions = {});
template <typename Arg, typename = std::enable_if_t<std::is_constructible<
ArrayRef<std::unique_ptr<Region>>, Arg>::value>>
diff --git a/mlir/include/mlir/IR/SymbolTable.h b/mlir/include/mlir/IR/SymbolTable.h
index 597c6a9a1d8910..b3953cdf42bdf7 100644
--- a/mlir/include/mlir/IR/SymbolTable.h
+++ b/mlir/include/mlir/IR/SymbolTable.h
@@ -395,7 +395,8 @@ class SymbolUserMap {
/// Return the users of the provided symbol operation.
ArrayRef<Operation *> getUsers(Operation *symbol) const {
auto it = symbolToUsers.find(symbol);
- return it != symbolToUsers.end() ? it->second.getArrayRef() : std::nullopt;
+ return it != symbolToUsers.end() ? it->second.getArrayRef()
+ : ArrayRef<Operation *>();
}
/// Return true if the given symbol has no uses.
diff --git a/mlir/include/mlir/IR/TypeRange.h b/mlir/include/mlir/IR/TypeRange.h
index 99fabab334f922..67897c2c3db8f6 100644
--- a/mlir/include/mlir/IR/TypeRange.h
+++ b/mlir/include/mlir/IR/TypeRange.h
@@ -36,7 +36,7 @@ class TypeRange : public llvm::detail::indexed_accessor_range_base<
Type, Type, Type> {
public:
using RangeBaseT::RangeBaseT;
- TypeRange(ArrayRef<Type> types = std::nullopt);
+ TypeRange(ArrayRef<Type> types = {});
explicit TypeRange(OperandRange values);
explicit TypeRange(ResultRange values);
explicit TypeRange(ValueRange values);
@@ -47,6 +47,7 @@ class TypeRange : public llvm::detail::indexed_accessor_range_base<
template <typename Arg, typename = std::enable_if_t<std::is_constructible<
ArrayRef<Type>, Arg>::value>>
TypeRange(Arg &&arg) : TypeRange(ArrayRef<Type>(std::forward<Arg>(arg))) {}
+ TypeRange(std::nullopt_t) : TypeRange(ArrayRef<Type>()) {}
TypeRange(std::initializer_list<Type> types)
: TypeRange(ArrayRef<Type>(types)) {}
diff --git a/mlir/include/mlir/IR/ValueRange.h b/mlir/include/mlir/IR/ValueRange.h
index 4b421c08d8418e..b934622fa80c1d 100644
--- a/mlir/include/mlir/IR/ValueRange.h
+++ b/mlir/include/mlir/IR/ValueRange.h
@@ -123,7 +123,7 @@ class MutableOperandRange {
/// and range length. `operandSegments` is an optional set of operand segments
/// to be updated when mutating the operand list.
MutableOperandRange(Operation *owner, unsigned start, unsigned length,
- ArrayRef<OperandSegment> operandSegments = std::nullopt);
+ ArrayRef<OperandSegment> operandSegments = {});
MutableOperandRange(Operation *owner);
/// Construct a new mutable range for the given OpOperand.
@@ -392,6 +392,7 @@ class ValueRange final
std::is_constructible<ArrayRef<Value>, Arg>::value &&
!std::is_convertible<Arg, Value>::value>>
ValueRange(Arg &&arg) : ValueRange(ArrayRef<Value>(std::forward<Arg>(arg))) {}
+ ValueRange(std::nullopt_t) : ValueRange(ArrayRef<Value>()) {}
ValueRange(const Value &value) : ValueRange(&value, /*count=*/1) {}
ValueRange(const std::initializer_list<Value> &values)
: ValueRange(ArrayRef<Value>(values)) {}
@@ -401,7 +402,7 @@ class ValueRange final
: ValueRange(ResultRange(values)) {}
ValueRange(ArrayRef<BlockArgument> values)
: ValueRange(ArrayRef<Value>(values.data(), values.size())) {}
- ValueRange(ArrayRef<Value> values = std::nullopt);
+ ValueRange(ArrayRef<Value> values = {});
ValueRange(OperandRange values);
ValueRange(ResultRange values);
diff --git a/mlir/include/mlir/Rewrite/FrozenRewritePatternSet.h b/mlir/include/mlir/Rewrite/FrozenRewritePatternSet.h
index 4c6e3cd9ce6f4c..d6c431206e06ee 100644
--- a/mlir/include/mlir/Rewrite/FrozenRewritePatternSet.h
+++ b/mlir/include/mlir/Rewrite/FrozenRewritePatternSet.h
@@ -47,10 +47,9 @@ class FrozenRewritePatternSet {
/// `RewritePatternSet::addWithLabel`. Debug names may be empty, but patterns
/// created with `RewritePattern::create` have their default debug name set to
/// their type name.
- FrozenRewritePatternSet(
- RewritePatternSet &&patterns,
- ArrayRef<std::string> disabledPatternLabels = std::nullopt,
- ArrayRef<std::string> enabledPatternLabels = std::nullopt);
+ FrozenRewritePatternSet(RewritePatternSet &&patterns,
+ ArrayRef<std::string> disabledPatternLabels = {},
+ ArrayRef<std::string> enabledPatternLabels = {});
/// Return the op specific native patterns held by this list.
const OpSpecificNativePatternListT &getOpSpecificNativePatterns() const {
diff --git a/mlir/include/mlir/Support/StorageUniquer.h b/mlir/include/mlir/Support/StorageUniquer.h
index 26bdf09abba21c..1a89081074ec12 100644
--- a/mlir/include/mlir/Support/StorageUniquer.h
+++ b/mlir/include/mlir/Support/StorageUniquer.h
@@ -97,7 +97,7 @@ class StorageUniquer {
template <typename T>
ArrayRef<T> copyInto(ArrayRef<T> elements) {
if (elements.empty())
- return std::nullopt;
+ return {};
auto result = allocator.Allocate<T>(elements.size());
std::uninitialized_copy(elements.begin(), elements.end(), result);
return ArrayRef<T>(result, elements.size());
diff --git a/mlir/include/mlir/Tools/PDLL/AST/Nodes.h b/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
index aed2562e4d30dd..7a9e5048aebe78 100644
--- a/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
+++ b/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
@@ -897,8 +897,8 @@ class UserConstraintDecl final
ArrayRef<VariableDecl *> results,
const CompoundStmt *body,
Type resultType) {
- return createImpl(ctx, name, inputs, /*nativeInputTypes=*/std::nullopt,
- results, /*codeBlock=*/std::nullopt, body, resultType);
+ return createImpl(ctx, name, inputs, /*nativeInputTypes=*/{}, results,
+ /*codeBlock=*/std::nullopt, body, resultType);
}
/// Return the name of the constraint.
diff --git a/mlir/include/mlir/Tools/PDLL/AST/Types.h b/mlir/include/mlir/Tools/PDLL/AST/Types.h
index 89c8e193ddc32b..aa483a81f87f58 100644
--- a/mlir/include/mlir/Tools/PDLL/AST/Types.h
+++ b/mlir/include/mlir/Tools/PDLL/AST/Types.h
@@ -253,8 +253,7 @@ class TupleType : public Type::TypeBase<detail::TupleTypeStorage> {
/// Return an instance of the Tuple type.
static TupleType get(Context &context, ArrayRef<Type> elementTypes,
ArrayRef<StringRef> elementNames);
- static TupleType get(Context &context,
- ArrayRef<Type> elementTypes = std::nullopt);
+ static TupleType get(Context &context, ArrayRef<Type> elementTypes = {});
/// Return the element types of this tuple.
ArrayRef<Type> getElementTypes() const;
diff --git a/mlir/include/mlir/Transforms/Passes.h b/mlir/include/mlir/Transforms/Passes.h
index 8e4a43c3f24586..b0afc7b16fc41f 100644
--- a/mlir/include/mlir/Transforms/Passes.h
+++ b/mlir/include/mlir/Transforms/Passes.h
@@ -61,8 +61,8 @@ std::unique_ptr<Pass> createCanonicalizerPass();
/// set to their type name.
std::unique_ptr<Pass>
createCanonicalizerPass(const GreedyRewriteConfig &config,
- ArrayRef<std::string> disabledPatterns = std::nullopt,
- ArrayRef<std::string> enabledPatterns = std::nullopt);
+ ArrayRef<std::string> disabledPatterns = {},
+ ArrayRef<std::string> enabledPatterns = {});
/// Creates a pass to perform control-flow sinking.
std::unique_ptr<Pass> createControlFlowSinkPass();
diff --git a/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp b/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
index b00cd0dee3ae80..cb10671ac5b798 100644
--- a/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
+++ b/mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
@@ -991,7 +991,7 @@ void PDLToPDLInterpPass::runOnOperation() {
module.getLoc(), pdl_interp::PDLInterpDialect::getMatcherFunctionName(),
builder.getFunctionType(builder.getType<pdl::OperationType>(),
/*results=*/std::nullopt),
- /*attrs=*/std::nullopt);
+ /*attrs=*/ArrayRef<NamedAttribute>());
// Create a nested module to hold the functions invoked for rewriting the IR
// after a successful match.
diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
index 93e284af051883..ca4abe09f8d952 100644
--- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
+++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
@@ -249,8 +249,8 @@ static Value createLinalgBodyCalculationForElementwiseOp(
auto shifted =
rewriter.create<arith::ShRSIOp>(loc, resultTypes, args[0], subtract)
->getResults();
- auto truncated =
- rewriter.create<arith::TruncIOp>(loc, i1Ty, shifted, std::nullopt);
+ auto truncated = rewriter.create<arith::TruncIOp>(
+ loc, i1Ty, shifted, llvm::ArrayRef<NamedAttribute>());
auto isInputOdd =
rewriter.create<arith::AndIOp>(loc, i1Ty, truncated, i1one);
@@ -453,20 +453,20 @@ static Value createLinalgBodyCalculationForElementwiseOp(
if (isa<FloatType>(srcTy) && isa<FloatType>(dstTy) && bitExtend)
return rewriter.create<arith::ExtFOp>(loc, resultTypes, args,
- std::nullopt);
+ llvm::ArrayRef<NamedAttribute>());
if (isa<FloatType>(srcTy) && isa<FloatType>(dstTy) && !bitExtend)
return rewriter.create<arith::TruncFOp>(loc, resultTypes, args,
- std::nullopt);
+ llvm::ArrayRef<NamedAttribute>());
// 1-bit integers need to be treated as signless.
if (srcTy.isInteger(1) && arith::UIToFPOp::areCastCompatible(srcTy, dstTy))
return rewriter.create<arith::UIToFPOp>(loc, resultTypes, args,
- std::nullopt);
+ llvm::ArrayRef<NamedAttribute>());
if (srcTy.isInteger(1) && isa<IntegerType>(dstTy) && bitExtend)
return rewriter.create<arith::ExtUIOp>(loc, resultTypes, args,
- std::nullopt);
+ llvm::ArrayRef<NamedAttribute>());
// Unsigned integers need an unrealized cast so that they can be passed
// to UIToFP.
@@ -484,7 +484,7 @@ static Value createLinalgBodyCalculationForElementwiseOp(
// All other si-to-fp conversions should be handled by SIToFP.
if (arith::SIToFPOp::areCastCompatible(srcTy, dstTy))
return rewriter.create<arith::SIToFPOp>(loc, resultTypes, args,
- std::nullopt);
+ llvm::ArrayRef<NamedAttribute>());
// Casting to boolean, floats need to only be checked as not-equal to zero.
if (isa<FloatType>(srcTy) && dstTy.isInteger(1)) {
@@ -590,7 +590,7 @@ static Value createLinalgBodyCalculationForElementwiseOp(
if (isa<IntegerType>(srcTy) && isa<IntegerType>(dstTy) && bitExtend)
return rewriter.create<arith::ExtSIOp>(loc, resultTypes, args,
- std::nullopt);
+ llvm::ArrayRef<NamedAt...
[truncated]
|
@@ -47,6 +47,7 @@ class TypeRange : public llvm::detail::indexed_accessor_range_base< | |||
template <typename Arg, typename = std::enable_if_t<std::is_constructible< | |||
ArrayRef<Type>, Arg>::value>> | |||
TypeRange(Arg &&arg) : TypeRange(ArrayRef<Type>(std::forward<Arg>(arg))) {} | |||
TypeRange(std::nullopt_t) : TypeRange(ArrayRef<Type>()) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For TypeRange
and ValueRange
I opted to allow clients to continue to pass in std::nullopt
to get an empty range, to avoid chasing too far down the rabbit hole.
auto truncated = | ||
rewriter.create<arith::TruncIOp>(loc, i1Ty, shifted, std::nullopt); | ||
auto truncated = rewriter.create<arith::TruncIOp>( | ||
loc, i1Ty, shifted, llvm::ArrayRef<NamedAttribute>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, you can't use {}
in calls to create<>
because the arguments get passed on with std::forward
which does not work with initializer lists - but I'm not an expert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
While I do support replacing |
While the change to a longer fully qualified name is unfortunate, I think there is another aspect in this migration away from |
I do not want to block anyone, but I'm still not sure if sacrificing convenience for ideological purity is good tradeoff here. |
Follow up to #109133.