Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions mlir/test/mlir-tblgen/op-properties.td
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def OpWithProps : NS_Op<"op_with_props"> {
ArrayProp<StringProp>:$strings,
DefaultValuedProp<I32Prop, "0">:$default_int,
OptionalProp<I64Prop>:$optional,
DefaultI64Array:$intArray
DefaultI64Array:$value
);
}

Expand Down Expand Up @@ -94,10 +94,10 @@ def OpWithOptionalPropsAndAttrs :
// DECL: ::llvm::ArrayRef<std::string> getStrings()
// DECL: using default_intTy = int32_t;
// DECL: default_intTy default_int = 0;
// DECL: intArrayTy intArray = ::llvm::SmallVector<int64_t>{};
// DECL: ::llvm::ArrayRef<int64_t> getIntArray()
// DECL: valueTy value = ::llvm::SmallVector<int64_t>{};
// DECL: ::llvm::ArrayRef<int64_t> getValue()
// DECL: return ::llvm::ArrayRef<int64_t>{propStorage}
// DECL: void setIntArray(::llvm::ArrayRef<int64_t> propValue)
// DECL: void setValue(::llvm::ArrayRef<int64_t> propValue)
// DECL: propStorage.assign
// DECL-LABEL: class OpWithProps :
// DECL: setString(::llvm::StringRef newString)
Expand All @@ -111,14 +111,14 @@ def OpWithOptionalPropsAndAttrs :
// DECL-SAME: ::llvm::ArrayRef<std::string> strings,
// DECL-SAME: /*optional*/int32_t default_int = 0,
// DECL-SAME: /*optional*/std::optional<int64_t> optional = std::nullopt,
// DECL-SAME: /*optional*/::llvm::ArrayRef<int64_t> intArray = ::llvm::ArrayRef<int64_t>{});
// DECL-SAME: /*optional*/::llvm::ArrayRef<int64_t> value = ::llvm::ArrayRef<int64_t>{});

// DEFS-LABEL: OpWithProps::computePropertiesHash
// DEFS: hash_intArray
// DEFS: hash_value_
// DEFS: using ::llvm::hash_value;
// DEFS-NEXT: return hash_value(::llvm::ArrayRef<int64_t>{propStorage})
// DEFS: hash_value(prop.optional)
// DEFS: hash_intArray(prop.intArray)
// DEFS: hash_value_(prop.value)

// -----

Expand Down
4 changes: 2 additions & 2 deletions mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1629,7 +1629,7 @@ void OpEmitter::genPropertiesSupport() {
// Hashing for the property

const char *propHashFmt = R"decl(
auto hash_{0} = [] (const auto &propStorage) -> llvm::hash_code {
auto hash_{0}_ = [] (const auto &propStorage) -> llvm::hash_code {
using ::llvm::hash_value;
return {1};
};
Expand All @@ -1655,7 +1655,7 @@ void OpEmitter::genPropertiesSupport() {
if (const auto *namedProperty =
llvm::dyn_cast_if_present<const NamedProperty *>(attrOrProp)) {
if (!namedProperty->prop.getHashPropertyCall().empty()) {
hashMethod << "\n hash_" << namedProperty->name << "(prop."
hashMethod << "\n hash_" << namedProperty->name << "_(prop."
<< namedProperty->name << ")";
} else {
hashMethod << "\n hash_value(prop." << namedProperty->name
Expand Down