[CSE] NFC: Hash the attribute dictionary pointer instead of the list of attributes.

PiperOrigin-RevId: 283810829
This commit is contained in:
River Riddle 2019-12-04 12:31:36 -08:00 committed by A. Unique TensorFlower
parent edfaf925cf
commit 6f895bec7d
2 changed files with 9 additions and 2 deletions

View File

@ -1373,6 +1373,13 @@ public:
: attrs((attrs && !attrs.empty()) ? attrs : nullptr) {} : attrs((attrs && !attrs.empty()) ? attrs : nullptr) {}
NamedAttributeList(ArrayRef<NamedAttribute> attributes); NamedAttributeList(ArrayRef<NamedAttribute> 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 /// Return the underlying dictionary attribute. This may be null, if this list
/// has no attributes. /// has no attributes.
DictionaryAttr getDictionary() const { return attrs; } DictionaryAttr getDictionary() const { return attrs; }

View File

@ -47,7 +47,7 @@ struct SimpleOperationInfo : public llvm::DenseMapInfo<Operation *> {
// - Result Types // - Result Types
// - Operands // - Operands
return hash_combine( 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->result_type_begin(), op->result_type_end()),
hash_combine_range(op->operand_begin(), op->operand_end())); hash_combine_range(op->operand_begin(), op->operand_end()));
} }
@ -68,7 +68,7 @@ struct SimpleOperationInfo : public llvm::DenseMapInfo<Operation *> {
lhs->getNumResults() != rhs->getNumResults()) lhs->getNumResults() != rhs->getNumResults())
return false; return false;
// Compare attributes. // Compare attributes.
if (lhs->getAttrs() != rhs->getAttrs()) if (lhs->getAttrList() != rhs->getAttrList())
return false; return false;
// Compare operands. // Compare operands.
if (!std::equal(lhs->operand_begin(), lhs->operand_end(), if (!std::equal(lhs->operand_begin(), lhs->operand_end(),