diff --git a/mlir/include/mlir/IR/Attributes.h b/mlir/include/mlir/IR/Attributes.h index b5b9a0491f4f..ebff99ddcd51 100644 --- a/mlir/include/mlir/IR/Attributes.h +++ b/mlir/include/mlir/IR/Attributes.h @@ -1373,6 +1373,13 @@ public: : attrs((attrs && !attrs.empty()) ? attrs : nullptr) {} NamedAttributeList(ArrayRef attributes); + bool operator!=(const NamedAttributeList &other) const { + return !(*this == other); + } + bool operator==(const NamedAttributeList &other) const { + return attrs == other.attrs; + } + /// Return the underlying dictionary attribute. This may be null, if this list /// has no attributes. DictionaryAttr getDictionary() const { return attrs; } diff --git a/mlir/lib/Transforms/CSE.cpp b/mlir/lib/Transforms/CSE.cpp index c3d30bf65a1b..70eb69c2f9cf 100644 --- a/mlir/lib/Transforms/CSE.cpp +++ b/mlir/lib/Transforms/CSE.cpp @@ -47,7 +47,7 @@ struct SimpleOperationInfo : public llvm::DenseMapInfo { // - Result Types // - Operands return hash_combine( - op->getName(), op->getAttrs(), + op->getName(), op->getAttrList().getDictionary(), hash_combine_range(op->result_type_begin(), op->result_type_end()), hash_combine_range(op->operand_begin(), op->operand_end())); } @@ -68,7 +68,7 @@ struct SimpleOperationInfo : public llvm::DenseMapInfo { lhs->getNumResults() != rhs->getNumResults()) return false; // Compare attributes. - if (lhs->getAttrs() != rhs->getAttrs()) + if (lhs->getAttrList() != rhs->getAttrList()) return false; // Compare operands. if (!std::equal(lhs->operand_begin(), lhs->operand_end(),