diff --git a/flang/include/flang/Optimizer/Dialect/FIRAttr.h b/flang/include/flang/Optimizer/Dialect/FIRAttr.h --- a/flang/include/flang/Optimizer/Dialect/FIRAttr.h +++ b/flang/include/flang/Optimizer/Dialect/FIRAttr.h @@ -25,7 +25,6 @@ class FIROpsDialect; namespace detail { -struct OpaqueAttributeStorage; struct RealAttributeStorage; struct TypeAttributeStorage; } // namespace detail @@ -134,27 +133,6 @@ llvm::APFloat getValue() const; }; -/// An opaque attribute is used to provide dictionary lookups of pointers. The -/// underlying type of the pointee object is left up to the client. Opaque -/// attributes are always constructed as null pointers when parsing. Clearly, -/// opaque attributes come with restrictions and must be used with care. -/// 1. An opaque attribute should not refer to information of semantic -/// significance, since the pointed-to object will not be a part of -/// round-tripping the IR. -/// 2. The lifetime of the pointed-to object must outlive any possible uses -/// via the opaque attribute. -class OpaqueAttr - : public mlir::Attribute::AttrBase { -public: - using Base::Base; - - static constexpr llvm::StringRef getAttrName() { return "opaque"; } - static OpaqueAttr get(mlir::MLIRContext *ctxt, void *pointer); - - void *getPointer() const; -}; - mlir::Attribute parseFirAttribute(FIROpsDialect *dialect, mlir::DialectAsmParser &parser, mlir::Type type); diff --git a/flang/lib/Optimizer/Dialect/FIRAttr.cpp b/flang/lib/Optimizer/Dialect/FIRAttr.cpp --- a/flang/lib/Optimizer/Dialect/FIRAttr.cpp +++ b/flang/lib/Optimizer/Dialect/FIRAttr.cpp @@ -74,28 +74,6 @@ private: mlir::Type value; }; - -/// An attribute representing a raw pointer. -struct OpaqueAttributeStorage : public mlir::AttributeStorage { - using KeyTy = void *; - - OpaqueAttributeStorage(void *value) : value(value) {} - - /// Key equality function. - bool operator==(const KeyTy &key) const { return key == value; } - - /// Construct a new storage instance. - static OpaqueAttributeStorage * - construct(mlir::AttributeStorageAllocator &allocator, KeyTy key) { - return new (allocator.allocate()) - OpaqueAttributeStorage(key); - } - - void *getPointer() const { return value; } - -private: - void *value; -}; } // namespace fir::detail //===----------------------------------------------------------------------===// @@ -149,16 +127,6 @@ llvm::APFloat fir::RealAttr::getValue() const { return getImpl()->getValue(); } -//===----------------------------------------------------------------------===// -// OpaqueAttr -//===----------------------------------------------------------------------===// - -OpaqueAttr fir::OpaqueAttr::get(mlir::MLIRContext *ctxt, void *key) { - return Base::get(ctxt, key); -} - -void *fir::OpaqueAttr::getPointer() const { return getImpl()->getPointer(); } - //===----------------------------------------------------------------------===// // FIR attribute parsing //===----------------------------------------------------------------------===// @@ -227,15 +195,6 @@ } return SubclassAttr::get(type); } - if (attrName == OpaqueAttr::getAttrName()) { - if (parser.parseLess() || parser.parseGreater()) { - parser.emitError(loc, "expected <>"); - return {}; - } - // NB: opaque pointers are always parsed in as nullptrs. The tool must - // rebuild the context. - return OpaqueAttr::get(dialect->getContext(), nullptr); - } if (attrName == PointIntervalAttr::getAttrName()) return PointIntervalAttr::get(dialect->getContext()); if (attrName == LowerBoundAttr::getAttrName()) @@ -279,8 +238,6 @@ llvm::SmallString<40> ss; a.getValue().bitcastToAPInt().toStringUnsigned(ss, 16); os << ss << '>'; - } else if (attr.isa()) { - os << fir::OpaqueAttr::getAttrName() << "<>"; } else { // don't know how to print the attribute, so use a default os << "<(unknown attribute)>"; diff --git a/flang/lib/Optimizer/Dialect/FIRDialect.cpp b/flang/lib/Optimizer/Dialect/FIRDialect.cpp --- a/flang/lib/Optimizer/Dialect/FIRDialect.cpp +++ b/flang/lib/Optimizer/Dialect/FIRDialect.cpp @@ -24,7 +24,7 @@ PointerType, RealType, RecordType, ReferenceType, SequenceType, ShapeType, ShapeShiftType, SliceType, TypeDescType, fir::VectorType>(); - addAttributes(); addOperations< #define GET_OP_LIST diff --git a/flang/test/Fir/fir-ops.fir b/flang/test/Fir/fir-ops.fir --- a/flang/test/Fir/fir-ops.fir +++ b/flang/test/Fir/fir-ops.fir @@ -32,9 +32,6 @@ func private @nop() func private @get_func() -> (() -> ()) -// CHECK-LABEL: func private @attr1() -> none attributes {a = #fir.opaque<>, b = #fir.opaque<>} -func private @attr1() -> none attributes {a = #fir.opaque<>, b = #fir.opaque<>} - // CHECK-LABEL: func @instructions() { func @instructions() { // CHECK: [[VAL_0:%.*]] = fir.alloca !fir.array<10xi32>