From 1461bd13c91b78cc20b097e3dd9231f52f96ece0 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Mon, 3 Jan 2022 06:31:44 +0000 Subject: [PATCH] Revert "Define a `cppAccessorType` to const-ref in APFloatParameter and update ODS emitter to use it for verifier signatures" This reverts commit 89af17c0c74eb9d8d11870f6510e475eff74eef4. This broke the gcc5 build. --- mlir/include/mlir/IR/OpBase.td | 1 - mlir/lib/IR/BuiltinAttributes.cpp | 2 +- mlir/test/lib/Dialect/Test/TestAttributes.cpp | 2 +- mlir/test/mlir-tblgen/attrdefs.td | 8 ++++---- mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td index e46b8fb35ec7..f1a5446ad1f9 100644 --- a/mlir/include/mlir/IR/OpBase.td +++ b/mlir/include/mlir/IR/OpBase.td @@ -3135,7 +3135,6 @@ class StringRefParameter : class APFloatParameter : AttrOrTypeParameter<"::llvm::APFloat", desc> { let comparator = "$_lhs.bitwiseIsEqual($_rhs)"; - let cppAccessorType = "const ::llvm::APFloat &"; } // For standard ArrayRefs, which require allocation. diff --git a/mlir/lib/IR/BuiltinAttributes.cpp b/mlir/lib/IR/BuiltinAttributes.cpp index 2a34ed34e7d1..802df2dada9d 100644 --- a/mlir/lib/IR/BuiltinAttributes.cpp +++ b/mlir/lib/IR/BuiltinAttributes.cpp @@ -283,7 +283,7 @@ double FloatAttr::getValueAsDouble(APFloat value) { } LogicalResult FloatAttr::verify(function_ref emitError, - Type type, const APFloat &value) { + Type type, APFloat value) { // Verify that the type is correct. if (!type.isa()) return emitError() << "expected floating point type"; diff --git a/mlir/test/lib/Dialect/Test/TestAttributes.cpp b/mlir/test/lib/Dialect/Test/TestAttributes.cpp index 909f5b399543..3a860994f0e8 100644 --- a/mlir/test/lib/Dialect/Test/TestAttributes.cpp +++ b/mlir/test/lib/Dialect/Test/TestAttributes.cpp @@ -129,7 +129,7 @@ TestI64ElementsAttr::verify(function_ref emitError, LogicalResult TestAttrWithFormatAttr::verify(function_ref emitError, - int64_t one, StringRef two, IntegerAttr three, + int64_t one, std::string two, IntegerAttr three, ArrayRef four) { if (four.size() != static_cast(one)) return emitError() << "expected 'one' to equal 'four.size()'"; diff --git a/mlir/test/mlir-tblgen/attrdefs.td b/mlir/test/mlir-tblgen/attrdefs.td index f53705dd662f..34c8588225f7 100644 --- a/mlir/test/mlir-tblgen/attrdefs.td +++ b/mlir/test/mlir-tblgen/attrdefs.td @@ -61,8 +61,8 @@ def B_CompoundAttrA : TestAttr<"CompoundA"> { let genVerifyDecl = 1; // DECL-LABEL: class CompoundAAttr : public ::mlir::Attribute -// DECL: static CompoundAAttr getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, int widthOfSomething, ::test::SimpleTypeA exampleTdType, const ::llvm::APFloat &apFloat, ::llvm::ArrayRef dims, ::mlir::Type inner); -// DECL: static ::mlir::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, int widthOfSomething, ::test::SimpleTypeA exampleTdType, const ::llvm::APFloat &apFloat, ::llvm::ArrayRef dims, ::mlir::Type inner); +// DECL: static CompoundAAttr getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, int widthOfSomething, ::test::SimpleTypeA exampleTdType, ::llvm::APFloat apFloat, ::llvm::ArrayRef dims, ::mlir::Type inner); +// DECL: static ::mlir::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, int widthOfSomething, ::test::SimpleTypeA exampleTdType, ::llvm::APFloat apFloat, ::llvm::ArrayRef dims, ::mlir::Type inner); // DECL: static constexpr ::llvm::StringLiteral getMnemonic() { // DECL: return {"cmpnd_a"}; // DECL: } @@ -71,7 +71,7 @@ def B_CompoundAttrA : TestAttr<"CompoundA"> { // DECL: void print(::mlir::AsmPrinter &printer) const; // DECL: int getWidthOfSomething() const; // DECL: ::test::SimpleTypeA getExampleTdType() const; -// DECL: const ::llvm::APFloat &getApFloat() const; +// DECL: ::llvm::APFloat getApFloat() const; // Check that AttributeSelfTypeParameter is handled properly. // DEF-LABEL: struct CompoundAAttrStorage @@ -139,5 +139,5 @@ def F_ParamWithAccessorTypeAttr : TestAttr<"ParamWithAccessorType"> { // DECL-LABEL: class ParamWithAccessorTypeAttr // DECL: StringRef getParam() // DEF: ParamWithAccessorTypeAttrStorage -// DEF: ParamWithAccessorTypeAttrStorage(StringRef param) +// DEF: ParamWithAccessorTypeAttrStorage(std::string param) // DEF: StringRef ParamWithAccessorTypeAttr::getParam() diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp index f2df6c8ae765..d90adbc47ef4 100644 --- a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp +++ b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp @@ -315,7 +315,7 @@ DefGen::getBuilderParams(std::initializer_list prefix) const { SmallVector builderParams; builderParams.append(prefix.begin(), prefix.end()); for (auto ¶m : params) - builderParams.emplace_back(param.getCppAccessorType(), param.getName()); + builderParams.emplace_back(param.getCppType(), param.getName()); return builderParams; }