diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td --- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td +++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td @@ -680,7 +680,7 @@ OpBuilder<"OpBuilder &builder, OperationState &result, StringRef name, " "LLVMType type, LLVM::Linkage linkage = LLVM::Linkage::External, " "ArrayRef attrs = {}, " - "ArrayRef argAttrs = {}"> + "ArrayRef argAttrs = {}"> ]; let extraClassDeclaration = [{ diff --git a/mlir/include/mlir/IR/Attributes.h b/mlir/include/mlir/IR/Attributes.h --- a/mlir/include/mlir/IR/Attributes.h +++ b/mlir/include/mlir/IR/Attributes.h @@ -1476,26 +1476,26 @@ } //===----------------------------------------------------------------------===// -// NamedAttributeList +// MutableDictionaryAttr //===----------------------------------------------------------------------===// -/// A NamedAttributeList is a mutable wrapper around a DictionaryAttr. It +/// A MutableDictionaryAttr is a mutable wrapper around a DictionaryAttr. It /// provides additional interfaces for adding, removing, replacing attributes /// within a DictionaryAttr. /// /// We assume there will be relatively few attributes on a given operation /// (maybe a dozen or so, but not hundreds or thousands) so we use linear /// searches for everything. -class NamedAttributeList { +class MutableDictionaryAttr { public: - NamedAttributeList(DictionaryAttr attrs = nullptr) + MutableDictionaryAttr(DictionaryAttr attrs = nullptr) : attrs((attrs && !attrs.empty()) ? attrs : nullptr) {} - NamedAttributeList(ArrayRef attributes); + MutableDictionaryAttr(ArrayRef attributes); - bool operator!=(const NamedAttributeList &other) const { + bool operator!=(const MutableDictionaryAttr &other) const { return !(*this == other); } - bool operator==(const NamedAttributeList &other) const { + bool operator==(const MutableDictionaryAttr &other) const { return attrs == other.attrs; } diff --git a/mlir/include/mlir/IR/Function.h b/mlir/include/mlir/IR/Function.h --- a/mlir/include/mlir/IR/Function.h +++ b/mlir/include/mlir/IR/Function.h @@ -47,13 +47,13 @@ iterator_range attrs); static FuncOp create(Location location, StringRef name, FunctionType type, ArrayRef attrs, - ArrayRef argAttrs); + ArrayRef argAttrs); static void build(OpBuilder &builder, OperationState &result, StringRef name, FunctionType type, ArrayRef attrs); static void build(OpBuilder &builder, OperationState &result, StringRef name, FunctionType type, ArrayRef attrs, - ArrayRef argAttrs); + ArrayRef argAttrs); /// Operation hooks. static ParseResult parse(OpAsmParser &parser, OperationState &result); diff --git a/mlir/include/mlir/IR/FunctionSupport.h b/mlir/include/mlir/IR/FunctionSupport.h --- a/mlir/include/mlir/IR/FunctionSupport.h +++ b/mlir/include/mlir/IR/FunctionSupport.h @@ -243,7 +243,7 @@ } /// Return all argument attributes of this function. - void getAllArgAttrs(SmallVectorImpl &result) { + void getAllArgAttrs(SmallVectorImpl &result) { for (unsigned i = 0, e = getNumArguments(); i != e; ++i) result.emplace_back(getArgAttrDict(i)); } @@ -270,8 +270,8 @@ /// Set the attributes held by the argument at 'index'. void setArgAttrs(unsigned index, ArrayRef attributes); - void setArgAttrs(unsigned index, NamedAttributeList attributes); - void setAllArgAttrs(ArrayRef attributes) { + void setArgAttrs(unsigned index, MutableDictionaryAttr attributes); + void setAllArgAttrs(ArrayRef attributes) { assert(attributes.size() == getNumArguments()); for (unsigned i = 0, e = attributes.size(); i != e; ++i) setArgAttrs(i, attributes[i]); @@ -286,8 +286,8 @@ } /// Remove the attribute 'name' from the argument at 'index'. - NamedAttributeList::RemoveResult removeArgAttr(unsigned index, - Identifier name); + MutableDictionaryAttr::RemoveResult removeArgAttr(unsigned index, + Identifier name); //===--------------------------------------------------------------------===// // Result Attributes @@ -306,7 +306,7 @@ } /// Return all result attributes of this function. - void getAllResultAttrs(SmallVectorImpl &result) { + void getAllResultAttrs(SmallVectorImpl &result) { for (unsigned i = 0, e = getNumResults(); i != e; ++i) result.emplace_back(getResultAttrDict(i)); } @@ -333,8 +333,8 @@ /// Set the attributes held by the result at 'index'. void setResultAttrs(unsigned index, ArrayRef attributes); - void setResultAttrs(unsigned index, NamedAttributeList attributes); - void setAllResultAttrs(ArrayRef attributes) { + void setResultAttrs(unsigned index, MutableDictionaryAttr attributes); + void setAllResultAttrs(ArrayRef attributes) { assert(attributes.size() == getNumResults()); for (unsigned i = 0, e = attributes.size(); i != e; ++i) setResultAttrs(i, attributes[i]); @@ -350,8 +350,8 @@ } /// Remove the attribute 'name' from the result at 'index'. - NamedAttributeList::RemoveResult removeResultAttr(unsigned index, - Identifier name); + MutableDictionaryAttr::RemoveResult removeResultAttr(unsigned index, + Identifier name); protected: /// Returns the attribute entry name for the set of argument attributes at @@ -514,7 +514,7 @@ template void FunctionLike::setArgAttrs(unsigned index, - NamedAttributeList attributes) { + MutableDictionaryAttr attributes) { assert(index < getNumArguments() && "invalid argument number"); SmallString<8> nameOut; if (auto newAttr = attributes.getDictionary()) @@ -529,25 +529,25 @@ void FunctionLike::setArgAttr(unsigned index, Identifier name, Attribute value) { auto curAttr = getArgAttrDict(index); - NamedAttributeList attrList(curAttr); - attrList.set(name, value); + MutableDictionaryAttr attrDict(curAttr); + attrDict.set(name, value); // If the attribute changed, then set the new arg attribute list. - if (curAttr != attrList.getDictionary()) - setArgAttrs(index, attrList); + if (curAttr != attrDict.getDictionary()) + setArgAttrs(index, attrDict); } /// Remove the attribute 'name' from the argument at 'index'. template -NamedAttributeList::RemoveResult +MutableDictionaryAttr::RemoveResult FunctionLike::removeArgAttr(unsigned index, Identifier name) { // Build an attribute list and remove the attribute at 'name'. - NamedAttributeList attrList(getArgAttrDict(index)); - auto result = attrList.remove(name); + MutableDictionaryAttr attrDict(getArgAttrDict(index)); + auto result = attrDict.remove(name); // If the attribute was removed, then update the argument dictionary. - if (result == NamedAttributeList::RemoveResult::Removed) - setArgAttrs(index, attrList); + if (result == MutableDictionaryAttr::RemoveResult::Removed) + setArgAttrs(index, attrDict); return result; } @@ -570,8 +570,8 @@ } template -void FunctionLike::setResultAttrs(unsigned index, - NamedAttributeList attributes) { +void FunctionLike::setResultAttrs( + unsigned index, MutableDictionaryAttr attributes) { assert(index < getNumResults() && "invalid result number"); SmallString<8> nameOut; if (auto newAttr = attributes.getDictionary()) @@ -587,25 +587,25 @@ void FunctionLike::setResultAttr(unsigned index, Identifier name, Attribute value) { auto curAttr = getResultAttrDict(index); - NamedAttributeList attrList(curAttr); - attrList.set(name, value); + MutableDictionaryAttr attrDict(curAttr); + attrDict.set(name, value); // If the attribute changed, then set the new arg attribute list. - if (curAttr != attrList.getDictionary()) - setResultAttrs(index, attrList); + if (curAttr != attrDict.getDictionary()) + setResultAttrs(index, attrDict); } /// Remove the attribute 'name' from the result at 'index'. template -NamedAttributeList::RemoveResult +MutableDictionaryAttr::RemoveResult FunctionLike::removeResultAttr(unsigned index, Identifier name) { // Build an attribute list and remove the attribute at 'name'. - NamedAttributeList attrList(getResultAttrDict(index)); - auto result = attrList.remove(name); + MutableDictionaryAttr attrDict(getResultAttrDict(index)); + auto result = attrDict.remove(name); // If the attribute was removed, then update the result dictionary. - if (result == NamedAttributeList::RemoveResult::Removed) - setResultAttrs(index, attrList); + if (result == MutableDictionaryAttr::RemoveResult::Removed) + setResultAttrs(index, attrDict); return result; } diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h --- a/mlir/include/mlir/IR/OpDefinition.h +++ b/mlir/include/mlir/IR/OpDefinition.h @@ -178,7 +178,7 @@ void setAttrs(ArrayRef attributes) { state->setAttrs(attributes); } - void setAttrs(NamedAttributeList newAttrs) { state->setAttrs(newAttrs); } + void setAttrs(MutableDictionaryAttr newAttrs) { state->setAttrs(newAttrs); } /// Set the dialect attributes for this operation, and preserve all dependent. template void setDialectAttrs(DialectAttrs &&attrs) { @@ -187,10 +187,10 @@ /// Remove the attribute with the specified name if it exists. The return /// value indicates whether the attribute was present or not. - NamedAttributeList::RemoveResult removeAttr(Identifier name) { + MutableDictionaryAttr::RemoveResult removeAttr(Identifier name) { return state->removeAttr(name); } - NamedAttributeList::RemoveResult removeAttr(StringRef name) { + MutableDictionaryAttr::RemoveResult removeAttr(StringRef name) { return state->removeAttr(Identifier::get(name, getContext())); } diff --git a/mlir/include/mlir/IR/Operation.h b/mlir/include/mlir/IR/Operation.h --- a/mlir/include/mlir/IR/Operation.h +++ b/mlir/include/mlir/IR/Operation.h @@ -36,11 +36,11 @@ ArrayRef attributes, ArrayRef successors, unsigned numRegions); - /// Overload of create that takes an existing NamedAttributeList to avoid + /// Overload of create that takes an existing MutableDictionaryAttr to avoid /// unnecessarily uniquing a list of attributes. static Operation *create(Location location, OperationName name, ArrayRef resultTypes, ArrayRef operands, - NamedAttributeList attributes, + MutableDictionaryAttr attributes, ArrayRef successors, unsigned numRegions); /// Create a new Operation from the fields stored in `state`. @@ -49,7 +49,7 @@ /// Create a new Operation with the specific fields. static Operation *create(Location location, OperationName name, ArrayRef resultTypes, ArrayRef operands, - NamedAttributeList attributes, + MutableDictionaryAttr attributes, ArrayRef successors = {}, RegionRange regions = {}); @@ -280,13 +280,13 @@ /// Return all of the attributes on this operation. ArrayRef getAttrs() { return attrs.getAttrs(); } - /// Return the internal attribute list on this operation. - NamedAttributeList &getAttrList() { return attrs; } + /// Return mutable container of all the attributes on this operation. + MutableDictionaryAttr &getMutableAttrDict() { return attrs; } - /// Set the attribute list on this operation. - /// Using a NamedAttributeList is more efficient as it does not require new + /// Set the attribute dictionary on this operation. + /// Using a MutableDictionaryAttr is more efficient as it does not require new /// uniquing in the MLIRContext. - void setAttrs(NamedAttributeList newAttrs) { attrs = newAttrs; } + void setAttrs(MutableDictionaryAttr newAttrs) { attrs = newAttrs; } /// Return the specified attribute if present, null otherwise. Attribute getAttr(Identifier name) { return attrs.get(name); } @@ -309,7 +309,7 @@ /// Remove the attribute with the specified name if it exists. The return /// value indicates whether the attribute was present or not. - NamedAttributeList::RemoveResult removeAttr(Identifier name) { + MutableDictionaryAttr::RemoveResult removeAttr(Identifier name) { return attrs.remove(name); } @@ -596,7 +596,7 @@ private: Operation(Location location, OperationName name, ArrayRef resultTypes, unsigned numSuccessors, unsigned numRegions, - const NamedAttributeList &attributes, bool hasOperandStorage); + const MutableDictionaryAttr &attributes, bool hasOperandStorage); // Operations are deleted through the destroy() member because they are // allocated with malloc. @@ -658,7 +658,7 @@ OperationName name; /// This holds general named attributes for the operation. - NamedAttributeList attrs; + MutableDictionaryAttr attrs; // allow ilist_traits access to 'block' field. friend struct llvm::ilist_traits; diff --git a/mlir/lib/Analysis/CallGraph.cpp b/mlir/lib/Analysis/CallGraph.cpp --- a/mlir/lib/Analysis/CallGraph.cpp +++ b/mlir/lib/Analysis/CallGraph.cpp @@ -179,7 +179,7 @@ auto *parentOp = callableRegion->getParentOp(); os << "'" << callableRegion->getParentOp()->getName() << "' - Region #" << callableRegion->getRegionNumber(); - if (auto attrs = parentOp->getAttrList().getDictionary()) + if (auto attrs = parentOp->getMutableAttrDict().getDictionary()) os << " : " << attrs; }; diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp @@ -1173,7 +1173,7 @@ void LLVMFuncOp::build(OpBuilder &builder, OperationState &result, StringRef name, LLVMType type, LLVM::Linkage linkage, ArrayRef attrs, - ArrayRef argAttrs) { + ArrayRef argAttrs) { result.addRegion(); result.addAttribute(SymbolTable::getSymbolAttrName(), builder.getStringAttr(name)); diff --git a/mlir/lib/Dialect/SPIRV/SPIRVCanonicalization.cpp b/mlir/lib/Dialect/SPIRV/SPIRVCanonicalization.cpp --- a/mlir/lib/Dialect/SPIRV/SPIRVCanonicalization.cpp +++ b/mlir/lib/Dialect/SPIRV/SPIRVCanonicalization.cpp @@ -353,8 +353,8 @@ } bool isSameAttrList(spirv::StoreOp lhs, spirv::StoreOp rhs) const { - return lhs.getOperation()->getAttrList().getDictionary() == - rhs.getOperation()->getAttrList().getDictionary(); + return lhs.getOperation()->getMutableAttrDict().getDictionary() == + rhs.getOperation()->getMutableAttrDict().getDictionary(); } diff --git a/mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp b/mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp --- a/mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp +++ b/mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp @@ -445,7 +445,7 @@ DenseMap nameMap; // Result to decorations mapping. - DenseMap decorations; + DenseMap decorations; // Result to type decorations. DenseMap typeDecorations; diff --git a/mlir/lib/IR/Attributes.cpp b/mlir/lib/IR/Attributes.cpp --- a/mlir/lib/IR/Attributes.cpp +++ b/mlir/lib/IR/Attributes.cpp @@ -1160,19 +1160,20 @@ } //===----------------------------------------------------------------------===// -// NamedAttributeList +// MutableDictionaryAttr //===----------------------------------------------------------------------===// -NamedAttributeList::NamedAttributeList(ArrayRef attributes) { +MutableDictionaryAttr::MutableDictionaryAttr( + ArrayRef attributes) { setAttrs(attributes); } -ArrayRef NamedAttributeList::getAttrs() const { +ArrayRef MutableDictionaryAttr::getAttrs() const { return attrs ? attrs.getValue() : llvm::None; } /// Replace the held attributes with ones provided in 'newAttrs'. -void NamedAttributeList::setAttrs(ArrayRef attributes) { +void MutableDictionaryAttr::setAttrs(ArrayRef attributes) { // Don't create an attribute list if there are no attributes. if (attributes.empty()) attrs = nullptr; @@ -1181,18 +1182,18 @@ } /// Return the specified attribute if present, null otherwise. -Attribute NamedAttributeList::get(StringRef name) const { +Attribute MutableDictionaryAttr::get(StringRef name) const { return attrs ? attrs.get(name) : nullptr; } /// Return the specified attribute if present, null otherwise. -Attribute NamedAttributeList::get(Identifier name) const { +Attribute MutableDictionaryAttr::get(Identifier name) const { return attrs ? attrs.get(name) : nullptr; } /// If the an attribute exists with the specified name, change it to the new /// value. Otherwise, add a new attribute with the specified name/value. -void NamedAttributeList::set(Identifier name, Attribute value) { +void MutableDictionaryAttr::set(Identifier name, Attribute value) { assert(value && "attributes may never be null"); // Look for an existing value for the given name, and set it in-place. @@ -1222,7 +1223,7 @@ /// Remove the attribute with the specified name if it exists. The return /// value indicates whether the attribute was present or not. -auto NamedAttributeList::remove(Identifier name) -> RemoveResult { +auto MutableDictionaryAttr::remove(Identifier name) -> RemoveResult { auto origAttrs = getAttrs(); for (unsigned i = 0, e = origAttrs.size(); i != e; ++i) { if (origAttrs[i].first == name) { diff --git a/mlir/lib/IR/Function.cpp b/mlir/lib/IR/Function.cpp --- a/mlir/lib/IR/Function.cpp +++ b/mlir/lib/IR/Function.cpp @@ -35,7 +35,7 @@ } FuncOp FuncOp::create(Location location, StringRef name, FunctionType type, ArrayRef attrs, - ArrayRef argAttrs) { + ArrayRef argAttrs) { FuncOp func = create(location, name, type, attrs); func.setAllArgAttrs(argAttrs); return func; @@ -52,7 +52,7 @@ void FuncOp::build(OpBuilder &builder, OperationState &result, StringRef name, FunctionType type, ArrayRef attrs, - ArrayRef argAttrs) { + ArrayRef argAttrs) { build(builder, result, name, type, attrs); assert(type.getNumInputs() == argAttrs.size()); SmallString<8> argAttrName; @@ -115,7 +115,7 @@ // Update the function type and arg attrs. SmallVector newInputTypes; - SmallVector newArgAttrs; + SmallVector newArgAttrs; for (int i = 0; i < originalNumArgs; i++) { if (shouldEraseArg(i)) continue; diff --git a/mlir/lib/IR/Module.cpp b/mlir/lib/IR/Module.cpp --- a/mlir/lib/IR/Module.cpp +++ b/mlir/lib/IR/Module.cpp @@ -83,7 +83,7 @@ // Check that none of the attributes are non-dialect attributes, except for // the symbol related attributes. - for (auto attr : getOperation()->getAttrList().getAttrs()) { + for (auto attr : getOperation()->getMutableAttrDict().getAttrs()) { if (!attr.first.strref().contains('.') && !llvm::is_contained( ArrayRef{mlir::SymbolTable::getSymbolAttrName(), diff --git a/mlir/lib/IR/Operation.cpp b/mlir/lib/IR/Operation.cpp --- a/mlir/lib/IR/Operation.cpp +++ b/mlir/lib/IR/Operation.cpp @@ -65,21 +65,21 @@ ArrayRef successors, unsigned numRegions) { return create(location, name, resultTypes, operands, - NamedAttributeList(attributes), successors, numRegions); + MutableDictionaryAttr(attributes), successors, numRegions); } /// Create a new Operation from operation state. Operation *Operation::create(const OperationState &state) { - return Operation::create(state.location, state.name, state.types, - state.operands, NamedAttributeList(state.attributes), - state.successors, state.regions); + return Operation::create( + state.location, state.name, state.types, state.operands, + MutableDictionaryAttr(state.attributes), state.successors, state.regions); } /// Create a new Operation with the specific fields. Operation *Operation::create(Location location, OperationName name, ArrayRef resultTypes, ArrayRef operands, - NamedAttributeList attributes, + MutableDictionaryAttr attributes, ArrayRef successors, RegionRange regions) { unsigned numRegions = regions.size(); @@ -91,12 +91,12 @@ return op; } -/// Overload of create that takes an existing NamedAttributeList to avoid +/// Overload of create that takes an existing MutableDictionaryAttr to avoid /// unnecessarily uniquing a list of attributes. Operation *Operation::create(Location location, OperationName name, ArrayRef resultTypes, ArrayRef operands, - NamedAttributeList attributes, + MutableDictionaryAttr attributes, ArrayRef successors, unsigned numRegions) { // We only need to allocate additional memory for a subset of results. @@ -156,7 +156,8 @@ Operation::Operation(Location location, OperationName name, ArrayRef resultTypes, unsigned numSuccessors, - unsigned numRegions, const NamedAttributeList &attributes, + unsigned numRegions, + const MutableDictionaryAttr &attributes, bool hasOperandStorage) : location(location), numSuccs(numSuccessors), numRegions(numRegions), hasOperandStorage(hasOperandStorage), hasSingleResult(false), name(name), diff --git a/mlir/lib/IR/SymbolTable.cpp b/mlir/lib/IR/SymbolTable.cpp --- a/mlir/lib/IR/SymbolTable.cpp +++ b/mlir/lib/IR/SymbolTable.cpp @@ -385,7 +385,7 @@ Operation *op, function_ref)> callback) { // Check to see if the operation has any attributes. - DictionaryAttr attrDict = op->getAttrList().getDictionary(); + DictionaryAttr attrDict = op->getMutableAttrDict().getDictionary(); if (!attrDict) return WalkResult::advance(); @@ -803,7 +803,7 @@ // Generate a new attribute dictionary for the current operation by replacing // references to the old symbol. auto generateNewAttrDict = [&] { - auto oldDict = curOp->getAttrList().getDictionary(); + auto oldDict = curOp->getMutableAttrDict().getDictionary(); auto newDict = rebuildAttrAfterRAUW(oldDict, accessChains, /*depth=*/0); return newDict.cast(); }; diff --git a/mlir/lib/Parser/Parser.cpp b/mlir/lib/Parser/Parser.cpp --- a/mlir/lib/Parser/Parser.cpp +++ b/mlir/lib/Parser/Parser.cpp @@ -5030,7 +5030,7 @@ if (nested && std::next(operations.begin(), 2) == operations.end()) { // Merge the data of the nested module operation into 'module'. module.setLoc(nested.getLoc()); - module.setAttrs(nested.getOperation()->getAttrList()); + module.setAttrs(nested.getOperation()->getMutableAttrDict()); bodyBlocks.splice(bodyBlocks.end(), nested.getBodyRegion().getBlocks()); // Erase the original module body. diff --git a/mlir/lib/Pass/IRPrinting.cpp b/mlir/lib/Pass/IRPrinting.cpp --- a/mlir/lib/Pass/IRPrinting.cpp +++ b/mlir/lib/Pass/IRPrinting.cpp @@ -33,8 +33,9 @@ // - Operation pointer addDataToHash(hasher, op); // - Attributes - addDataToHash(hasher, - op->getAttrList().getDictionary().getAsOpaquePointer()); + addDataToHash( + hasher, + op->getMutableAttrDict().getDictionary().getAsOpaquePointer()); // - Blocks in Regions for (Region ®ion : op->getRegions()) { for (Block &block : region) { diff --git a/mlir/lib/Transforms/CSE.cpp b/mlir/lib/Transforms/CSE.cpp --- a/mlir/lib/Transforms/CSE.cpp +++ b/mlir/lib/Transforms/CSE.cpp @@ -36,7 +36,8 @@ // - Result Types // - Operands return llvm::hash_combine( - op->getName(), op->getAttrList().getDictionary(), op->getResultTypes(), + op->getName(), op->getMutableAttrDict().getDictionary(), + op->getResultTypes(), llvm::hash_combine_range(op->operand_begin(), op->operand_end())); } static bool isEqual(const Operation *lhsC, const Operation *rhsC) { @@ -56,7 +57,7 @@ lhs->getNumResults() != rhs->getNumResults()) return false; // Compare attributes. - if (lhs->getAttrList() != rhs->getAttrList()) + if (lhs->getMutableAttrDict() != rhs->getMutableAttrDict()) return false; // Compare operands. if (!std::equal(lhs->operand_begin(), lhs->operand_end(), diff --git a/mlir/lib/Transforms/DialectConversion.cpp b/mlir/lib/Transforms/DialectConversion.cpp --- a/mlir/lib/Transforms/DialectConversion.cpp +++ b/mlir/lib/Transforms/DialectConversion.cpp @@ -468,7 +468,7 @@ public: OperationTransactionState() = default; OperationTransactionState(Operation *op) - : op(op), loc(op->getLoc()), attrs(op->getAttrList()), + : op(op), loc(op->getLoc()), attrs(op->getMutableAttrDict()), operands(op->operand_begin(), op->operand_end()), successors(op->successor_begin(), op->successor_end()) {} @@ -488,7 +488,7 @@ private: Operation *op; LocationAttr loc; - NamedAttributeList attrs; + MutableDictionaryAttr attrs; SmallVector operands; SmallVector successors; }; diff --git a/mlir/lib/Transforms/SCCP.cpp b/mlir/lib/Transforms/SCCP.cpp --- a/mlir/lib/Transforms/SCCP.cpp +++ b/mlir/lib/Transforms/SCCP.cpp @@ -514,7 +514,7 @@ // in-place. The constant passed in may not correspond to the real runtime // value, so in-place updates are not allowed. SmallVector originalOperands(op->getOperands()); - NamedAttributeList originalAttrs = op->getAttrList(); + MutableDictionaryAttr originalAttrs = op->getMutableAttrDict(); // Simulate the result of folding this operation to a constant. If folding // fails or was an in-place fold, mark the results as overdefined.