initialize(Operation *op,
DialectInterfaceCollection<OpAsmDialectInterface> &interfaces);
- /// Return a name used for an attribute alias, or empty if there is no alias.
- Twine getAttributeAlias(Attribute attr) const;
+ /// Get an alias for the given attribute if it has one and print it in `os`.
+ /// Returns success if an alias was printed, failure otherwise.
+ LogicalResult getAlias(Attribute attr, raw_ostream &os) const;
/// Print all of the referenced attribute aliases.
void printAttributeAliases(raw_ostream &os, NewLineCounter &newLine) const;
- /// Return a string to use as an alias for the given type, or empty if there
- /// is no alias recorded.
- StringRef getTypeAlias(Type ty) const;
+ /// Get an alias for the given type if it has one and print it in `os`.
+ /// Returns success if an alias was printed, failure otherwise.
+ LogicalResult getAlias(Type ty, raw_ostream &os) const;
/// Print all of the referenced type aliases.
void printTypeAliases(raw_ostream &os, NewLineCounter &newLine) const;
private:
- /// A special index constant used for non-kind attribute aliases.
- enum { NonAttrKindAlias = -1 };
-
- /// Record a reference to the given attribute.
- void recordAttributeReference(Attribute attr);
-
- /// Record a reference to the given type.
- void recordTypeReference(Type ty);
-
- // Visit functions.
- void visitOperation(Operation *op);
- void visitType(Type type);
- void visitAttribute(Attribute attr);
-
- /// Set of attributes known to be used within the module.
- llvm::SetVector<Attribute> usedAttributes;
+ /// This class represents a utility that initializes the set of attribute and
+ /// type aliases, without the need to store the extra information within the
+ /// main AliasState class or pass it around via function arguments.
+ class AliasInitializer {
+ public:
+ AliasInitializer(
+ DialectInterfaceCollection<OpAsmDialectInterface> &interfaces,
+ llvm::BumpPtrAllocator &aliasAllocator)
+ : interfaces(interfaces), aliasAllocator(aliasAllocator),
+ aliasOS(aliasBuffer) {}
+
+ void
+ initialize(Operation *op,
+ llvm::MapVector<Attribute, std::pair<StringRef, Optional<int>>>
+ &attrToAlias,
+ llvm::MapVector<Type, std::pair<StringRef, Optional<int>>>
+ &typeToAlias);
+
+ private:
+ void visit(Attribute attr);
+ void visit(Type type);
+
+ /// Try to generate an alias for the provided symbol. If an alias is
+ /// generated, the provided alias mapping and reverse mapping are updated.
+ template <typename T>
+ void
+ generateAlias(T symbol,
+ llvm::MapVector<StringRef, std::vector<T>> &aliasToSymbol);
+
+ /// The set of asm interfaces within the context.
+ DialectInterfaceCollection<OpAsmDialectInterface> &interfaces;
+
+ /// Mapping between an alias and the set of symbols mapped to it.
+ llvm::MapVector<StringRef, std::vector<Attribute>> aliasToAttr;
+ llvm::MapVector<StringRef, std::vector<Type>> aliasToType;
+
+ /// An allocator used for alias names.
+ llvm::BumpPtrAllocator &aliasAllocator;
+
+ /// The set of visited attributes.
+ DenseSet<Attribute> visitedAttributes;
+
+ /// The set of visited types.
+ DenseSet<Type> visitedTypes;
+
+ /// Storage and stream used when generating an alias.
+ SmallString<32> aliasBuffer;
+ llvm::raw_svector_ostream aliasOS;
+ };
/// Mapping between attribute and a pair comprised of a base alias name and a
- /// count suffix. If the suffix is set to -1, it is not displayed.
- llvm::MapVector<Attribute, std::pair<StringRef, int>> attrToAlias;
-
- /// Mapping between attribute kind and a pair comprised of a base alias name
- /// and a unique list of attributes belonging to this kind sorted by location
- /// seen in the module.
- llvm::MapVector<TypeID, std::pair<StringRef, std::vector<Attribute>>>
- attrKindToAlias;
-
- /// Set of types known to be used within the module.
- llvm::SetVector<Type> usedTypes;
+ /// count suffix. If the suffix is set to None, it is not displayed.
+ llvm::MapVector<Attribute, std::pair<StringRef, Optional<int>>> attrToAlias;
+ llvm::MapVector<Type, std::pair<StringRef, Optional<int>>> typeToAlias;
- /// A mapping between a type and a given alias.
- DenseMap<Type, StringRef> typeToAlias;
+ /// An allocator used for alias names.
+ llvm::BumpPtrAllocator aliasAllocator;
};
} // end anonymous namespace
-// Utility to generate a function to register a symbol alias.
-static bool canRegisterAlias(StringRef name, llvm::StringSet<> &usedAliases) {
- assert(!name.empty() && "expected alias name to be non-empty");
- // TODO: Assert that the provided alias name can be lexed as
- // an identifier.
-
- // Check that the alias doesn't contain a '.' character and the name is not
- // already in use.
- return !name.contains('.') && usedAliases.insert(name).second;
-}
-
-void AliasState::initialize(
- Operation *op,
- DialectInterfaceCollection<OpAsmDialectInterface> &interfaces) {
- // Track the identifiers in use for each symbol so that the same identifier
- // isn't used twice.
- llvm::StringSet<> usedAliases;
-
- // Collect the set of aliases from each dialect.
- SmallVector<std::pair<TypeID, StringRef>, 8> attributeKindAliases;
- SmallVector<std::pair<Attribute, StringRef>, 8> attributeAliases;
- SmallVector<std::pair<Type, StringRef>, 16> typeAliases;
+/// Sanitize the given name such that it can be used as a valid identifier. If
+/// the string needs to be modified in any way, the provided buffer is used to
+/// store the new copy,
+static StringRef sanitizeIdentifier(StringRef name, SmallString<16> &buffer,
+ StringRef allowedPunctChars = "$._-",
+ bool allowTrailingDigit = true) {
+ assert(!name.empty() && "Shouldn't have an empty name here");
- // AffineMap/Integer set have specific kind aliases.
- attributeKindAliases.emplace_back(AffineMapAttr::getTypeID(), "map");
- attributeKindAliases.emplace_back(IntegerSetAttr::getTypeID(), "set");
+ auto copyNameToBuffer = [&] {
+ for (char ch : name) {
+ if (llvm::isAlnum(ch) || allowedPunctChars.contains(ch))
+ buffer.push_back(ch);
+ else if (ch == ' ')
+ buffer.push_back('_');
+ else
+ buffer.append(llvm::utohexstr((unsigned char)ch));
+ }
+ };
- for (auto &interface : interfaces) {
- interface.getAttributeKindAliases(attributeKindAliases);
- interface.getAttributeAliases(attributeAliases);
- interface.getTypeAliases(typeAliases);
+ // Check to see if this name is valid. If it starts with a digit, then it
+ // could conflict with the autogenerated numeric ID's, so add an underscore
+ // prefix to avoid problems.
+ if (isdigit(name[0])) {
+ buffer.push_back('_');
+ copyNameToBuffer();
+ return buffer;
}
- // Setup the attribute kind aliases.
- StringRef alias;
- TypeID attrKind;
- for (auto &attrAliasPair : attributeKindAliases) {
- std::tie(attrKind, alias) = attrAliasPair;
- assert(!alias.empty() && "expected non-empty alias string");
- if (!usedAliases.count(alias) && !alias.contains('.'))
- attrKindToAlias.insert({attrKind, {alias, {}}});
+ // If the name ends with a trailing digit, add a '_' to avoid potential
+ // conflicts with autogenerated ID's.
+ if (!allowTrailingDigit && isdigit(name.back())) {
+ copyNameToBuffer();
+ buffer.push_back('_');
+ return buffer;
}
- // Clear the set of used identifiers so that the attribute kind aliases are
- // just a prefix and not the full alias, i.e. there may be some overlap.
- usedAliases.clear();
-
- // Register the attribute aliases.
- // Create a regex for the attribute kind alias names, these have a prefix with
- // a counter appended to the end. We prevent normal aliases from having these
- // names to avoid collisions.
- llvm::Regex reservedAttrNames("[0-9]+$");
-
- // Attribute value aliases.
- Attribute attr;
- for (auto &attrAliasPair : attributeAliases) {
- std::tie(attr, alias) = attrAliasPair;
- if (!reservedAttrNames.match(alias) && canRegisterAlias(alias, usedAliases))
- attrToAlias.insert({attr, {alias, NonAttrKindAlias}});
+ // Check to see that the name consists of only valid identifier characters.
+ for (char ch : name) {
+ if (!llvm::isAlnum(ch) && !allowedPunctChars.contains(ch)) {
+ copyNameToBuffer();
+ return buffer;
+ }
}
- // Clear the set of used identifiers as types can have the same identifiers as
- // affine structures.
- usedAliases.clear();
-
- // Type aliases.
- for (auto &typeAliasPair : typeAliases)
- if (canRegisterAlias(typeAliasPair.second, usedAliases))
- typeToAlias.insert(typeAliasPair);
-
- // Traverse the given IR to generate the set of used attributes/types.
- op->walk([&](Operation *op) { visitOperation(op); });
-}
-
-/// Return a name used for an attribute alias, or empty if there is no alias.
-Twine AliasState::getAttributeAlias(Attribute attr) const {
- auto alias = attrToAlias.find(attr);
- if (alias == attrToAlias.end())
- return Twine();
-
- // Return the alias for this attribute, along with the index if this was
- // generated by a kind alias.
- int kindIndex = alias->second.second;
- return alias->second.first +
- (kindIndex == NonAttrKindAlias ? Twine() : Twine(kindIndex));
+ // If there are no invalid characters, return the original name.
+ return name;
}
-/// Print all of the referenced attribute aliases.
-void AliasState::printAttributeAliases(raw_ostream &os,
- NewLineCounter &newLine) const {
- auto printAlias = [&](StringRef alias, Attribute attr, int index) {
- os << '#' << alias;
- if (index != NonAttrKindAlias)
- os << index;
- os << " = " << attr << newLine;
- };
-
- // Print all of the attribute kind aliases.
- for (auto &kindAlias : attrKindToAlias) {
- auto &aliasAttrsPair = kindAlias.second;
- for (unsigned i = 0, e = aliasAttrsPair.second.size(); i != e; ++i)
- printAlias(aliasAttrsPair.first, aliasAttrsPair.second[i], i);
- os << newLine;
- }
-
- // In a second pass print all of the remaining attribute aliases that aren't
- // kind aliases.
- for (Attribute attr : usedAttributes) {
- auto alias = attrToAlias.find(attr);
- if (alias != attrToAlias.end() && alias->second.second == NonAttrKindAlias)
- printAlias(alias->second.first, attr, alias->second.second);
+/// Given a collection of aliases and symbols, initialize a mapping from a
+/// symbol to a given alias.
+template <typename T>
+static void initializeAliases(
+ llvm::MapVector<StringRef, std::vector<T>> &aliasToSymbol,
+ llvm::MapVector<T, std::pair<StringRef, Optional<int>>> &symbolToAlias) {
+ std::vector<std::pair<StringRef, std::vector<T>>> aliases =
+ aliasToSymbol.takeVector();
+ llvm::array_pod_sort(aliases.begin(), aliases.end(),
+ [](const auto *lhs, const auto *rhs) {
+ return lhs->first.compare(rhs->first);
+ });
+
+ for (auto &it : aliases) {
+ // If there is only one instance for this alias, use the name directly.
+ if (it.second.size() == 1) {
+ symbolToAlias.insert({it.second.front(), {it.first, llvm::None}});
+ continue;
+ }
+ // Otherwise, add the index to the name.
+ for (auto &symbolIt : llvm::enumerate(it.second))
+ symbolToAlias.insert({symbolIt.value(), {it.first, symbolIt.index()}});
}
}
-/// Return a string to use as an alias for the given type, or empty if there
-/// is no alias recorded.
-StringRef AliasState::getTypeAlias(Type ty) const {
- return typeToAlias.lookup(ty);
-}
+void AliasState::AliasInitializer::initialize(
+ Operation *op,
+ llvm::MapVector<Attribute, std::pair<StringRef, Optional<int>>>
+ &attrToAlias,
+ llvm::MapVector<Type, std::pair<StringRef, Optional<int>>> &typeToAlias) {
+ op->walk([&](Operation *op) {
+ // Visit all the types used in the operation.
+ for (auto type : op->getOperandTypes())
+ visit(type);
+ for (auto type : op->getResultTypes())
+ visit(type);
+ for (auto ®ion : op->getRegions())
+ for (auto &block : region)
+ for (auto arg : block.getArguments())
+ visit(arg.getType());
+
+ // Visit each of the attributes.
+ for (auto elt : op->getAttrs())
+ visit(elt.second);
+ });
-/// Print all of the referenced type aliases.
-void AliasState::printTypeAliases(raw_ostream &os,
- NewLineCounter &newLine) const {
- for (Type type : usedTypes) {
- auto alias = typeToAlias.find(type);
- if (alias != typeToAlias.end())
- os << '!' << alias->second << " = type " << type << newLine;
- }
+ // Initialize the aliases sorted by name.
+ initializeAliases(aliasToAttr, attrToAlias);
+ initializeAliases(aliasToType, typeToAlias);
}
-/// Record a reference to the given attribute.
-void AliasState::recordAttributeReference(Attribute attr) {
- // Don't recheck attributes that have already been seen or those that
- // already have an alias.
- if (!usedAttributes.insert(attr) || attrToAlias.count(attr))
+void AliasState::AliasInitializer::visit(Attribute attr) {
+ if (!visitedAttributes.insert(attr).second)
return;
- // If this attribute kind has an alias, then record one for this attribute.
- auto alias = attrKindToAlias.find(attr.getTypeID());
- if (alias == attrKindToAlias.end())
- return;
- std::pair<StringRef, int> attrAlias(alias->second.first,
- alias->second.second.size());
- attrToAlias.insert({attr, attrAlias});
- alias->second.second.push_back(attr);
-}
+ if (auto arrayAttr = attr.dyn_cast<ArrayAttr>()) {
+ for (Attribute element : arrayAttr.getValue())
+ visit(element);
+ } else if (auto typeAttr = attr.dyn_cast<TypeAttr>()) {
+ visit(typeAttr.getValue());
+ }
-/// Record a reference to the given type.
-void AliasState::recordTypeReference(Type ty) { usedTypes.insert(ty); }
+ // Try to generate an alias for this attribute.
+ generateAlias(attr, aliasToAttr);
+}
-// TODO: Support visiting other types/operations when implemented.
-void AliasState::visitType(Type type) {
- recordTypeReference(type);
+void AliasState::AliasInitializer::visit(Type type) {
+ if (!visitedTypes.insert(type).second)
+ return;
+ // Visit several subtypes that contain types or atttributes.
if (auto funcType = type.dyn_cast<FunctionType>()) {
// Visit input and result types for functions.
for (auto input : funcType.getInputs())
- visitType(input);
+ visit(input);
for (auto result : funcType.getResults())
- visitType(result);
+ visit(result);
} else if (auto shapedType = type.dyn_cast<ShapedType>()) {
- visitType(shapedType.getElementType());
+ visit(shapedType.getElementType());
// Visit affine maps in memref type.
if (auto memref = type.dyn_cast<MemRefType>())
for (auto map : memref.getAffineMaps())
- recordAttributeReference(AffineMapAttr::get(map));
+ visit(AffineMapAttr::get(map));
}
+
+ // Try to generate an alias for this type.
+ generateAlias(type, aliasToType);
}
-void AliasState::visitAttribute(Attribute attr) {
- recordAttributeReference(attr);
+template <typename T>
+void AliasState::AliasInitializer::generateAlias(
+ T symbol, llvm::MapVector<StringRef, std::vector<T>> &aliasToSymbol) {
+ SmallString<16> tempBuffer;
+ for (const auto &interface : interfaces) {
+ interface.getAlias(symbol, aliasOS);
+ StringRef name = aliasOS.str();
+ if (name.empty())
+ continue;
+ name = sanitizeIdentifier(name, tempBuffer, /*allowedPunctChars=*/"$_-",
+ /*allowTrailingDigit=*/false);
+ name = name.copy(aliasAllocator);
- if (auto arrayAttr = attr.dyn_cast<ArrayAttr>()) {
- for (auto elt : arrayAttr.getValue())
- visitAttribute(elt);
- } else if (auto typeAttr = attr.dyn_cast<TypeAttr>()) {
- visitType(typeAttr.getValue());
+ aliasToSymbol[name].push_back(symbol);
+ aliasBuffer.clear();
+ break;
}
}
-void AliasState::visitOperation(Operation *op) {
- // Visit all the types used in the operation.
- for (auto type : op->getOperandTypes())
- visitType(type);
- for (auto type : op->getResultTypes())
- visitType(type);
- for (auto ®ion : op->getRegions())
- for (auto &block : region)
- for (auto arg : block.getArguments())
- visitType(arg.getType());
+void AliasState::initialize(
+ Operation *op,
+ DialectInterfaceCollection<OpAsmDialectInterface> &interfaces) {
+ AliasInitializer initializer(interfaces, aliasAllocator);
+ initializer.initialize(op, attrToAlias, typeToAlias);
+}
+
+static void printAlias(raw_ostream &os,
+ const std::pair<StringRef, Optional<int>> &alias,
+ char prefix) {
+ os << prefix << alias.first;
+ if (alias.second)
+ os << *alias.second;
+}
+
+LogicalResult AliasState::getAlias(Attribute attr, raw_ostream &os) const {
+ auto it = attrToAlias.find(attr);
+ if (it == attrToAlias.end())
+ return failure();
- // Visit each of the attributes.
- for (auto elt : op->getAttrs())
- visitAttribute(elt.second);
+ printAlias(os, it->second, '#');
+ return success();
+}
+
+void AliasState::printAttributeAliases(raw_ostream &os,
+ NewLineCounter &newLine) const {
+ for (const auto &it : attrToAlias) {
+ printAlias(os, it.second, '#');
+ os << " = " << it.first << newLine;
+ }
+}
+
+LogicalResult AliasState::getAlias(Type ty, raw_ostream &os) const {
+ auto it = typeToAlias.find(ty);
+ if (it == typeToAlias.end())
+ return failure();
+
+ printAlias(os, it->second, '!');
+ return success();
+}
+
+void AliasState::printTypeAliases(raw_ostream &os,
+ NewLineCounter &newLine) const {
+ for (const auto &it : typeToAlias) {
+ printAlias(os, it.second, '!');
+ os << " = " << it.first << newLine;
+ }
}
//===----------------------------------------------------------------------===//
valueNames[value] = uniqueValueName(name);
}
-/// Returns true if 'c' is an allowable punctuation character: [$._-]
-/// Returns false otherwise.
-static bool isPunct(char c) {
- return c == '$' || c == '.' || c == '_' || c == '-';
-}
-
StringRef SSANameState::uniqueValueName(StringRef name) {
- assert(!name.empty() && "Shouldn't have an empty name here");
-
- // Check to see if this name is valid. If it starts with a digit, then it
- // could conflict with the autogenerated numeric ID's (we unique them in a
- // different map), so add an underscore prefix to avoid problems.
- if (isdigit(name[0])) {
- SmallString<16> tmpName("_");
- tmpName += name;
- return uniqueValueName(tmpName);
- }
-
- // Check to see if the name consists of all-valid identifiers. If not, we
- // need to escape them.
- for (char ch : name) {
- if (isalpha(ch) || isPunct(ch) || isdigit(ch))
- continue;
-
- SmallString<16> tmpName;
- for (char ch : name) {
- if (isalpha(ch) || isPunct(ch) || isdigit(ch))
- tmpName += ch;
- else if (ch == ' ')
- tmpName += '_';
- else {
- tmpName += llvm::utohexstr((unsigned char)ch);
- }
- }
- return uniqueValueName(tmpName);
- }
+ SmallString<16> tmpBuffer;
+ name = sanitizeIdentifier(name, tmpBuffer);
// Check to see if this name is already unique.
if (!usedNames.count(name)) {
SmallString<64> probeName(name);
probeName.push_back('_');
while (true) {
- probeName.resize(name.size() + 1);
probeName += llvm::utostr(nextConflictID++);
if (!usedNames.count(probeName)) {
name = StringRef(probeName).copy(usedNameAllocator);
break;
}
+ probeName.resize(name.size() + 1);
}
}
return;
}
- // Check for an alias for this attribute.
- if (state) {
- Twine alias = state->getAliasState().getAttributeAlias(attr);
- if (!alias.isTriviallyEmpty()) {
- os << '#' << alias;
- return;
- }
- }
+ // Try to print an alias for this attribute.
+ if (state && succeeded(state->getAliasState().getAlias(attr, os)))
+ return;
auto attrType = attr.getType();
if (auto opaqueAttr = attr.dyn_cast<OpaqueAttr>()) {
return;
}
- // Check for an alias for this type.
- if (state) {
- StringRef alias = state->getAliasState().getTypeAlias(type);
- if (!alias.empty()) {
- os << '!' << alias;
- return;
- }
- }
+ // Try to print an alias for this type.
+ if (state && succeeded(state->getAliasState().getAlias(type, os)))
+ return;
TypeSwitch<Type>(type)
.Case<OpaqueType>([&](OpaqueType opaqueTy) {
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: %1 = affine.apply #map{{[0-9]+}}(%arg0)
- // CHECK-NEXT: affine.if #set0(%arg0, %1) {
+ // CHECK-NEXT: affine.if #set(%arg0, %1) {
// CHECK-NEXT: %2 = addf %cst, %cst : f32
// CHECK-NEXT: affine.store %2, %0[%arg0] : memref<10xf32>
// CHECK-NEXT: }
// CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
- // CHECK-NEXT: affine.if #set0(%arg0, %arg0) {
+ // CHECK-NEXT: affine.if #set(%arg0, %arg0) {
// CHECK-NEXT: %1 = addf %cst, %cst : f32
// CHECK-NEXT: affine.store %1, %0[%arg0] : memref<10xf32>
// CHECK-NEXT: }
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: affine.for %arg1 = 0 to 10 {
- // CHECK-NEXT: affine.if #set0(%arg0, %arg0) {
+ // CHECK-NEXT: affine.if #set(%arg0, %arg0) {
// CHECK-NEXT: %1 = addf %cst, %cst : f32
// CHECK-NEXT: affine.store %1, %0[%arg1] : memref<10xf32>
// CHECK-NEXT: }
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: affine.for %arg1 = 0 to 10 {
- // CHECK-NEXT: affine.if #set0(%arg0, %arg0) {
+ // CHECK-NEXT: affine.if #set(%arg0, %arg0) {
// CHECK-NEXT: %1 = addf %cst, %cst : f32
// CHECK-NEXT: affine.store %1, %0[%arg0] : memref<10xf32>
- // CHECK-NEXT: affine.if #set0(%arg0, %arg0) {
+ // CHECK-NEXT: affine.if #set(%arg0, %arg0) {
// CHECK-NEXT: affine.store %1, %0[%arg1] : memref<10xf32>
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: affine.for %arg1 = 0 to 10 {
- // CHECK-NEXT: affine.if #set0(%arg0, %arg0) {
+ // CHECK-NEXT: affine.if #set(%arg0, %arg0) {
// CHECK-NEXT: %1 = addf %cst, %cst : f32
// CHECK-NEXT: affine.store %1, %0[%arg0] : memref<10xf32>
- // CHECK-NEXT: affine.if #set0(%arg0, %arg0) {
+ // CHECK-NEXT: affine.if #set(%arg0, %arg0) {
// CHECK-NEXT: affine.store %1, %0[%arg0] : memref<10xf32>
// CHECK-NEXT: } else {
// CHECK-NEXT: affine.store %1, %0[%arg1] : memref<10xf32>
// CHECK-NEXT: %1 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
- // CHECK-NEXT: affine.if #set0(%arg0, %arg0) {
+ // CHECK-NEXT: affine.if #set(%arg0, %arg0) {
// CHECK-NEXT: %2 = addf %cst, %cst : f32
// CHECK-NEXT: %3 = affine.load %0[%arg0] : memref<10xf32>
- // CHECK-NEXT: affine.if #set0(%arg0, %arg0) {
+ // CHECK-NEXT: affine.if #set(%arg0, %arg0) {
// CHECK-NEXT: affine.store %2, %1[%arg0] : memref<10xf32>
// CHECK-NEXT: } else {
// CHECK-NEXT: %4 = affine.load %0[%arg0] : memref<10xf32>
// CHECK: %0 = alloc() : memref<10xf32>
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
- // CHECK-NEXT: affine.if #set0(%arg0, %arg0) {
+ // CHECK-NEXT: affine.if #set(%arg0, %arg0) {
// CHECK-NEXT: %1 = addf %cst, %cst : f32
// CHECK-NEXT: %2 = affine.load %0[%arg0] : memref<10xf32>
- // CHECK-NEXT: affine.if #set0(%arg0, %arg0) {
+ // CHECK-NEXT: affine.if #set(%arg0, %arg0) {
// CHECK-NEXT: %3 = affine.load %0[%arg0] : memref<10xf32>
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: %cst = constant 8.000000e+00 : f32
// CHECK-NEXT: affine.for %arg0 = 0 to 10 {
// CHECK-NEXT: affine.for %arg1 = 0 to 10 {
- // CHECK-NEXT: affine.if #set0(%arg0, %arg0) {
+ // CHECK-NEXT: affine.if #set(%arg0, %arg0) {
// CHECK-NEXT: %1 = addf %cst, %cst : f32
// CHECK-NEXT: affine.store %1, %0[%arg0] : memref<10xf32>
// CHECK-NEXT: affine.for %arg2 = 0 to 10 {