aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Böck <markus.boeck02@gmail.com>2022-08-07 11:16:38 +0200
committerMarkus Böck <markus.boeck02@gmail.com>2022-08-07 11:16:49 +0200
commit26d811b3ecd2fa1ca3d9b41e17fb42b8c7ad03d6 (patch)
treed58eb40549ace0de14290b6f1d581fd838723490
parentf0f1bcadc74fa5cd11a118673340ca3e9a8c0037 (diff)
[mlir] Make use of C++17 language featureslinaro-local/ci/tcwg_kernel/llvm-master-arm-norov-allyesconfig
Now that C++17 is enabled in LLVM, a lot of the TODOs and patterns to emulate C++17 features can be eliminated. The steps I have taken were essentially: ``` git grep C++17 git grep c++17 git grep "initializer_list<int>" ``` and address given comments and patterns. Most of the changes boiled down to just using fold expressions rather than initializer_list. While doing this I also discovered that Clang by default restricts the depth of fold expressions to 256 elements. I specifically hit this with `TestDialect` in `addOperations`. I opted to not replace it with fold expressions because of that but instead adding a comment documenting the issue. If any other functions may be called with more than 256 elements in the future we might have to revert other parts as well. I don't think this is a common occurence besides the `TestDialect` however. If need be, this could potentially be fixed via `mlir-tblgen` in the future. Differential Revision: https://reviews.llvm.org/D131323
-rw-r--r--mlir/examples/standalone/CMakeLists.txt2
-rw-r--r--mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h15
-rw-r--r--mlir/include/mlir/Dialect/Transform/IR/TransformDialect.td7
-rw-r--r--mlir/include/mlir/ExecutionEngine/ExecutionEngine.h4
-rw-r--r--mlir/include/mlir/IR/BuiltinAttributes.h1
-rw-r--r--mlir/include/mlir/IR/BuiltinTypes.td2
-rw-r--r--mlir/include/mlir/IR/Dialect.h11
-rw-r--r--mlir/include/mlir/IR/DialectRegistry.h3
-rw-r--r--mlir/include/mlir/IR/Matchers.h7
-rw-r--r--mlir/include/mlir/IR/OpDefinition.h25
-rw-r--r--mlir/include/mlir/IR/PatternMatch.h56
-rw-r--r--mlir/include/mlir/IR/StorageUniquerSupport.h4
-rw-r--r--mlir/include/mlir/Support/InterfaceSupport.h6
-rw-r--r--mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp5
-rw-r--r--mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp3
-rw-r--r--mlir/lib/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.cpp3
-rw-r--r--mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp3
-rw-r--r--mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp3
-rw-r--r--mlir/lib/IR/BuiltinTypes.cpp3
19 files changed, 55 insertions, 108 deletions
diff --git a/mlir/examples/standalone/CMakeLists.txt b/mlir/examples/standalone/CMakeLists.txt
index e082d817d718..84bce5864189 100644
--- a/mlir/examples/standalone/CMakeLists.txt
+++ b/mlir/examples/standalone/CMakeLists.txt
@@ -3,7 +3,7 @@ project(standalone-dialect LANGUAGES CXX C)
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
-set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to")
+set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to")
find_package(MLIR REQUIRED CONFIG)
diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
index 5d58e44570b8..e39fb696c891 100644
--- a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
+++ b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
@@ -52,10 +52,8 @@ public:
template <typename... DialectTs>
void allowDialect() {
// The following expands a call to allowDialectImpl for each dialect
- // in 'DialectTs'. This magic is necessary due to a limitation in the places
- // that a parameter pack can be expanded in c++11.
- // FIXME: In c++17 this can be simplified by using 'fold expressions'.
- (void)std::initializer_list<int>{0, (allowDialectImpl<DialectTs>(), 0)...};
+ // in 'DialectTs'.
+ (allowDialectImpl<DialectTs>(), ...);
}
/// Deny the given dialects.
@@ -63,8 +61,7 @@ public:
/// This function adds one or multiple DENY entries.
template <typename... DialectTs>
void denyDialect() {
- // FIXME: In c++17 this can be simplified by using 'fold expressions'.
- (void)std::initializer_list<int>{0, (denyDialectImpl<DialectTs>(), 0)...};
+ (denyDialectImpl<DialectTs>(), ...);
}
/// Allow the given dialect.
@@ -82,8 +79,7 @@ public:
/// This function adds one or multiple ALLOW entries.
template <typename... OpTys>
void allowOperation() {
- // FIXME: In c++17 this can be simplified by using 'fold expressions'.
- (void)std::initializer_list<int>{0, (allowOperationImpl<OpTys>(), 0)...};
+ (allowOperationImpl<OpTys>(), ...);
}
/// Deny the given ops.
@@ -91,8 +87,7 @@ public:
/// This function adds one or multiple DENY entries.
template <typename... OpTys>
void denyOperation() {
- // FIXME: In c++17 this can be simplified by using 'fold expressions'.
- (void)std::initializer_list<int>{0, (denyOperationImpl<OpTys>(), 0)...};
+ (denyOperationImpl<OpTys>(), ...);
}
/// Allow the given op.
diff --git a/mlir/include/mlir/Dialect/Transform/IR/TransformDialect.td b/mlir/include/mlir/Dialect/Transform/IR/TransformDialect.td
index f11e3da6f93d..bf1a5224a040 100644
--- a/mlir/include/mlir/Dialect/Transform/IR/TransformDialect.td
+++ b/mlir/include/mlir/Dialect/Transform/IR/TransformDialect.td
@@ -334,13 +334,10 @@ def Transform_Dialect : Dialect {
/// dialect. Checks that they implement the required interfaces.
template <typename... OpTys>
void addOperationsChecked() {
- (void)std::initializer_list<int>{(addOperationIfNotRegistered<OpTys>(),
- 0)...};
+ (addOperationIfNotRegistered<OpTys>(),...);
#ifndef NDEBUG
- (void)std::initializer_list<int>{
- (detail::checkImplementsTransformInterface<OpTys>(getContext()),
- 0)...};
+ (detail::checkImplementsTransformInterface<OpTys>(getContext()),...);
#endif // NDEBUG
}
diff --git a/mlir/include/mlir/ExecutionEngine/ExecutionEngine.h b/mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
index 190b6649a95f..7d4a708b7461 100644
--- a/mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
+++ b/mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
@@ -172,9 +172,7 @@ public:
llvm::SmallVector<void *> argsArray;
// Pack every arguments in an array of pointers. Delegate the packing to a
// trait so that it can be overridden per argument type.
- // TODO: replace with a fold expression when migrating to C++17.
- int dummy[] = {0, ((void)Argument<Args>::pack(argsArray, args), 0)...};
- (void)dummy;
+ (Argument<Args>::pack(argsArray, args), ...);
return invokePacked(adapterName, argsArray);
}
diff --git a/mlir/include/mlir/IR/BuiltinAttributes.h b/mlir/include/mlir/IR/BuiltinAttributes.h
index d73d087597f7..5a11a757f4ec 100644
--- a/mlir/include/mlir/IR/BuiltinAttributes.h
+++ b/mlir/include/mlir/IR/BuiltinAttributes.h
@@ -84,7 +84,6 @@ public:
/// Type trait used to check if the given type T is a potentially valid C++
/// floating point type that can be used to access the underlying element
/// types of a DenseElementsAttr.
- // TODO: Use std::disjunction when C++17 is supported.
template <typename T>
struct is_valid_cpp_fp_type {
/// The type is a valid floating point type if it is a builtin floating
diff --git a/mlir/include/mlir/IR/BuiltinTypes.td b/mlir/include/mlir/IR/BuiltinTypes.td
index 41336b1ea02c..85f6b598c8e7 100644
--- a/mlir/include/mlir/IR/BuiltinTypes.td
+++ b/mlir/include/mlir/IR/BuiltinTypes.td
@@ -262,7 +262,7 @@ def Builtin_Integer : Builtin_Type<"Integer"> {
/// Integer representation maximal bitwidth.
/// Note: This is aligned with the maximum width of llvm::IntegerType.
- static constexpr unsigned kMaxWidth = (1 << 24) - 1;
+ static constexpr inline unsigned kMaxWidth = (1 << 24) - 1;
}];
}
diff --git a/mlir/include/mlir/IR/Dialect.h b/mlir/include/mlir/IR/Dialect.h
index 00dd621e6f54..c3ae2c81b2b1 100644
--- a/mlir/include/mlir/IR/Dialect.h
+++ b/mlir/include/mlir/IR/Dialect.h
@@ -186,8 +186,7 @@ public:
/// Register a set of dialect interfaces with this dialect instance.
template <typename... Args>
void addInterfaces() {
- (void)std::initializer_list<int>{
- 0, (addInterface(std::make_unique<Args>(this)), 0)...};
+ (addInterface(std::make_unique<Args>(this)), ...);
}
template <typename InterfaceT, typename... Args>
InterfaceT &addInterface(Args &&...args) {
@@ -210,6 +209,10 @@ protected:
///
template <typename... Args>
void addOperations() {
+ // This initializer_list argument pack expansion is essentially equal to
+ // using a fold expression with a comma operator. Clang however, refuses
+ // to compile a fold expression with a depth of more than 256 by default.
+ // There seem to be no such limitations for initializer_list.
(void)std::initializer_list<int>{
0, (RegisteredOperationName::insert<Args>(*this), 0)...};
}
@@ -217,7 +220,7 @@ protected:
/// Register a set of type classes with this dialect.
template <typename... Args>
void addTypes() {
- (void)std::initializer_list<int>{0, (addType<Args>(), 0)...};
+ (addType<Args>(), ...);
}
/// Register a type instance with this dialect.
@@ -228,7 +231,7 @@ protected:
/// Register a set of attribute classes with this dialect.
template <typename... Args>
void addAttributes() {
- (void)std::initializer_list<int>{0, (addAttribute<Args>(), 0)...};
+ (addAttribute<Args>(), ...);
}
/// Register an attribute instance with this dialect.
diff --git a/mlir/include/mlir/IR/DialectRegistry.h b/mlir/include/mlir/IR/DialectRegistry.h
index 5e55fab3510e..5d2b1c80d6b4 100644
--- a/mlir/include/mlir/IR/DialectRegistry.h
+++ b/mlir/include/mlir/IR/DialectRegistry.h
@@ -175,8 +175,7 @@ public:
/// Add the given extensions to the registry.
template <typename... ExtensionsT>
void addExtensions() {
- (void)std::initializer_list<int>{
- (addExtension(std::make_unique<ExtensionsT>()), 0)...};
+ (addExtension(std::make_unique<ExtensionsT>()), ...);
}
/// Add an extension function that requires the given dialects.
diff --git a/mlir/include/mlir/IR/Matchers.h b/mlir/include/mlir/IR/Matchers.h
index cc879cfc80dc..fc7619b62065 100644
--- a/mlir/include/mlir/IR/Matchers.h
+++ b/mlir/include/mlir/IR/Matchers.h
@@ -224,10 +224,9 @@ struct PatternMatcherValue {
template <typename TupleT, class CallbackT, std::size_t... Is>
constexpr void enumerateImpl(TupleT &&tuple, CallbackT &&callback,
std::index_sequence<Is...>) {
- (void)std::initializer_list<int>{
- 0,
- (callback(std::integral_constant<std::size_t, Is>{}, std::get<Is>(tuple)),
- 0)...};
+
+ (callback(std::integral_constant<std::size_t, Is>{}, std::get<Is>(tuple)),
+ ...);
}
template <typename... Tys, typename CallbackT>
diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h
index 27148efa0308..a825396d414c 100644
--- a/mlir/include/mlir/IR/OpDefinition.h
+++ b/mlir/include/mlir/IR/OpDefinition.h
@@ -1492,12 +1492,10 @@ using has_fold_trait =
template <typename T>
using detect_has_fold_trait = llvm::is_detected<has_fold_trait, T>;
/// Trait to check if T provides any `foldTrait` method.
-/// NOTE: This should use std::disjunction when C++17 is available.
template <typename T>
using detect_has_any_fold_trait =
- std::conditional_t<bool(detect_has_fold_trait<T>::value),
- detect_has_fold_trait<T>,
- detect_has_single_result_fold_trait<T>>;
+ std::disjunction<detect_has_fold_trait<T>,
+ detect_has_single_result_fold_trait<T>>;
/// Returns the result of folding a trait that implements a `foldTrait` function
/// that is specialized for operations that have a single result.
@@ -1543,10 +1541,7 @@ foldTrait(Operation *, ArrayRef<Attribute>, SmallVectorImpl<OpFoldResult> &) {
template <typename... Ts>
static LogicalResult foldTraits(Operation *op, ArrayRef<Attribute> operands,
SmallVectorImpl<OpFoldResult> &results) {
- bool anyFolded = false;
- (void)std::initializer_list<int>{
- (anyFolded |= succeeded(foldTrait<Ts>(op, operands, results)), 0)...};
- return success(anyFolded);
+ return success((succeeded(foldTrait<Ts>(op, operands, results)) | ...));
}
//===----------------------------------------------------------------------===//
@@ -1581,10 +1576,7 @@ verifyTrait(Operation *) {
/// Given a set of traits, return the result of verifying the given operation.
template <typename... Ts>
LogicalResult verifyTraits(Operation *op) {
- LogicalResult result = success();
- (void)std::initializer_list<int>{
- (result = succeeded(result) ? verifyTrait<Ts>(op) : failure(), 0)...};
- return result;
+ return success((succeeded(verifyTrait<Ts>(op)) && ...));
}
/// Verify the given trait if it provides a region verifier.
@@ -1604,12 +1596,7 @@ verifyRegionTrait(Operation *) {
/// given operation.
template <typename... Ts>
LogicalResult verifyRegionTraits(Operation *op) {
- (void)op;
- LogicalResult result = success();
- (void)std::initializer_list<int>{
- (result = succeeded(result) ? verifyRegionTrait<Ts>(op) : failure(),
- 0)...};
- return result;
+ return success((succeeded(verifyRegionTrait<Ts>(op)) && ...));
}
} // namespace op_definition_impl
@@ -1695,7 +1682,7 @@ public:
llvm::report_fatal_error(
"Attempting to attach an interface to an unregistered operation " +
ConcreteType::getOperationName() + ".");
- (void)std::initializer_list<int>{(checkInterfaceTarget<Models>(), 0)...};
+ (checkInterfaceTarget<Models>(), ...);
info->attachInterface<Models...>();
}
diff --git a/mlir/include/mlir/IR/PatternMatch.h b/mlir/include/mlir/IR/PatternMatch.h
index 12bf196bb58e..200eae8c3b71 100644
--- a/mlir/include/mlir/IR/PatternMatch.h
+++ b/mlir/include/mlir/IR/PatternMatch.h
@@ -1079,15 +1079,10 @@ LogicalResult verifyAsArgs(PatternRewriter &rewriter, ArrayRef<PDLValue> values,
auto errorFn = [&](const Twine &msg) {
return rewriter.notifyMatchFailure(rewriter.getUnknownLoc(), msg);
};
- LogicalResult result = success();
- (void)std::initializer_list<int>{
- (result =
- succeeded(result)
- ? ProcessPDLValue<typename FnTraitsT::template arg_t<I + 1>>::
- verifyAsArg(errorFn, values[I], I)
- : failure(),
- 0)...};
- return result;
+ return success(
+ (succeeded(ProcessPDLValue<typename FnTraitsT::template arg_t<I + 1>>::
+ verifyAsArg(errorFn, values[I], I)) &&
+ ...));
}
/// Assert that the given PDLValues match the constraints defined by the
@@ -1102,10 +1097,10 @@ void assertArgs(PatternRewriter &rewriter, ArrayRef<PDLValue> values,
auto errorFn = [&](const Twine &msg) -> LogicalResult {
llvm::report_fatal_error(msg);
};
- (void)std::initializer_list<int>{
- (assert(succeeded(ProcessPDLValue<typename FnTraitsT::template arg_t<
- I + 1>>::verifyAsArg(errorFn, values[I], I))),
- 0)...};
+ (assert(succeeded(
+ ProcessPDLValue<typename FnTraitsT::template arg_t<I + 1>>::verifyAsArg(
+ errorFn, values[I], I))),
+ ...);
#endif
}
@@ -1134,10 +1129,7 @@ template <typename... Ts>
static void processResults(PatternRewriter &rewriter, PDLResultList &results,
std::tuple<Ts...> &&tuple) {
auto applyFn = [&](auto &&...args) {
- // TODO: Use proper fold expressions when we have C++17. For now we use a
- // bogus std::initializer_list to work around C++14 limitations.
- (void)std::initializer_list<int>{
- (processResults(rewriter, results, std::move(args)), 0)...};
+ (processResults(rewriter, results, std::move(args)), ...);
};
llvm::apply_tuple(applyFn, std::move(tuple));
}
@@ -1412,14 +1404,10 @@ public:
typename = std::enable_if_t<sizeof...(Ts) != 0>>
RewritePatternSet &add(ConstructorArg &&arg, ConstructorArgs &&...args) {
// The following expands a call to emplace_back for each of the pattern
- // types 'Ts'. This magic is necessary due to a limitation in the places
- // that a parameter pack can be expanded in c++11.
- // FIXME: In c++17 this can be simplified by using 'fold expressions'.
- (void)std::initializer_list<int>{
- 0, (addImpl<Ts>(/*debugLabels=*/llvm::None,
- std::forward<ConstructorArg>(arg),
- std::forward<ConstructorArgs>(args)...),
- 0)...};
+ // types 'Ts'.
+ (addImpl<Ts>(/*debugLabels=*/llvm::None, std::forward<ConstructorArg>(arg),
+ std::forward<ConstructorArgs>(args)...),
+ ...);
return *this;
}
/// An overload of the above `add` method that allows for attaching a set
@@ -1433,11 +1421,8 @@ public:
ConstructorArg &&arg,
ConstructorArgs &&...args) {
// The following expands a call to emplace_back for each of the pattern
- // types 'Ts'. This magic is necessary due to a limitation in the places
- // that a parameter pack can be expanded in c++11.
- // FIXME: In c++17 this can be simplified by using 'fold expressions'.
- (void)std::initializer_list<int>{
- 0, (addImpl<Ts>(debugLabels, arg, args...), 0)...};
+ // types 'Ts'.
+ (addImpl<Ts>(debugLabels, arg, args...), ...);
return *this;
}
@@ -1445,7 +1430,7 @@ public:
/// `this` for chaining insertions.
template <typename... Ts>
RewritePatternSet &add() {
- (void)std::initializer_list<int>{0, (addImpl<Ts>(), 0)...};
+ (addImpl<Ts>(), ...);
return *this;
}
@@ -1498,11 +1483,8 @@ public:
typename = std::enable_if_t<sizeof...(Ts) != 0>>
RewritePatternSet &insert(ConstructorArg &&arg, ConstructorArgs &&...args) {
// The following expands a call to emplace_back for each of the pattern
- // types 'Ts'. This magic is necessary due to a limitation in the places
- // that a parameter pack can be expanded in c++11.
- // FIXME: In c++17 this can be simplified by using 'fold expressions'.
- (void)std::initializer_list<int>{
- 0, (addImpl<Ts>(/*debugLabels=*/llvm::None, arg, args...), 0)...};
+ // types 'Ts'.
+ (addImpl<Ts>(/*debugLabels=*/llvm::None, arg, args...), ...);
return *this;
}
@@ -1510,7 +1492,7 @@ public:
/// `this` for chaining insertions.
template <typename... Ts>
RewritePatternSet &insert() {
- (void)std::initializer_list<int>{0, (addImpl<Ts>(), 0)...};
+ (addImpl<Ts>(), ...);
return *this;
}
diff --git a/mlir/include/mlir/IR/StorageUniquerSupport.h b/mlir/include/mlir/IR/StorageUniquerSupport.h
index 7e17ba4fd7cd..074764caf33b 100644
--- a/mlir/include/mlir/IR/StorageUniquerSupport.h
+++ b/mlir/include/mlir/IR/StorageUniquerSupport.h
@@ -138,8 +138,8 @@ public:
if (!abstract)
llvm::report_fatal_error("Registering an interface for an attribute/type "
"that is not itself registered.");
- (void)std::initializer_list<int>{
- (checkInterfaceTarget<IfaceModels>(), 0)...};
+
+ (checkInterfaceTarget<IfaceModels>(), ...);
abstract->interfaceMap.template insert<IfaceModels...>();
}
diff --git a/mlir/include/mlir/Support/InterfaceSupport.h b/mlir/include/mlir/Support/InterfaceSupport.h
index 53ace04453ac..5a56682f3bc0 100644
--- a/mlir/include/mlir/Support/InterfaceSupport.h
+++ b/mlir/include/mlir/Support/InterfaceSupport.h
@@ -191,16 +191,14 @@ public:
/// do not represent interfaces are not added to the interface map.
template <typename... Types>
static InterfaceMap get() {
- // TODO: Use constexpr if here in C++17.
constexpr size_t numInterfaces = num_interface_types_t<Types...>::value;
- if (numInterfaces == 0)
+ if constexpr (numInterfaces == 0)
return InterfaceMap();
std::array<std::pair<TypeID, void *>, numInterfaces> elements;
std::pair<TypeID, void *> *elementIt = elements.data();
(void)elementIt;
- (void)std::initializer_list<int>{
- 0, (addModelAndUpdateIterator<Types>(elementIt), 0)...};
+ (addModelAndUpdateIterator<Types>(elementIt), ...);
return InterfaceMap(elements);
}
diff --git a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
index 18747df79e47..e3e32fa590b5 100644
--- a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
+++ b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
@@ -178,15 +178,12 @@ struct AlignedAllocOpLowering : public AllocLikeOpLLVMLowering {
}
/// The minimum alignment to use with aligned_alloc (has to be a power of 2).
- static constexpr uint64_t kMinAlignedAllocAlignment = 16UL;
+ static inline constexpr uint64_t kMinAlignedAllocAlignment = 16UL;
/// Default layout to use in absence of the corresponding analysis.
DataLayout defaultLayout;
};
-// Out of line definition, required till C++17.
-constexpr uint64_t AlignedAllocOpLowering::kMinAlignedAllocAlignment;
-
struct AllocaOpLowering : public AllocLikeOpLLVMLowering {
AllocaOpLowering(LLVMTypeConverter &converter)
: AllocLikeOpLLVMLowering(memref::AllocaOp::getOperationName(),
diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
index 6d30f049d3d3..6865b68c1a77 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
@@ -96,8 +96,7 @@ void addNamedOpBuilderImpl(
template <typename... OpTypes>
void addNamedOpBuilders(
llvm::StringMap<LinalgDialect::RegionBuilderFunType> &map) {
- (void)std::initializer_list<int>{0,
- (addNamedOpBuilderImpl<OpTypes>(map), 0)...};
+ (addNamedOpBuilderImpl<OpTypes>(map), ...);
}
void mlir::linalg::LinalgDialect::initialize() {
diff --git a/mlir/lib/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.cpp
index a904d7c2e1d6..fce193eaf7c9 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.cpp
@@ -137,8 +137,7 @@ struct LinalgOpInterface
template <typename... Ops>
struct LinalgOpInterfaceHelper {
static void registerOpInterface(MLIRContext *ctx) {
- (void)std::initializer_list<int>{
- 0, (Ops::template attachInterface<LinalgOpInterface<Ops>>(*ctx), 0)...};
+ (Ops::template attachInterface<LinalgOpInterface<Ops>>(*ctx), ...);
}
};
} // namespace
diff --git a/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp b/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
index 9b4bd8685bbb..58323db48bed 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
@@ -263,8 +263,7 @@ static void registerOne(MLIRContext *ctx) {
/// Variadic helper function.
template <typename... OpTypes>
static void registerAll(MLIRContext *ctx) {
- // FIXME: In c++17 this can be simplified by using 'fold expressions'.
- (void)std::initializer_list<int>{0, (registerOne<OpTypes>(ctx), 0)...};
+ (registerOne<OpTypes>(ctx), ...);
}
#define GET_OP_LIST
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp
index 7814b91dd6f3..aed8ff5302e5 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp
@@ -23,8 +23,7 @@ namespace {
template <typename... Args>
void addOpsCanonicalizations(MLIRContext *ctx, RewritePatternSet &patterns) {
- (void)std::initializer_list<int>{
- 0, (Args::getCanonicalizationPatterns(patterns, ctx), 0)...};
+ (Args::getCanonicalizationPatterns(patterns, ctx), ...);
}
void populateTosaOpsCanonicalizationPatterns(MLIRContext *ctx,
diff --git a/mlir/lib/IR/BuiltinTypes.cpp b/mlir/lib/IR/BuiltinTypes.cpp
index bffd4188929c..d122d9c974f8 100644
--- a/mlir/lib/IR/BuiltinTypes.cpp
+++ b/mlir/lib/IR/BuiltinTypes.cpp
@@ -60,9 +60,6 @@ LogicalResult ComplexType::verify(function_ref<InFlightDiagnostic()> emitError,
// Integer Type
//===----------------------------------------------------------------------===//
-// static constexpr must have a definition (until in C++17 and inline variable).
-constexpr unsigned IntegerType::kMaxWidth;
-
/// Verify the construction of an integer type.
LogicalResult IntegerType::verify(function_ref<InFlightDiagnostic()> emitError,
unsigned width,