}
// Identifier/Identifier equality comparisons are defined inline.
-inline bool operator==(Identifier lhs, StringRef rhs) { return lhs.is(rhs); }
-inline bool operator!=(Identifier lhs, StringRef rhs) { return !lhs.is(rhs); }
-inline bool operator==(StringRef lhs, Identifier rhs) { return rhs.is(lhs); }
-inline bool operator!=(StringRef lhs, Identifier rhs) { return !rhs.is(lhs); }
+inline bool operator==(Identifier lhs, StringRef rhs) {
+ return lhs.strref() == rhs;
+}
+inline bool operator!=(Identifier lhs, StringRef rhs) { return !(lhs == rhs); }
+
+inline bool operator==(StringRef lhs, Identifier rhs) {
+ return rhs.strref() == lhs;
+}
+inline bool operator!=(StringRef lhs, Identifier rhs) { return !(lhs == rhs); }
// Make identifiers hashable.
inline llvm::hash_code hash_value(Identifier arg) {
// not specific to function modeling.
SmallVector<NamedAttribute, 4> attributes;
for (const auto &attr : gpuFuncOp.getAttrs()) {
- if (attr.first.is(SymbolTable::getSymbolAttrName()) ||
- attr.first.is(impl::getTypeAttrName()) ||
- attr.first.is(gpu::GPUFuncOp::getNumWorkgroupAttributionsAttrName()))
+ if (attr.first == SymbolTable::getSymbolAttrName() ||
+ attr.first == impl::getTypeAttrName() ||
+ attr.first == gpu::GPUFuncOp::getNumWorkgroupAttributionsAttrName())
continue;
attributes.push_back(attr);
}
rewriter.getFunctionType(signatureConverter.getConvertedTypes(),
llvm::None));
for (const auto &namedAttr : funcOp.getAttrs()) {
- if (namedAttr.first.is(impl::getTypeAttrName()) ||
- namedAttr.first.is(SymbolTable::getSymbolAttrName()))
+ if (namedAttr.first == impl::getTypeAttrName() ||
+ namedAttr.first == SymbolTable::getSymbolAttrName())
continue;
newFuncOp.setAttr(namedAttr.first, namedAttr.second);
}
bool filterArgAttrs,
SmallVectorImpl<NamedAttribute> &result) {
for (const auto &attr : attrs) {
- if (attr.first.is(SymbolTable::getSymbolAttrName()) ||
- attr.first.is(impl::getTypeAttrName()) ||
- attr.first.is("std.varargs") ||
+ if (attr.first == SymbolTable::getSymbolAttrName() ||
+ attr.first == impl::getTypeAttrName() || attr.first == "std.varargs" ||
(filterArgAttrs && impl::isArgAttrName(attr.first.strref())))
continue;
result.push_back(attr);
LogicalResult GPUDialect::verifyOperationAttribute(Operation *op,
NamedAttribute attr) {
if (!attr.second.isa<UnitAttr>() ||
- !attr.first.is(getContainerModuleAttrName()))
+ attr.first != getContainerModuleAttrName())
return success();
auto module = dyn_cast<ModuleOp>(op);
// Copy over all attributes other than the function name and type.
for (const auto &namedAttr : funcOp.getAttrs()) {
- if (!namedAttr.first.is(impl::getTypeAttrName()) &&
- !namedAttr.first.is(SymbolTable::getSymbolAttrName()))
+ if (namedAttr.first != impl::getTypeAttrName() &&
+ namedAttr.first != SymbolTable::getSymbolAttrName())
newFuncOp.setAttr(namedAttr.first, namedAttr.second);
}
operands);
for (auto attr : op.getAttrs()) {
if (llvm::any_of(elidedAttrs,
- [&](StringRef elided) { return attr.first.is(elided); })) {
+ [&](StringRef elided) { return attr.first == elided; })) {
continue;
}
if (failed(processDecoration(op.getLoc(), resultID, attr))) {
// Encode decorations.
for (auto attr : varOp.getAttrs()) {
if (llvm::any_of(elidedAttrs,
- [&](StringRef elided) { return attr.first.is(elided); })) {
+ [&](StringRef elided) { return attr.first == elided; })) {
continue;
}
if (failed(processDecoration(varOp.getLoc(), resultID, attr))) {
return strncmp(attr.first.data(), name.data(), name.size()) < 0;
};
auto it = llvm::lower_bound(values, name, compare);
- return it != values.end() && it->first.is(name) ? it->second : Attribute();
+ return it != values.end() && it->first == name ? it->second : Attribute();
}
Attribute DictionaryAttr::get(Identifier name) const {
for (auto elt : getValue())
bool mlir::isOpaqueTypeWithName(Type type, StringRef dialect,
StringRef typeData) {
if (auto opaque = type.dyn_cast<mlir::OpaqueType>())
- return opaque.getDialectNamespace().is(dialect) &&
+ return opaque.getDialectNamespace() == dialect &&
opaque.getTypeData() == typeData;
return false;
}
// If the attribute dictionary contains no 'names' attribute, infer it from
// the SSA name (if specified).
bool hadNames = llvm::any_of(result.attributes, [](NamedAttribute attr) {
- return attr.first.is("names");
+ return attr.first == "names";
});
// If there was no name specified, check to see if there was a useful name
os << tabs << formatv("for (auto attr : {0}.getAttrs()) {{\n", opVar);
os << tabs
<< formatv(" if (llvm::any_of({0}, [&](StringRef elided)", elidedAttrs);
- os << " {return attr.first.is(elided);})) {\n";
+ os << " {return attr.first == elided;})) {\n";
os << tabs << " continue;\n";
os << tabs << " }\n";
os << tabs