[Mlir-commits] [mlir] [MLIR][NFC] Fix build on recent GCC with C++20 enabled (PR #73308)
Alexander Batashev
llvmlistbot at llvm.org
Fri Nov 24 01:53:54 PST 2023
https://github.com/alexbatashev created https://github.com/llvm/llvm-project/pull/73308
The following pattern fails on recent GCC versions with -std=c++20 flag passed and succeeds with -std=c++17. Such behavior is not observed on Clang 16.0.
```
template <typename T>
struct Foo {
Foo<T>(int a) {}
};
```
This patch removes template parameter from constructor in two occurences to make the following command complete successfully:
bazel build -c fastbuild --cxxopt=-std=c++20 --host_cxxopt=-std=c++20 @llvm-project//mlir/...
This patch is similar to https://reviews.llvm.org/D154782
>From 84e1cf498d4c98e26f6cf008cd91a711b3ba601b Mon Sep 17 00:00:00 2001
From: Alexander Batashev <a.batashev at partner.samsung.com>
Date: Fri, 24 Nov 2023 12:50:19 +0300
Subject: [PATCH] [MLIR][NFC] Fix build on recent GCC with C++20 enabled
The following pattern fails on recent GCC versions with -std=c++20 flag passed
and succeeds with -std=c++17. Such behavior is not observed on Clang 16.0.
```
template <typename T>
struct Foo {
Foo<T>(int a) {}
};
```
This patch removes template parameter from constructor in two occurences to
make the following command complete successfully:
bazel build -c fastbuild --cxxopt=-std=c++20 --host_cxxopt=-std=c++20 @llvm-project//mlir/...
This patch is similar to https://reviews.llvm.org/D154782
---
mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp | 6 ++----
mlir/lib/Conversion/MathToLibm/MathToLibm.cpp | 4 ++--
mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp | 4 ++--
mlir/lib/Pass/PassRegistry.cpp | 2 +-
4 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp b/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp
index 3b8338673a5e32e..b3762f0293492ca 100644
--- a/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp
+++ b/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp
@@ -55,10 +55,8 @@ template <typename Op, typename TypeResolver = ComplexTypeResolver>
struct ScalarOpToLibmCall : public OpRewritePattern<Op> {
public:
using OpRewritePattern<Op>::OpRewritePattern;
- ScalarOpToLibmCall<Op, TypeResolver>(MLIRContext *context,
- StringRef floatFunc,
- StringRef doubleFunc,
- PatternBenefit benefit)
+ ScalarOpToLibmCall(MLIRContext *context, StringRef floatFunc,
+ StringRef doubleFunc, PatternBenefit benefit)
: OpRewritePattern<Op>(context, benefit), floatFunc(floatFunc),
doubleFunc(doubleFunc){};
diff --git a/mlir/lib/Conversion/MathToLibm/MathToLibm.cpp b/mlir/lib/Conversion/MathToLibm/MathToLibm.cpp
index 7fd94116ef7a6eb..103c1fb8c3822ec 100644
--- a/mlir/lib/Conversion/MathToLibm/MathToLibm.cpp
+++ b/mlir/lib/Conversion/MathToLibm/MathToLibm.cpp
@@ -50,8 +50,8 @@ template <typename Op>
struct ScalarOpToLibmCall : public OpRewritePattern<Op> {
public:
using OpRewritePattern<Op>::OpRewritePattern;
- ScalarOpToLibmCall<Op>(MLIRContext *context, StringRef floatFunc,
- StringRef doubleFunc)
+ ScalarOpToLibmCall(MLIRContext *context, StringRef floatFunc,
+ StringRef doubleFunc)
: OpRewritePattern<Op>(context), floatFunc(floatFunc),
doubleFunc(doubleFunc){};
diff --git a/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp b/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp
index e749f2bc101297d..febfe97f6c0a997 100644
--- a/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp
+++ b/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp
@@ -96,8 +96,8 @@ Region::iterator getBlockIt(Region ®ion, unsigned index) {
template <typename OpTy>
class SCFToSPIRVPattern : public OpConversionPattern<OpTy> {
public:
- SCFToSPIRVPattern<OpTy>(MLIRContext *context, SPIRVTypeConverter &converter,
- ScfToSPIRVContextImpl *scfToSPIRVContext)
+ SCFToSPIRVPattern(MLIRContext *context, SPIRVTypeConverter &converter,
+ ScfToSPIRVContextImpl *scfToSPIRVContext)
: OpConversionPattern<OpTy>::OpConversionPattern(converter, context),
scfToSPIRVContext(scfToSPIRVContext), typeConverter(converter) {}
diff --git a/mlir/lib/Pass/PassRegistry.cpp b/mlir/lib/Pass/PassRegistry.cpp
index b0c314369190a40..35ac4b8fd280eab 100644
--- a/mlir/lib/Pass/PassRegistry.cpp
+++ b/mlir/lib/Pass/PassRegistry.cpp
@@ -373,7 +373,7 @@ llvm::cl::OptionValue<OpPassManager>::operator=(
return *this;
}
-llvm::cl::OptionValue<OpPassManager>::~OptionValue<OpPassManager>() = default;
+llvm::cl::OptionValue<OpPassManager>::~OptionValue() = default;
void llvm::cl::OptionValue<OpPassManager>::setValue(
const OpPassManager &newValue) {
More information about the Mlir-commits
mailing list