[flang-commits] [flang] c8496d2 - [mlir] Refactor alias generation to support nested aliases

River Riddle via flang-commits flang-commits at lists.llvm.org
Mon Oct 24 00:00:13 PDT 2022


Author: River Riddle
Date: 2022-10-23T23:59:55-07:00
New Revision: c8496d292e0ae4ba60b3905de884c83d66387e7e

URL: https://github.com/llvm/llvm-project/commit/c8496d292e0ae4ba60b3905de884c83d66387e7e
DIFF: https://github.com/llvm/llvm-project/commit/c8496d292e0ae4ba60b3905de884c83d66387e7e.diff

LOG: [mlir] Refactor alias generation to support nested aliases

We currently only support one level of aliases, which isn't great
in situations where an attribute/type can have multiple duplicated
components nested within it(e.g. debuginfo metadata). This commit
refactors alias generation to support nested aliases, which requires
changing alias grouping to take into account the depth of child
aliases, to ensure that attributes/types aren't printed before the
aliases they use.

The only real user facing change here was that we no longer print
0 as an alias suffix, which would be unnecessarily expensive to keep
in the new alias generation method (and isn't that valuable of a
behavior to preserve).

Differential Revision: https://reviews.llvm.org/D136541

Added: 
    

Modified: 
    flang/test/Fir/affine-promotion.fir
    mlir/lib/IR/AsmPrinter.cpp
    mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-resize.mlir
    mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir
    mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir
    mlir/test/Dialect/Affine/SuperVectorize/vectorize_2d.mlir
    mlir/test/Dialect/Affine/affine-data-copy.mlir
    mlir/test/Dialect/Affine/affine-loop-normalize.mlir
    mlir/test/Dialect/Affine/dma-generate.mlir
    mlir/test/Dialect/Affine/loop-tiling-parametric.mlir
    mlir/test/Dialect/Affine/loop-tiling-validity.mlir
    mlir/test/Dialect/Affine/loop-tiling.mlir
    mlir/test/Dialect/Affine/ops.mlir
    mlir/test/Dialect/Affine/scalrep.mlir
    mlir/test/Dialect/Affine/unroll-jam.mlir
    mlir/test/Dialect/Affine/unroll.mlir
    mlir/test/Dialect/Linalg/bubble-up-extract-slice-op.mlir
    mlir/test/Dialect/Linalg/tile-to-foreach-thread.mlir
    mlir/test/Dialect/MemRef/subview.mlir
    mlir/test/Dialect/SCF/parallel-loop-specialization.mlir
    mlir/test/Dialect/Vector/vector-transforms.mlir
    mlir/test/IR/affine-map.mlir
    mlir/test/IR/affine-set.mlir
    mlir/test/IR/core-ops.mlir
    mlir/test/IR/parser.mlir
    mlir/test/IR/print-attr-type-aliases.mlir
    mlir/test/Transforms/loop-fusion-2.mlir
    mlir/test/Transforms/loop-fusion.mlir
    mlir/test/Transforms/pipeline-data-transfer.mlir

Removed: 
    


################################################################################
diff  --git a/flang/test/Fir/affine-promotion.fir b/flang/test/Fir/affine-promotion.fir
index 9009cbb723982..4879e51a44512 100644
--- a/flang/test/Fir/affine-promotion.fir
+++ b/flang/test/Fir/affine-promotion.fir
@@ -50,7 +50,7 @@ func.func @loop_with_load_and_store(%a1: !arr_d1, %a2: !arr_d1, %a3: !arr_d1) {
 // CHECK:    %[[VAL_3:.*]] = arith.constant 1 : index
 // CHECK:    %[[VAL_4:.*]] = arith.constant 100 : index
 // CHECK:    %[[VAL_5:.*]] = fir.shape %[[VAL_4]] : (index) -> !fir.shape<1>
-// CHECK:    %[[VAL_6:.*]] = affine.apply #map0(){{\[}}%[[VAL_3]], %[[VAL_4]]]
+// CHECK:    %[[VAL_6:.*]] = affine.apply #map(){{\[}}%[[VAL_3]], %[[VAL_4]]]
 // CHECK:    %[[VAL_7:.*]] = fir.alloca !fir.array<?xf32>, %[[VAL_6]]
 // CHECK:    %[[VAL_8:.*]] = fir.convert %[[VAL_0]] : (!fir.ref<!fir.array<?xf32>>) -> memref<?xf32>
 // CHECK:    %[[VAL_9:.*]] = fir.convert %[[VAL_1]] : (!fir.ref<!fir.array<?xf32>>) -> memref<?xf32>
@@ -114,15 +114,15 @@ func.func @loop_with_if(%a: !arr_d1, %v: f32) {
 // CHECK:   %[[VAL_5:.*]] = arith.constant 100 : index
 // CHECK:   %[[VAL_6:.*]] = fir.shape %[[VAL_5]] : (index) -> !fir.shape<1>
 // CHECK:   %[[VAL_7:.*]] = fir.convert %[[VAL_0]] : (!fir.ref<!fir.array<?xf32>>) -> memref<?xf32>
-// CHECK:   affine.for %[[VAL_8:.*]] = %[[VAL_3]] to #map0(){{\[}}%[[VAL_5]]] {
+// CHECK:   affine.for %[[VAL_8:.*]] = %[[VAL_3]] to #map(){{\[}}%[[VAL_5]]] {
 // CHECK:     %[[VAL_9:.*]] = affine.apply #map1(%[[VAL_8]]){{\[}}%[[VAL_3]], %[[VAL_5]], %[[VAL_3]]]
 // CHECK:     affine.store %[[VAL_1]], %[[VAL_7]]{{\[}}%[[VAL_9]]] : memref<?xf32>
 // CHECK:   }
-// CHECK:   affine.for %[[VAL_10:.*]] = %[[VAL_3]] to #map0(){{\[}}%[[VAL_5]]] {
+// CHECK:   affine.for %[[VAL_10:.*]] = %[[VAL_3]] to #map(){{\[}}%[[VAL_5]]] {
 // CHECK:     %[[VAL_11:.*]] = affine.apply #map1(%[[VAL_10]]){{\[}}%[[VAL_3]], %[[VAL_5]], %[[VAL_3]]]
 // CHECK:     affine.store %[[VAL_1]], %[[VAL_7]]{{\[}}%[[VAL_11]]] : memref<?xf32>
 // CHECK:   }
-// CHECK:   affine.for %[[VAL_12:.*]] = %[[VAL_3]] to #map0(){{\[}}%[[VAL_5]]] {
+// CHECK:   affine.for %[[VAL_12:.*]] = %[[VAL_3]] to #map(){{\[}}%[[VAL_5]]] {
 // CHECK:     %[[VAL_13:.*]] = arith.subi %[[VAL_12]], %[[VAL_4]] : index
 // CHECK:     affine.if #set(%[[VAL_12]]) {
 // CHECK:       %[[VAL_14:.*]] = affine.apply #map1(%[[VAL_12]]){{\[}}%[[VAL_3]], %[[VAL_5]], %[[VAL_3]]]

diff  --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp
index b2de0b3e4d7fc..676f8133a8771 100644
--- a/mlir/lib/IR/AsmPrinter.cpp
+++ b/mlir/lib/IR/AsmPrinter.cpp
@@ -317,6 +317,129 @@ static raw_ostream &operator<<(raw_ostream &os, NewLineCounter &newLine) {
 }
 } // namespace
 
+//===----------------------------------------------------------------------===//
+// AsmPrinter::Impl
+//===----------------------------------------------------------------------===//
+
+namespace mlir {
+class AsmPrinter::Impl {
+public:
+  Impl(raw_ostream &os, AsmStateImpl &state);
+  explicit Impl(Impl &other) : Impl(other.os, other.state) {}
+
+  /// Returns the output stream of the printer.
+  raw_ostream &getStream() { return os; }
+
+  template <typename Container, typename UnaryFunctor>
+  inline void interleaveComma(const Container &c, UnaryFunctor eachFn) const {
+    llvm::interleaveComma(c, os, eachFn);
+  }
+
+  /// This enum describes the 
diff erent kinds of elision for the type of an
+  /// attribute when printing it.
+  enum class AttrTypeElision {
+    /// The type must not be elided,
+    Never,
+    /// The type may be elided when it matches the default used in the parser
+    /// (for example i64 is the default for integer attributes).
+    May,
+    /// The type must be elided.
+    Must
+  };
+
+  /// Print the given attribute or an alias.
+  void printAttribute(Attribute attr,
+                      AttrTypeElision typeElision = AttrTypeElision::Never);
+  /// Print the given attribute without considering an alias.
+  void printAttributeImpl(Attribute attr,
+                          AttrTypeElision typeElision = AttrTypeElision::Never);
+
+  /// Print the alias for the given attribute, return failure if no alias could
+  /// be printed.
+  LogicalResult printAlias(Attribute attr);
+
+  /// Print the given type or an alias.
+  void printType(Type type);
+  /// Print the given type.
+  void printTypeImpl(Type type);
+
+  /// Print the alias for the given type, return failure if no alias could
+  /// be printed.
+  LogicalResult printAlias(Type type);
+
+  /// Print the given location to the stream. If `allowAlias` is true, this
+  /// allows for the internal location to use an attribute alias.
+  void printLocation(LocationAttr loc, bool allowAlias = false);
+
+  /// Print a reference to the given resource that is owned by the given
+  /// dialect.
+  void printResourceHandle(const AsmDialectResourceHandle &resource);
+
+  void printAffineMap(AffineMap map);
+  void
+  printAffineExpr(AffineExpr expr,
+                  function_ref<void(unsigned, bool)> printValueName = nullptr);
+  void printAffineConstraint(AffineExpr expr, bool isEq);
+  void printIntegerSet(IntegerSet set);
+
+protected:
+  void printOptionalAttrDict(ArrayRef<NamedAttribute> attrs,
+                             ArrayRef<StringRef> elidedAttrs = {},
+                             bool withKeyword = false);
+  void printNamedAttribute(NamedAttribute attr);
+  void printTrailingLocation(Location loc, bool allowAlias = true);
+  void printLocationInternal(LocationAttr loc, bool pretty = false);
+
+  /// Print a dense elements attribute. If 'allowHex' is true, a hex string is
+  /// used instead of individual elements when the elements attr is large.
+  void printDenseElementsAttr(DenseElementsAttr attr, bool allowHex);
+
+  /// Print a dense string elements attribute.
+  void printDenseStringElementsAttr(DenseStringElementsAttr attr);
+
+  /// Print a dense elements attribute. If 'allowHex' is true, a hex string is
+  /// used instead of individual elements when the elements attr is large.
+  void printDenseIntOrFPElementsAttr(DenseIntOrFPElementsAttr attr,
+                                     bool allowHex);
+
+  /// Print a dense array attribute.
+  void printDenseArrayAttr(DenseArrayAttr attr);
+
+  void printDialectAttribute(Attribute attr);
+  void printDialectType(Type type);
+
+  /// Print an escaped string, wrapped with "".
+  void printEscapedString(StringRef str);
+
+  /// Print a hex string, wrapped with "".
+  void printHexString(StringRef str);
+  void printHexString(ArrayRef<char> data);
+
+  /// This enum is used to represent the binding strength of the enclosing
+  /// context that an AffineExprStorage is being printed in, so we can
+  /// intelligently produce parens.
+  enum class BindingStrength {
+    Weak,   // + and -
+    Strong, // All other binary operators.
+  };
+  void printAffineExprInternal(
+      AffineExpr expr, BindingStrength enclosingTightness,
+      function_ref<void(unsigned, bool)> printValueName = nullptr);
+
+  /// The output stream for the printer.
+  raw_ostream &os;
+
+  /// An underlying assembly printer state.
+  AsmStateImpl &state;
+
+  /// A set of flags to control the printer's behavior.
+  OpPrintingFlags printerFlags;
+
+  /// A tracker for the number of new lines emitted during printing.
+  NewLineCounter newLine;
+};
+} // namespace mlir
+
 //===----------------------------------------------------------------------===//
 // AliasInitializer
 //===----------------------------------------------------------------------===//
@@ -325,17 +448,13 @@ namespace {
 /// This class represents a specific instance of a symbol Alias.
 class SymbolAlias {
 public:
-  SymbolAlias(StringRef name, bool isDeferrable)
-      : name(name), suffixIndex(0), hasSuffixIndex(false),
-        isDeferrable(isDeferrable) {}
   SymbolAlias(StringRef name, uint32_t suffixIndex, bool isDeferrable)
-      : name(name), suffixIndex(suffixIndex), hasSuffixIndex(true),
-        isDeferrable(isDeferrable) {}
+      : name(name), suffixIndex(suffixIndex), isDeferrable(isDeferrable) {}
 
   /// Print this alias to the given stream.
   void print(raw_ostream &os) const {
     os << name;
-    if (hasSuffixIndex)
+    if (suffixIndex)
       os << suffixIndex;
   }
 
@@ -345,11 +464,8 @@ class SymbolAlias {
 private:
   /// The main name of the alias.
   StringRef name;
-  /// The optional suffix index of the alias, if multiple aliases had the same
-  /// name.
-  uint32_t suffixIndex : 30;
-  /// A flag indicating whether this alias has a suffix or not.
-  bool hasSuffixIndex : 1;
+  /// The suffix index of the alias.
+  uint32_t suffixIndex : 31;
   /// A flag indicating whether this alias may be deferred or not.
   bool isDeferrable : 1;
 };
@@ -372,38 +488,68 @@ class AliasInitializer {
   /// Visit the given attribute to see if it has an alias. `canBeDeferred` is
   /// set to true if the originator of this attribute can resolve the alias
   /// after parsing has completed (e.g. in the case of operation locations).
-  void visit(Attribute attr, bool canBeDeferred = false);
+  /// Returns the maximum alias depth of the attribute.
+  size_t visit(Attribute attr, bool canBeDeferred = false) {
+    return visitImpl(attr, attrAliases, canBeDeferred);
+  }
 
-  /// Visit the given type to see if it has an alias.
-  void visit(Type type);
+  /// Visit the given type to see if it has an alias. Returns the maximum alias
+  /// depth of the type.
+  size_t visit(Type type) { return visitImpl(type, typeAliases); }
 
 private:
+  struct InProgressAliasInfo {
+    InProgressAliasInfo() : aliasDepth(0), canBeDeferred(false) {}
+    InProgressAliasInfo(StringRef alias, bool canBeDeferred)
+        : alias(alias), aliasDepth(0), canBeDeferred(canBeDeferred) {}
+
+    bool operator<(const InProgressAliasInfo &rhs) const {
+      // Order first by depth, and then by name.
+      if (aliasDepth != rhs.aliasDepth)
+        return aliasDepth < rhs.aliasDepth;
+      return alias < rhs.alias;
+    }
+
+    /// The alias for the attribute or type, or None if the value has no alias.
+    Optional<StringRef> alias;
+    /// The alias depth of this attribute or type, i.e. an indication of the
+    /// relative ordering of when to print this alias.
+    unsigned aliasDepth : 31;
+    /// If this alias can be deferred or not.
+    bool canBeDeferred : 1;
+  };
+
+  /// Visit the given attribute or type to see if it has an alias.
+  /// `canBeDeferred` is set to true if the originator of this value can resolve
+  /// the alias after parsing has completed (e.g. in the case of operation
+  /// locations). Returns the maximum alias depth of the value.
+  template <typename T>
+  size_t visitImpl(T value, llvm::MapVector<T, InProgressAliasInfo> &aliases,
+                   bool canBeDeferred = false);
+
   /// Try to generate an alias for the provided symbol. If an alias is
   /// generated, the provided alias mapping and reverse mapping are updated.
   /// Returns success if an alias was generated, failure otherwise.
   template <typename T>
-  LogicalResult
-  generateAlias(T symbol,
-                llvm::MapVector<StringRef, std::vector<T>> &aliasToSymbol);
+  LogicalResult generateAlias(T symbol, InProgressAliasInfo &alias,
+                              bool canBeDeferred);
+
+  /// 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<T, InProgressAliasInfo> &visitedSymbols,
+                    llvm::MapVector<T, SymbolAlias> &symbolToAlias);
 
   /// 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 attributes that have aliases *and* can be deferred.
-  DenseSet<Attribute> deferrableAttributes;
-
-  /// The set of visited types.
-  DenseSet<Type> visitedTypes;
+  /// The set of built aliases.
+  llvm::MapVector<Attribute, InProgressAliasInfo> attrAliases;
+  llvm::MapVector<Type, InProgressAliasInfo> typeAliases;
 
   /// Storage and stream used when generating an alias.
   SmallString<32> aliasBuffer;
@@ -645,31 +791,23 @@ static StringRef sanitizeIdentifier(StringRef name, SmallString<16> &buffer,
 /// 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, SymbolAlias> &symbolToAlias,
-                  DenseSet<T> *deferrableAliases = nullptr) {
-  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) {
-      T symbol = it.second.front();
-      bool isDeferrable = deferrableAliases && deferrableAliases->count(symbol);
-      symbolToAlias.insert({symbol, SymbolAlias(it.first, isDeferrable)});
+void AliasInitializer::initializeAliases(
+    llvm::MapVector<T, InProgressAliasInfo> &visitedSymbols,
+    llvm::MapVector<T, SymbolAlias> &symbolToAlias) {
+  std::vector<std::pair<T, InProgressAliasInfo>> unprocessedAliases =
+      visitedSymbols.takeVector();
+  llvm::stable_sort(unprocessedAliases, [](const auto &lhs, const auto &rhs) {
+    return lhs.second < rhs.second;
+  });
+
+  llvm::StringMap<unsigned> nameCounts;
+  for (auto &[symbol, aliasInfo] : unprocessedAliases) {
+    if (!aliasInfo.alias)
       continue;
-    }
-    // Otherwise, add the index to the name.
-    for (int i = 0, e = it.second.size(); i < e; ++i) {
-      T symbol = it.second[i];
-      bool isDeferrable = deferrableAliases && deferrableAliases->count(symbol);
-      symbolToAlias.insert({symbol, SymbolAlias(it.first, i, isDeferrable)});
-    }
+    StringRef alias = *aliasInfo.alias;
+    unsigned nameIndex = nameCounts[alias]++;
+    symbolToAlias.insert(
+        {symbol, SymbolAlias(alias, nameIndex, aliasInfo.canBeDeferred)});
   }
 }
 
@@ -684,51 +822,56 @@ void AliasInitializer::initialize(
   aliasPrinter.printCustomOrGenericOp(op);
 
   // Initialize the aliases sorted by name.
-  initializeAliases(aliasToAttr, attrToAlias, &deferrableAttributes);
-  initializeAliases(aliasToType, typeToAlias);
+  initializeAliases(attrAliases, attrToAlias);
+  initializeAliases(typeAliases, typeToAlias);
 }
 
-void AliasInitializer::visit(Attribute attr, bool canBeDeferred) {
-  if (!visitedAttributes.insert(attr).second) {
-    // If this attribute already has an alias and this instance can't be
-    // deferred, make sure that the alias isn't deferred.
+template <typename T>
+size_t
+AliasInitializer::visitImpl(T value,
+                            llvm::MapVector<T, InProgressAliasInfo> &aliases,
+                            bool canBeDeferred) {
+  auto [it, inserted] = aliases.insert({value, InProgressAliasInfo()});
+  if (!inserted) {
+    // Make sure that the alias isn't deferred if we don't permit it.
     if (!canBeDeferred)
-      deferrableAttributes.erase(attr);
-    return;
+      it->second.canBeDeferred = false;
+    return it->second.aliasDepth;
   }
 
   // Try to generate an alias for this attribute.
-  if (succeeded(generateAlias(attr, aliasToAttr))) {
-    if (canBeDeferred)
-      deferrableAttributes.insert(attr);
-    return;
-  }
+  bool hasAlias = succeeded(generateAlias(value, it->second, canBeDeferred));
+  size_t aliasIndex = std::distance(aliases.begin(), it);
 
   // Check for any sub elements.
-  if (auto subElementInterface = attr.dyn_cast<SubElementAttrInterface>()) {
-    subElementInterface.walkSubElements([&](Attribute attr) { visit(attr); },
-                                        [&](Type type) { visit(type); });
-  }
-}
-
-void AliasInitializer::visit(Type type) {
-  if (!visitedTypes.insert(type).second)
-    return;
+  using SubElementInterfaceT =
+      std::conditional_t<std::is_same_v<T, Type>, SubElementTypeInterface,
+                         SubElementAttrInterface>;
+  if (auto subElementInterface = dyn_cast<SubElementInterfaceT>(value)) {
+    size_t maxAliasDepth = 0;
+    auto visitSubElement = [&](auto element) {
+      if (Optional<size_t> depth = visit(element))
+        maxAliasDepth = std::max(maxAliasDepth, *depth + 1);
+    };
+    subElementInterface.walkSubElements(visitSubElement, visitSubElement);
 
-  // Try to generate an alias for this type.
-  if (succeeded(generateAlias(type, aliasToType)))
-    return;
+    // Make sure to recompute `it` in case the map was reallocated.
+    it = std::next(aliases.begin(), aliasIndex);
 
-  // Check for any sub elements.
-  if (auto subElementInterface = type.dyn_cast<SubElementTypeInterface>()) {
-    subElementInterface.walkSubElements([&](Attribute attr) { visit(attr); },
-                                        [&](Type type) { visit(type); });
+    // If we had sub elements and an alias, update our main alias to account for
+    // the depth.
+    if (maxAliasDepth && hasAlias)
+      it->second.aliasDepth = maxAliasDepth;
   }
+
+  // Propagate the alias depth of the value.
+  return it->second.aliasDepth;
 }
 
 template <typename T>
-LogicalResult AliasInitializer::generateAlias(
-    T symbol, llvm::MapVector<StringRef, std::vector<T>> &aliasToSymbol) {
+LogicalResult AliasInitializer::generateAlias(T symbol,
+                                              InProgressAliasInfo &alias,
+                                              bool canBeDeferred) {
   SmallString<32> nameBuffer;
   for (const auto &interface : interfaces) {
     OpAsmDialectInterface::AliasResult result =
@@ -749,7 +892,7 @@ LogicalResult AliasInitializer::generateAlias(
       sanitizeIdentifier(nameBuffer, tempBuffer, /*allowedPunctChars=*/"$_-",
                          /*allowTrailingDigit=*/false);
   name = name.copy(aliasAllocator);
-  aliasToSymbol[name].push_back(symbol);
+  alias = InProgressAliasInfo(name, canBeDeferred);
   return success();
 }
 
@@ -776,20 +919,20 @@ class AliasState {
 
   /// Print all of the referenced aliases that can not be resolved in a deferred
   /// manner.
-  void printNonDeferredAliases(raw_ostream &os, NewLineCounter &newLine) const {
-    printAliases(os, newLine, /*isDeferred=*/false);
+  void printNonDeferredAliases(AsmPrinter::Impl &p, NewLineCounter &newLine) {
+    printAliases(p, newLine, /*isDeferred=*/false);
   }
 
   /// Print all of the referenced aliases that support deferred resolution.
-  void printDeferredAliases(raw_ostream &os, NewLineCounter &newLine) const {
-    printAliases(os, newLine, /*isDeferred=*/true);
+  void printDeferredAliases(AsmPrinter::Impl &p, NewLineCounter &newLine) {
+    printAliases(p, newLine, /*isDeferred=*/true);
   }
 
 private:
   /// Print all of the referenced aliases that support the provided resolution
   /// behavior.
-  void printAliases(raw_ostream &os, NewLineCounter &newLine,
-                    bool isDeferred) const;
+  void printAliases(AsmPrinter::Impl &p, NewLineCounter &newLine,
+                    bool isDeferred);
 
   /// Mapping between attribute and alias.
   llvm::MapVector<Attribute, SymbolAlias> attrToAlias;
@@ -825,18 +968,34 @@ LogicalResult AliasState::getAlias(Type ty, raw_ostream &os) const {
   return success();
 }
 
-void AliasState::printAliases(raw_ostream &os, NewLineCounter &newLine,
-                              bool isDeferred) const {
+void AliasState::printAliases(AsmPrinter::Impl &p, NewLineCounter &newLine,
+                              bool isDeferred) {
   auto filterFn = [=](const auto &aliasIt) {
     return aliasIt.second.canBeDeferred() == isDeferred;
   };
-  for (const auto &it : llvm::make_filter_range(attrToAlias, filterFn)) {
-    it.second.print(os << '#');
-    os << " = " << it.first << newLine;
+  for (auto &[attr, alias] : llvm::make_filter_range(attrToAlias, filterFn)) {
+    alias.print(p.getStream() << '#');
+    p.getStream() << " = ";
+
+    // TODO: Support nested aliases in mutable attributes.
+    if (attr.hasTrait<AttributeTrait::IsMutable>())
+      p.getStream() << attr;
+    else
+      p.printAttributeImpl(attr);
+
+    p.getStream() << newLine;
   }
-  for (const auto &it : llvm::make_filter_range(typeToAlias, filterFn)) {
-    it.second.print(os << '!');
-    os << " = " << it.first << newLine;
+  for (auto &[type, alias] : llvm::make_filter_range(typeToAlias, filterFn)) {
+    alias.print(p.getStream() << '!');
+    p.getStream() << " = ";
+
+    // TODO: Support nested aliases in mutable types.
+    if (type.hasTrait<TypeTrait::IsMutable>())
+      p.getStream() << type;
+    else
+      p.printTypeImpl(type);
+
+    p.getStream() << newLine;
   }
 }
 
@@ -1502,123 +1661,8 @@ AsmState::getDialectResources() const {
 // AsmPrinter::Impl
 //===----------------------------------------------------------------------===//
 
-namespace mlir {
-class AsmPrinter::Impl {
-public:
-  Impl(raw_ostream &os, AsmStateImpl &state)
-      : os(os), state(state), printerFlags(state.getPrinterFlags()) {}
-  explicit Impl(Impl &other) : Impl(other.os, other.state) {}
-
-  /// Returns the output stream of the printer.
-  raw_ostream &getStream() { return os; }
-
-  template <typename Container, typename UnaryFunctor>
-  inline void interleaveComma(const Container &c, UnaryFunctor eachFn) const {
-    llvm::interleaveComma(c, os, eachFn);
-  }
-
-  /// This enum describes the 
diff erent kinds of elision for the type of an
-  /// attribute when printing it.
-  enum class AttrTypeElision {
-    /// The type must not be elided,
-    Never,
-    /// The type may be elided when it matches the default used in the parser
-    /// (for example i64 is the default for integer attributes).
-    May,
-    /// The type must be elided.
-    Must
-  };
-
-  /// Print the given attribute.
-  void printAttribute(Attribute attr,
-                      AttrTypeElision typeElision = AttrTypeElision::Never);
-
-  /// Print the alias for the given attribute, return failure if no alias could
-  /// be printed.
-  LogicalResult printAlias(Attribute attr);
-
-  void printType(Type type);
-
-  /// Print the alias for the given type, return failure if no alias could
-  /// be printed.
-  LogicalResult printAlias(Type type);
-
-  /// Print the given location to the stream. If `allowAlias` is true, this
-  /// allows for the internal location to use an attribute alias.
-  void printLocation(LocationAttr loc, bool allowAlias = false);
-
-  /// Print a reference to the given resource that is owned by the given
-  /// dialect.
-  void printResourceHandle(const AsmDialectResourceHandle &resource) {
-    auto *interface = cast<OpAsmDialectInterface>(resource.getDialect());
-    os << interface->getResourceKey(resource);
-    state.getDialectResources()[resource.getDialect()].insert(resource);
-  }
-
-  void printAffineMap(AffineMap map);
-  void
-  printAffineExpr(AffineExpr expr,
-                  function_ref<void(unsigned, bool)> printValueName = nullptr);
-  void printAffineConstraint(AffineExpr expr, bool isEq);
-  void printIntegerSet(IntegerSet set);
-
-protected:
-  void printOptionalAttrDict(ArrayRef<NamedAttribute> attrs,
-                             ArrayRef<StringRef> elidedAttrs = {},
-                             bool withKeyword = false);
-  void printNamedAttribute(NamedAttribute attr);
-  void printTrailingLocation(Location loc, bool allowAlias = true);
-  void printLocationInternal(LocationAttr loc, bool pretty = false);
-
-  /// Print a dense elements attribute. If 'allowHex' is true, a hex string is
-  /// used instead of individual elements when the elements attr is large.
-  void printDenseElementsAttr(DenseElementsAttr attr, bool allowHex);
-
-  /// Print a dense string elements attribute.
-  void printDenseStringElementsAttr(DenseStringElementsAttr attr);
-
-  /// Print a dense elements attribute. If 'allowHex' is true, a hex string is
-  /// used instead of individual elements when the elements attr is large.
-  void printDenseIntOrFPElementsAttr(DenseIntOrFPElementsAttr attr,
-                                     bool allowHex);
-
-  /// Print a dense array attribute.
-  void printDenseArrayAttr(DenseArrayAttr attr);
-
-  void printDialectAttribute(Attribute attr);
-  void printDialectType(Type type);
-
-  /// Print an escaped string, wrapped with "".
-  void printEscapedString(StringRef str);
-
-  /// Print a hex string, wrapped with "".
-  void printHexString(StringRef str);
-  void printHexString(ArrayRef<char> data);
-
-  /// This enum is used to represent the binding strength of the enclosing
-  /// context that an AffineExprStorage is being printed in, so we can
-  /// intelligently produce parens.
-  enum class BindingStrength {
-    Weak,   // + and -
-    Strong, // All other binary operators.
-  };
-  void printAffineExprInternal(
-      AffineExpr expr, BindingStrength enclosingTightness,
-      function_ref<void(unsigned, bool)> printValueName = nullptr);
-
-  /// The output stream for the printer.
-  raw_ostream &os;
-
-  /// An underlying assembly printer state.
-  AsmStateImpl &state;
-
-  /// A set of flags to control the printer's behavior.
-  OpPrintingFlags printerFlags;
-
-  /// A tracker for the number of new lines emitted during printing.
-  NewLineCounter newLine;
-};
-} // namespace mlir
+AsmPrinter::Impl::Impl(raw_ostream &os, AsmStateImpl &state)
+    : os(os), state(state), printerFlags(state.getPrinterFlags()) {}
 
 void AsmPrinter::Impl::printTrailingLocation(Location loc, bool allowAlias) {
   // Check to see if we are printing debug information.
@@ -1684,8 +1728,11 @@ void AsmPrinter::Impl::printLocationInternal(LocationAttr loc, bool pretty) {
       .Case<FusedLoc>([&](FusedLoc loc) {
         if (!pretty)
           os << "fused";
-        if (Attribute metadata = loc.getMetadata())
-          os << '<' << metadata << '>';
+        if (Attribute metadata = loc.getMetadata()) {
+          os << '<';
+          printAttribute(metadata);
+          os << '>';
+        }
         os << '[';
         interleave(
             loc.getLocations(),
@@ -1755,6 +1802,13 @@ void AsmPrinter::Impl::printLocation(LocationAttr loc, bool allowAlias) {
   os << ')';
 }
 
+void AsmPrinter::Impl::printResourceHandle(
+    const AsmDialectResourceHandle &resource) {
+  auto *interface = cast<OpAsmDialectInterface>(resource.getDialect());
+  os << interface->getResourceKey(resource);
+  state.getDialectResources()[resource.getDialect()].insert(resource);
+}
+
 /// Returns true if the given dialect symbol data is simple enough to print in
 /// the pretty form. This is essentially when the symbol takes the form:
 ///   identifier (`<` body `>`)?
@@ -1854,7 +1908,11 @@ void AsmPrinter::Impl::printAttribute(Attribute attr,
   // Try to print an alias for this attribute.
   if (succeeded(printAlias(attr)))
     return;
+  return printAttributeImpl(attr, typeElision);
+}
 
+void AsmPrinter::Impl::printAttributeImpl(Attribute attr,
+                                          AttrTypeElision typeElision) {
   if (!isa<BuiltinDialect>(attr.getDialect())) {
     printDialectAttribute(attr);
   } else if (auto opaqueAttr = attr.dyn_cast<OpaqueAttr>()) {
@@ -2173,7 +2231,10 @@ void AsmPrinter::Impl::printType(Type type) {
   // Try to print an alias for this type.
   if (succeeded(printAlias(type)))
     return;
+  return printTypeImpl(type);
+}
 
+void AsmPrinter::Impl::printTypeImpl(Type type) {
   TypeSwitch<Type>(type)
       .Case<OpaqueType>([&](OpaqueType opaqueTy) {
         printDialectSymbol(os, "!", opaqueTy.getDialectNamespace(),
@@ -2841,14 +2902,14 @@ class OperationPrinter : public AsmPrinter::Impl, private OpAsmPrinter {
 
 void OperationPrinter::printTopLevelOperation(Operation *op) {
   // Output the aliases at the top level that can't be deferred.
-  state.getAliasState().printNonDeferredAliases(os, newLine);
+  state.getAliasState().printNonDeferredAliases(*this, newLine);
 
   // Print the module.
   printFullOpWithIndentAndLoc(op);
   os << newLine;
 
   // Output the aliases at the top level that can be deferred.
-  state.getAliasState().printDeferredAliases(os, newLine);
+  state.getAliasState().printDeferredAliases(*this, newLine);
 
   // Output any file level metadata.
   printFileMetadataDictionary(op);

diff  --git a/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-resize.mlir b/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-resize.mlir
index e48be848f6086..d1506d0c304c0 100644
--- a/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-resize.mlir
+++ b/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg-resize.mlir
@@ -1,6 +1,6 @@
 // RUN: mlir-opt --split-input-file -pass-pipeline="func.func(tosa-to-linalg)" %s -o -| FileCheck %s
 
-// CHECK: #map0 = affine_map<(d0, d1, d2, d3) -> (d0, d3)>
+// CHECK: #map = affine_map<(d0, d1, d2, d3) -> (d0, d3)>
 // CHECK: #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>
 // CHECK-LABEL: @broadcast_resize_nearest_fp
 func.func @broadcast_resize_nearest_fp(%arg0 : tensor<3x1x1x7xf32>) -> tensor<3x15x13x7xf32> {
@@ -8,7 +8,7 @@ func.func @broadcast_resize_nearest_fp(%arg0 : tensor<3x1x1x7xf32>) -> tensor<3x
   // CHECK-SAME{literal}: [[0], [1, 2, 3]]
   // CHECK: %[[EMPTY:.+]] = tensor.empty() : tensor<3x15x13x7xf32>
   // CHECK: %[[GENERIC:.+]] = linalg.generic 
-  // CHECK-SAME: indexing_maps = [#map0, #map1]
+  // CHECK-SAME: indexing_maps = [#map, #map1]
   // CHECK-SAME: iterator_types = ["parallel", "parallel", "parallel", "parallel"]}
   // CHECK-SAME: ins(%[[COLLAPSE]] : tensor<3x7xf32>)
   // CHECK-SAME: outs(%[[EMPTY]] : tensor<3x15x13x7xf32>)
@@ -22,7 +22,7 @@ func.func @broadcast_resize_nearest_fp(%arg0 : tensor<3x1x1x7xf32>) -> tensor<3x
 
 // -----
 
-// CHECK: #map0 = affine_map<(d0, d1, d2, d3) -> (d0, d3)>
+// CHECK: #map = affine_map<(d0, d1, d2, d3) -> (d0, d3)>
 // CHECK: #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>
 // CHECK-LABEL: @broadcast_resize_bilinear_fp
 func.func @broadcast_resize_bilinear_fp(%arg0 : tensor<3x1x1x7xf32>) -> tensor<3x15x13x7xf32> {
@@ -30,7 +30,7 @@ func.func @broadcast_resize_bilinear_fp(%arg0 : tensor<3x1x1x7xf32>) -> tensor<3
   // CHECK-SAME{literal}: [[0], [1, 2, 3]]
   // CHECK: %[[EMPTY:.+]] = tensor.empty() : tensor<3x15x13x7xf32>
   // CHECK: %[[GENERIC:.+]] = linalg.generic 
-  // CHECK-SAME: indexing_maps = [#map0, #map1]
+  // CHECK-SAME: indexing_maps = [#map, #map1]
   // CHECK-SAME: iterator_types = ["parallel", "parallel", "parallel", "parallel"]}
   // CHECK-SAME: ins(%[[COLLAPSE]] : tensor<3x7xf32>)
   // CHECK-SAME: outs(%[[EMPTY]] : tensor<3x15x13x7xf32>)
@@ -44,7 +44,7 @@ func.func @broadcast_resize_bilinear_fp(%arg0 : tensor<3x1x1x7xf32>) -> tensor<3
 
 // -----
 
-// CHECK: #map0 = affine_map<(d0, d1, d2, d3) -> (d0, d3)>
+// CHECK: #map = affine_map<(d0, d1, d2, d3) -> (d0, d3)>
 // CHECK: #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>
 // CHECK-LABEL: @broadcast_resize_nearest_i8
 func.func @broadcast_resize_nearest_i8(%arg0 : tensor<3x1x1x7xi8>) -> tensor<3x15x13x7xi8> {
@@ -52,7 +52,7 @@ func.func @broadcast_resize_nearest_i8(%arg0 : tensor<3x1x1x7xi8>) -> tensor<3x1
   // CHECK-SAME{literal}: [[0], [1, 2, 3]]
   // CHECK: %[[EMPTY:.+]] = tensor.empty() : tensor<3x15x13x7xi8>
   // CHECK: %[[GENERIC:.+]] = linalg.generic 
-  // CHECK-SAME: indexing_maps = [#map0, #map1]
+  // CHECK-SAME: indexing_maps = [#map, #map1]
   // CHECK-SAME: iterator_types = ["parallel", "parallel", "parallel", "parallel"]}
   // CHECK-SAME: ins(%[[COLLAPSE]] : tensor<3x7xi8>)
   // CHECK-SAME: outs(%[[EMPTY]] : tensor<3x15x13x7xi8>)
@@ -66,7 +66,7 @@ func.func @broadcast_resize_nearest_i8(%arg0 : tensor<3x1x1x7xi8>) -> tensor<3x1
 
 // -----
 
-// CHECK: #map0 = affine_map<(d0, d1, d2, d3) -> (d0, d3)>
+// CHECK: #map = affine_map<(d0, d1, d2, d3) -> (d0, d3)>
 // CHECK: #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>
 // CHECK-LABEL: @broadcast_resize_nearest_i32
 func.func @broadcast_resize_nearest_i32(%arg0 : tensor<3x1x1x7xi8>) -> tensor<3x15x13x7xi32> {
@@ -74,7 +74,7 @@ func.func @broadcast_resize_nearest_i32(%arg0 : tensor<3x1x1x7xi8>) -> tensor<3x
   // CHECK-SAME{literal}: [[0], [1, 2, 3]]
   // CHECK: %[[EMPTY:.+]] = tensor.empty() : tensor<3x15x13x7xi32>
   // CHECK: %[[GENERIC:.+]] = linalg.generic 
-  // CHECK-SAME: indexing_maps = [#map0, #map1]
+  // CHECK-SAME: indexing_maps = [#map, #map1]
   // CHECK-SAME: iterator_types = ["parallel", "parallel", "parallel", "parallel"]}
   // CHECK-SAME: ins(%[[COLLAPSE]] : tensor<3x7xi8>)
   // CHECK-SAME: outs(%[[EMPTY]] : tensor<3x15x13x7xi32>)
@@ -89,7 +89,7 @@ func.func @broadcast_resize_nearest_i32(%arg0 : tensor<3x1x1x7xi8>) -> tensor<3x
 
 // -----
 
-// CHECK: #map0 = affine_map<(d0, d1, d2, d3) -> (d0, d3)>
+// CHECK: #map = affine_map<(d0, d1, d2, d3) -> (d0, d3)>
 // CHECK: #map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>
 // CHECK-LABEL: @broadcast_resize_bilinear_i32
 func.func @broadcast_resize_bilinear_i32(%arg0 : tensor<3x1x1x7xi8>) -> tensor<3x15x13x7xi32> {
@@ -97,7 +97,7 @@ func.func @broadcast_resize_bilinear_i32(%arg0 : tensor<3x1x1x7xi8>) -> tensor<3
   // CHECK-SAME{literal}: [[0], [1, 2, 3]]
   // CHECK: %[[EMPTY:.+]] = tensor.empty() : tensor<3x15x13x7xi32>
   // CHECK: %[[GENERIC:.+]] = linalg.generic 
-  // CHECK-SAME: indexing_maps = [#map0, #map1]
+  // CHECK-SAME: indexing_maps = [#map, #map1]
   // CHECK-SAME: iterator_types = ["parallel", "parallel", "parallel", "parallel"]}
   // CHECK-SAME: ins(%[[COLLAPSE]] : tensor<3x7xi8>)
   // CHECK-SAME: outs(%[[EMPTY]] : tensor<3x15x13x7xi32>)

diff  --git a/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir b/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir
index 7c7a8aab3bb47..6c2626dd1ac00 100644
--- a/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir
+++ b/mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir
@@ -1425,7 +1425,7 @@ func.func @argmax(%arg0 : tensor<3x2xi32>, %arg1 : tensor<6xf32>) -> () {
   // CHECK: [[VAL_INIT:%.+]] = tensor.empty()
   // CHECK: [[VAL_MIN:%.+]] = arith.constant -2147483648
   // CHECK: [[VAL_FILL:%.+]] = linalg.fill ins([[VAL_MIN]]{{.*}}outs([[VAL_INIT]]
-  // CHECK: linalg.generic {indexing_maps = [#map0, #map2, #map2], iterator_types = ["parallel", "reduction"]} ins(%[[ARG0]] : tensor<3x2xi32>) outs([[IDX_FILL]], [[VAL_FILL]] : tensor<3xi32>, tensor<3xi32>)
+  // CHECK: linalg.generic {indexing_maps = [#map, #map2, #map2], iterator_types = ["parallel", "reduction"]} ins(%[[ARG0]] : tensor<3x2xi32>) outs([[IDX_FILL]], [[VAL_FILL]] : tensor<3xi32>, tensor<3xi32>)
   // CHECK: ^bb0(%[[ARG1:[0-9a-zA-Z_]+]]: i32, %[[ARG2:[0-9a-zA-Z_]+]]: i32, %[[ARG3:[0-9a-zA-Z_]+]]: i32
   // CHECK:   [[IDX:%.+]] = linalg.index 1
   // CHECK:   [[CAST:%.+]] = arith.index_cast [[IDX]]
@@ -1503,7 +1503,7 @@ func.func @argmax_dyn_axis(%arg0 : tensor<3x?xi32>) -> () {
 // CHECK-SAME:  %[[ARG1:[0-9a-zA-Z_]*]]
 func.func @gather_float(%arg0: tensor<2x3x2xf32>, %arg1: tensor<2x3xi32>) -> () {
   // CHECK: %[[INIT:.+]] = tensor.empty()
-  // CHECK: %[[GENERIC:.+]] = linalg.generic {indexing_maps = [#map0, #map1], iterator_types = ["parallel", "parallel", "parallel"]} ins(%[[ARG1]] : tensor<2x3xi32>) outs(%[[INIT]] : tensor<2x3x2xf32>)
+  // CHECK: %[[GENERIC:.+]] = linalg.generic {indexing_maps = [#map, #map1], iterator_types = ["parallel", "parallel", "parallel"]} ins(%[[ARG1]] : tensor<2x3xi32>) outs(%[[INIT]] : tensor<2x3x2xf32>)
   // CHECK: ^bb0(%[[BBARG0:.+]]: i32, %[[BBARG1:.+]]: f32)
   // CHECK:   %[[IDX0:.+]] = linalg.index 0
   // CHECK:   %[[CAST:.+]] = arith.index_cast %[[BBARG0]]
@@ -1523,7 +1523,7 @@ func.func @gather_float_dyn(%arg0: tensor<?x3x2xf32>, %arg1: tensor<?x3xi32>) ->
   // CHECK: %[[C0:.+]] = arith.constant 0
   // CHECK: %[[BATCH:.+]] = tensor.dim %[[ARG0]], %[[C0]]
   // CHECK: %[[INIT:.+]] = tensor.empty(%[[BATCH]])
-  // CHECK: %[[GENERIC:.+]] = linalg.generic {indexing_maps = [#map0, #map1], iterator_types = ["parallel", "parallel", "parallel"]} ins(%[[ARG1]] : tensor<?x3xi32>) outs(%[[INIT]] : tensor<?x3x2xf32>)
+  // CHECK: %[[GENERIC:.+]] = linalg.generic {indexing_maps = [#map, #map1], iterator_types = ["parallel", "parallel", "parallel"]} ins(%[[ARG1]] : tensor<?x3xi32>) outs(%[[INIT]] : tensor<?x3x2xf32>)
   // CHECK: ^bb0(%[[BBARG0:.+]]: i32, %[[BBARG1:.+]]: f32)
   // CHECK:   %[[IDX0:.+]] = linalg.index 0
   // CHECK:   %[[CAST:.+]] = arith.index_cast %[[BBARG0]]
@@ -1541,7 +1541,7 @@ func.func @gather_float_dyn(%arg0: tensor<?x3x2xf32>, %arg1: tensor<?x3xi32>) ->
 // CHECK-SAME:  %[[ARG1:[0-9a-zA-Z_]*]]
 func.func @gather_int(%arg0: tensor<2x3x2xi32>, %arg1: tensor<2x3xi32>) -> () {
   // CHECK: %[[INIT:.+]] = tensor.empty()
-  // CHECK: %[[GENERIC:.+]] = linalg.generic {indexing_maps = [#map0, #map1], iterator_types = ["parallel", "parallel", "parallel"]} ins(%[[ARG1]] : tensor<2x3xi32>) outs(%[[INIT]] : tensor<2x3x2xi32>)
+  // CHECK: %[[GENERIC:.+]] = linalg.generic {indexing_maps = [#map, #map1], iterator_types = ["parallel", "parallel", "parallel"]} ins(%[[ARG1]] : tensor<2x3xi32>) outs(%[[INIT]] : tensor<2x3x2xi32>)
   // CHECK: ^bb0(%[[BBARG0:.+]]: i32, %[[BBARG1:.+]]: i32)
   // CHECK:   %[[IDX0:.+]] = linalg.index 0
   // CHECK:   %[[CAST:.+]] = arith.index_cast %[[BBARG0]]

diff  --git a/mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir
index b2e46ada75fbb..9244604128cb7 100644
--- a/mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir
+++ b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_1d.mlir
@@ -1,7 +1,7 @@
 // RUN: mlir-opt %s -affine-super-vectorize="virtual-vector-size=128 test-fastest-varying=0" -split-input-file | FileCheck %s
 
-// CHECK-DAG: #[[$map_id1:map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0)>
-// CHECK-DAG: #[[$map_proj_d0d1_0:map[0-9a-zA-Z_]+]] = affine_map<(d0, d1) -> (0)>
+// CHECK-DAG: #[[$map_id1:map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0)>
+// CHECK-DAG: #[[$map_proj_d0d1_0:map[0-9a-zA-Z_]*]] = affine_map<(d0, d1) -> (0)>
 
 // CHECK-LABEL: func @vec1d_1
 func.func @vec1d_1(%A : memref<?x?xf32>, %B : memref<?x?x?xf32>) {
@@ -183,8 +183,8 @@ func.func @vec_block_arg(%A : memref<32x512xi32>) {
 
 // -----
 
-// CHECK-DAG: #[[$map0:map[0-9a-zA-Z_]+]] = affine_map<(d0, d1, d2) -> (d0 * 2 + d1 - 1)>
-// CHECK-DAG: #[[$map1:map[0-9a-zA-Z_]+]] = affine_map<(d0, d1, d2) -> (d2)>
+// CHECK-DAG: #[[$map0:map[0-9a-zA-Z_]*]] = affine_map<(d0, d1, d2) -> (d0 * 2 + d1 - 1)>
+// CHECK-DAG: #[[$map1:map[0-9a-zA-Z_]*]] = affine_map<(d0, d1, d2) -> (d2)>
 // CHECK-LABEL: func @vec_block_arg_2
 func.func @vec_block_arg_2(%A : memref<?x512xindex>) {
   %c0 = arith.constant 0 : index
@@ -402,8 +402,8 @@ func.func @vec_rejected_7(%A : memref<?x?xf32>, %B : memref<?x?x?xf32>) {
 
 // -----
 
-// CHECK-DAG: #[[$map_id1:map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0)>
-// CHECK-DAG: #[[$map_proj_d0d1_0:map[0-9a-zA-Z_]+]] = affine_map<(d0, d1) -> (0)>
+// CHECK-DAG: #[[$map_id1:map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0)>
+// CHECK-DAG: #[[$map_proj_d0d1_0:map[0-9a-zA-Z_]*]] = affine_map<(d0, d1) -> (0)>
 
 // CHECK-LABEL: func @vec_rejected_8
 func.func @vec_rejected_8(%A : memref<?x?xf32>, %B : memref<?x?x?xf32>) {
@@ -436,8 +436,8 @@ func.func @vec_rejected_8(%A : memref<?x?xf32>, %B : memref<?x?x?xf32>) {
 
 // -----
 
-// CHECK-DAG: #[[$map_id1:map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0)>
-// CHECK-DAG: #[[$map_proj_d0d1_0:map[0-9a-zA-Z_]+]] = affine_map<(d0, d1) -> (0)>
+// CHECK-DAG: #[[$map_id1:map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0)>
+// CHECK-DAG: #[[$map_proj_d0d1_0:map[0-9a-zA-Z_]*]] = affine_map<(d0, d1) -> (0)>
 
 // CHECK-LABEL: func @vec_rejected_9
 func.func @vec_rejected_9(%A : memref<?x?xf32>, %B : memref<?x?x?xf32>) {

diff  --git a/mlir/test/Dialect/Affine/SuperVectorize/vectorize_2d.mlir b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_2d.mlir
index b3cd3eed91d6a..83916e755363b 100644
--- a/mlir/test/Dialect/Affine/SuperVectorize/vectorize_2d.mlir
+++ b/mlir/test/Dialect/Affine/SuperVectorize/vectorize_2d.mlir
@@ -2,12 +2,12 @@
 // RUN: mlir-opt %s -affine-super-vectorize="virtual-vector-size=32,256 test-fastest-varying=1,0" | FileCheck %s
 
 // Permutation maps used in vectorization.
-// CHECK-DAG: #[[$map_id1:map[0-9]+]] = affine_map<(d0) -> (d0)>
-// CHECK-DAG: #[[$map_proj_d0d1_zerod1:map[0-9]+]] = affine_map<(d0, d1) -> (0, d1)>
-// CHECK-DAG: #[[$map_proj_d0d1_d0zero:map[0-9]+]] = affine_map<(d0, d1) -> (d0, 0)>
-// VECT-DAG: #[[$map_id1:map[0-9]+]] = affine_map<(d0) -> (d0)>
-// VECT-DAG: #[[$map_proj_d0d1_zerod1:map[0-9]+]] = affine_map<(d0, d1) -> (0, d1)>
-// VECT-DAG: #[[$map_proj_d0d1_d0zero:map[0-9]+]] = affine_map<(d0, d1) -> (d0, 0)>
+// CHECK-DAG: #[[$map_id1:map[0-9]*]] = affine_map<(d0) -> (d0)>
+// CHECK-DAG: #[[$map_proj_d0d1_zerod1:map[0-9]*]] = affine_map<(d0, d1) -> (0, d1)>
+// CHECK-DAG: #[[$map_proj_d0d1_d0zero:map[0-9]*]] = affine_map<(d0, d1) -> (d0, 0)>
+// VECT-DAG: #[[$map_id1:map[0-9]*]] = affine_map<(d0) -> (d0)>
+// VECT-DAG: #[[$map_proj_d0d1_zerod1:map[0-9]*]] = affine_map<(d0, d1) -> (0, d1)>
+// VECT-DAG: #[[$map_proj_d0d1_d0zero:map[0-9]*]] = affine_map<(d0, d1) -> (d0, 0)>
 
 func.func @vec2d(%A : memref<?x?x?xf32>) {
    %c0 = arith.constant 0 : index

diff  --git a/mlir/test/Dialect/Affine/affine-data-copy.mlir b/mlir/test/Dialect/Affine/affine-data-copy.mlir
index 31e5538cc576d..a5fa22a4b28cc 100644
--- a/mlir/test/Dialect/Affine/affine-data-copy.mlir
+++ b/mlir/test/Dialect/Affine/affine-data-copy.mlir
@@ -18,8 +18,8 @@
 #ub = affine_map<(d0) -> (d0 + 128)>
 
 // Map used to index the buffer while computing.
-// CHECK-DAG: [[$MAP_IDENTITY:map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0)>
-// CHECK-DAG: [[$MAP_PLUS_128:map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0 + 128)>
+// CHECK-DAG: [[$MAP_IDENTITY:map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0)>
+// CHECK-DAG: [[$MAP_PLUS_128:map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0 + 128)>
 
 // CHECK-LABEL: func @matmul
 // FILTER-LABEL: func @matmul
@@ -200,9 +200,9 @@ func.func @single_elt_buffers(%arg0: memref<1024x1024xf32>, %arg1: memref<1024x1
 
 #map_ub = affine_map<(d0) -> (4096, d0 + 100)>
 
-// CHECK-DAG: [[$MAP_IDENTITY:map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0)>
-// CHECK-DAG: [[$MAP_MIN_UB1:map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0 + 100, 4096)>
-// CHECK-DAG: [[$MAP_MIN_UB2:map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (4096, d0 + 100)>
+// CHECK-DAG: [[$MAP_IDENTITY:map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0)>
+// CHECK-DAG: [[$MAP_MIN_UB1:map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0 + 100, 4096)>
+// CHECK-DAG: [[$MAP_MIN_UB2:map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (4096, d0 + 100)>
 
 // CHECK-LABEL: func @min_upper_bound
 func.func @min_upper_bound(%A: memref<4096xf32>) -> memref<4096xf32> {

diff  --git a/mlir/test/Dialect/Affine/affine-loop-normalize.mlir b/mlir/test/Dialect/Affine/affine-loop-normalize.mlir
index 692b1bec023de..d4d2ccef49398 100644
--- a/mlir/test/Dialect/Affine/affine-loop-normalize.mlir
+++ b/mlir/test/Dialect/Affine/affine-loop-normalize.mlir
@@ -2,9 +2,9 @@
 
 // Normalize steps to 1 and lower bounds to 0.
 
-// CHECK-DAG: [[$MAP0:#map[0-9]+]] = affine_map<(d0) -> (d0 * 3)>
-// CHECK-DAG: [[$MAP1:#map[0-9]+]] = affine_map<(d0) -> (d0 * 2 + 1)>
-// CHECK-DAG: [[$MAP2:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 + d1)>
+// CHECK-DAG: [[$MAP0:#map[0-9]*]] = affine_map<(d0) -> (d0 * 3)>
+// CHECK-DAG: [[$MAP1:#map[0-9]*]] = affine_map<(d0) -> (d0 * 2 + 1)>
+// CHECK-DAG: [[$MAP2:#map[0-9]*]] = affine_map<(d0, d1) -> (d0 + d1)>
 
 // CHECK-LABEL: func @normalize_parallel()
 func.func @normalize_parallel() {
@@ -55,8 +55,8 @@ func.func @single_iteration_loop(%in: memref<1xf32>, %out: memref<1xf32>) {
 
 // -----
 
-// CHECK-DAG: [[$IV0:#map[0-9]+]] = affine_map<(d0) -> (d0 * 2 + 2)>
-// CHECK-DAG: [[$IV1:#map[0-9]+]] = affine_map<(d0) -> (d0 * 3)>
+// CHECK-DAG: [[$IV0:#map[0-9]*]] = affine_map<(d0) -> (d0 * 2 + 2)>
+// CHECK-DAG: [[$IV1:#map[0-9]*]] = affine_map<(d0) -> (d0 * 3)>
 
 // CHECK-LABEL: func @simple_loop_nest()
 // CHECK-NEXT:   affine.for %[[I:.*]] = 0 to 15 {
@@ -79,10 +79,10 @@ func.func @simple_loop_nest(){
 
 // -----
 
-// CHECK-DAG: [[$IV00:#map[0-9]+]] = affine_map<(d0) -> (d0 * 32 + 2)>
-// CHECK-DAG: [[$IV11:#map[0-9]+]] = affine_map<(d0) -> (d0 * 2)>
-// CHECK-DAG: [[$UB00:#map[0-9]+]] = affine_map<()[s0] -> ((s0 - 2) ceildiv 32)>
-// CHECK-DAG: [[$UB11:#map[0-9]+]] = affine_map<()[s0] -> (s0 ceildiv 2)>
+// CHECK-DAG: [[$IV00:#map[0-9]*]] = affine_map<(d0) -> (d0 * 32 + 2)>
+// CHECK-DAG: [[$IV11:#map[0-9]*]] = affine_map<(d0) -> (d0 * 2)>
+// CHECK-DAG: [[$UB00:#map[0-9]*]] = affine_map<()[s0] -> ((s0 - 2) ceildiv 32)>
+// CHECK-DAG: [[$UB11:#map[0-9]*]] = affine_map<()[s0] -> (s0 ceildiv 2)>
 
 // CHECK-LABEL: func @loop_with_unknown_upper_bound
 // CHECK-SAME: (%[[ARG0:.*]]: memref<?x?xf32>, %[[ARG1:.*]]: index)
@@ -110,10 +110,10 @@ func.func @loop_with_unknown_upper_bound(%arg0: memref<?x?xf32>, %arg1: index) {
 
 // -----
 
-// CHECK-DAG: [[$OUTERIV:#map[0-9]+]] = affine_map<(d0) -> (d0 * 32 + 2)>
-// CHECK-DAG: [[$INNERIV:#map[0-9]+]] = affine_map<(d0) -> (d0 + 2)>
-// CHECK-DAG: [[$OUTERUB:#map[0-9]+]] = affine_map<()[s0] -> ((s0 - 2) ceildiv 32)>
-// CHECK-DAG: [[$INNERUB:#map[0-9]+]] = affine_map<()[s0] -> (s0 - 2, 510)>
+// CHECK-DAG: [[$OUTERIV:#map[0-9]*]] = affine_map<(d0) -> (d0 * 32 + 2)>
+// CHECK-DAG: [[$INNERIV:#map[0-9]*]] = affine_map<(d0) -> (d0 + 2)>
+// CHECK-DAG: [[$OUTERUB:#map[0-9]*]] = affine_map<()[s0] -> ((s0 - 2) ceildiv 32)>
+// CHECK-DAG: [[$INNERUB:#map[0-9]*]] = affine_map<()[s0] -> (s0 - 2, 510)>
 
 // CHECK-LABEL: func @loop_with_multiple_upper_bounds
 // CHECK-SAME: (%[[ARG0:.*]]: memref<?x?xf32>, %[[ARG1:.*]]: index)
@@ -141,10 +141,10 @@ func.func @loop_with_multiple_upper_bounds(%arg0: memref<?x?xf32>, %arg1 : index
 
 // -----
 
-// CHECK-DAG: [[$INTERUB:#map[0-9]+]] = affine_map<()[s0] -> (s0 ceildiv 32)>
-// CHECK-DAG: [[$INTERIV:#map[0-9]+]] = affine_map<(d0) -> (d0 * 32)>
-// CHECK-DAG: [[$INTRAUB:#map[0-9]+]] = affine_map<(d0)[s0] -> (32, -d0 + s0)>
-// CHECK-DAG: [[$INTRAIV:#map[0-9]+]] = affine_map<(d0, d1) -> (d1 + d0)>
+// CHECK-DAG: [[$INTERUB:#map[0-9]*]] = affine_map<()[s0] -> (s0 ceildiv 32)>
+// CHECK-DAG: [[$INTERIV:#map[0-9]*]] = affine_map<(d0) -> (d0 * 32)>
+// CHECK-DAG: [[$INTRAUB:#map[0-9]*]] = affine_map<(d0)[s0] -> (32, -d0 + s0)>
+// CHECK-DAG: [[$INTRAIV:#map[0-9]*]] = affine_map<(d0, d1) -> (d1 + d0)>
 
 // CHECK-LABEL: func @tiled_matmul
 // CHECK-SAME: (%[[ARG0:.*]]: memref<1024x1024xf32>, %[[ARG1:.*]]: memref<1024x1024xf32>, %[[ARG2:.*]]: memref<1024x1024xf32>)

diff  --git a/mlir/test/Dialect/Affine/dma-generate.mlir b/mlir/test/Dialect/Affine/dma-generate.mlir
index 5e43ceb1c2ed2..b38bf896e78cf 100644
--- a/mlir/test/Dialect/Affine/dma-generate.mlir
+++ b/mlir/test/Dialect/Affine/dma-generate.mlir
@@ -444,7 +444,7 @@ func.func @relative_loop_bounds(%arg0: memref<1027xf32>) {
 // CHECK:      [[BUF:%[0-9a-zA-Z_]+]] = memref.alloc() : memref<1027xf32, 2>
 // CHECK-NEXT: [[MEM:%[0-9a-zA-Z_]+]] = memref.alloc() : memref<1xi32>
 // CHECK-NEXT: affine.for %{{.*}} = 0 to 1024 {
-// CHECK-NEXT:    affine.for %[[I2:.*]] = {{#map[0-9a-zA-Z_]+}}(%{{.*}}) to {{#map[0-9a-zA-Z_]+}}(%{{.*}}) {
+// CHECK-NEXT:    affine.for %[[I2:.*]] = {{#map[0-9a-zA-Z_]*}}(%{{.*}}) to {{#map[0-9a-zA-Z_]*}}(%{{.*}}) {
 // CHECK:           affine.store %{{.*}}, [[BUF]][%[[I2]]] : memref<1027xf32, 2>
 // CHECK-NEXT:    }
 // CHECK-NEXT:  }
@@ -614,9 +614,9 @@ func.func @simple_matmul(%arg0: memref<8x8xvector<64xf32>>, %arg1: memref<8x8xve
 // FAST-MEM-16KB:       affine.dma_wait
 // FAST-MEM-16KB:       affine.dma_start %{{.*}}
 // FAST-MEM-16KB:       affine.dma_wait
-// FAST-MEM-16KB:       affine.for %{{.*}} = #map{{[0-9a-zA-Z_]+}}(%{{.*}}) to #map{{[0-9a-zA-Z_]+}}(%{{.*}}) {
-// FAST-MEM-16KB-NEXT:    affine.for %{{.*}} = #map{{[0-9a-zA-Z_]+}}(%{{.*}}) to #map{{[0-9a-zA-Z_]+}}(%{{.*}}) {
-// FAST-MEM-16KB-NEXT:      affine.for %{{.*}} = #map{{[0-9a-zA-Z_]+}}(%{{.*}}) to #map{{[0-9a-zA-Z_]+}}(%{{.*}}) {
+// FAST-MEM-16KB:       affine.for %{{.*}} = #map{{[0-9a-zA-Z_]*}}(%{{.*}}) to #map{{[0-9a-zA-Z_]*}}(%{{.*}}) {
+// FAST-MEM-16KB-NEXT:    affine.for %{{.*}} = #map{{[0-9a-zA-Z_]*}}(%{{.*}}) to #map{{[0-9a-zA-Z_]*}}(%{{.*}}) {
+// FAST-MEM-16KB-NEXT:      affine.for %{{.*}} = #map{{[0-9a-zA-Z_]*}}(%{{.*}}) to #map{{[0-9a-zA-Z_]*}}(%{{.*}}) {
 // FAST-MEM-16KB:           }
 // FAST-MEM-16KB:         }
 // FAST-MEM-16KB:       }

diff  --git a/mlir/test/Dialect/Affine/loop-tiling-parametric.mlir b/mlir/test/Dialect/Affine/loop-tiling-parametric.mlir
index 372a7a0a462fd..11ad83ade5d88 100644
--- a/mlir/test/Dialect/Affine/loop-tiling-parametric.mlir
+++ b/mlir/test/Dialect/Affine/loop-tiling-parametric.mlir
@@ -7,13 +7,13 @@
 
 // -----
 
-// CHECK-DAG: [[LBI:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0)>
-// CHECK-DAG: [[UBI0:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0 + s0, 256)>
-// CHECK-DAG: [[UBI1:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0 + s0, 512)>
-// CHECK-DAG: [[UBI2:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0 + s0, 1024)>
-// CHECK-DAG: [[UBO0:#map[0-9]+]] = affine_map<()[s0] -> (256 ceildiv s0)>
-// CHECK-DAG: [[UBO1:#map[0-9]+]] = affine_map<()[s0] -> (512 ceildiv s0)>
-// CHECK-DAG: [[UBO2:#map[0-9]+]] = affine_map<()[s0] -> (1024 ceildiv s0)>
+// CHECK-DAG: [[LBI:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0)>
+// CHECK-DAG: [[UBI0:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0 + s0, 256)>
+// CHECK-DAG: [[UBI1:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0 + s0, 512)>
+// CHECK-DAG: [[UBI2:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0 + s0, 1024)>
+// CHECK-DAG: [[UBO0:#map[0-9]*]] = affine_map<()[s0] -> (256 ceildiv s0)>
+// CHECK-DAG: [[UBO1:#map[0-9]*]] = affine_map<()[s0] -> (512 ceildiv s0)>
+// CHECK-DAG: [[UBO2:#map[0-9]*]] = affine_map<()[s0] -> (1024 ceildiv s0)>
 
 // CHECK: func @loop_tiling_3d([[ARG0:%arg[0-9]+]]: index, [[ARG1:%arg[0-9]+]]: index, [[ARG2:%arg[0-9]+]]: index)
 // CHECK-NEXT:   affine.for [[ARG3:%arg[0-9]+]] = 0 to [[UBO0]](){{.*}}[[ARG0]]
@@ -36,13 +36,13 @@ func.func @loop_tiling_3d(%t0 : index, %t1 : index, %t2 : index) {
 
 // -----
 
-// CHECK-DAG: [[LBI:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0)>
-// CHECK-DAG: [[UBI0:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0 + s0 * 4, 256)>
-// CHECK-DAG: [[UBI1:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0 + s0 * 3, 512)>
-// CHECK-DAG: [[UBI2:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0 + s0 * 2, 1024)>
-// CHECK-DAG: [[UBO0:#map[0-9]+]] = affine_map<()[s0] -> (256 ceildiv s0)>
-// CHECK-DAG: [[UBO1:#map[0-9]+]] = affine_map<()[s0] -> (512 ceildiv s0)>
-// CHECK-DAG: [[UBO2:#map[0-9]+]] = affine_map<()[s0] -> (1024 ceildiv s0)>
+// CHECK-DAG: [[LBI:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0)>
+// CHECK-DAG: [[UBI0:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0 + s0 * 4, 256)>
+// CHECK-DAG: [[UBI1:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0 + s0 * 3, 512)>
+// CHECK-DAG: [[UBI2:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0 + s0 * 2, 1024)>
+// CHECK-DAG: [[UBO0:#map[0-9]*]] = affine_map<()[s0] -> (256 ceildiv s0)>
+// CHECK-DAG: [[UBO1:#map[0-9]*]] = affine_map<()[s0] -> (512 ceildiv s0)>
+// CHECK-DAG: [[UBO2:#map[0-9]*]] = affine_map<()[s0] -> (1024 ceildiv s0)>
 
 // CHECK: func @loop_tiling_non_unit_step([[ARG0:%arg[0-9]+]]: index, [[ARG1:%arg[0-9]+]]: index, [[ARG2:%arg[0-9]+]]: index)
 // CHECK-NEXT:  affine.for [[ARG3:%arg[0-9]+]] = 0 to [[UBO0]](){{.*}}[[ARG0]]{{.*}}step 4
@@ -65,9 +65,9 @@ func.func @loop_tiling_non_unit_step(%t0: index, %t1: index, %t2: index){
 
 // -----
 
-// CHECK-DAG: [[LBI0:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0)>
-// CHECK-DAG: [[UBI0:#map[0-9]+]] = affine_map<(d0)[s0, s1, s2] -> (d0 * s2 + s2, s0, 4096 floordiv s1)>
-// CHECK-DAG: [[UBO0:#map[0-9]+]] = affine_map<()[s0, s1, s2] -> (s0 ceildiv s2, (4096 floordiv s1) ceildiv s2)>
+// CHECK-DAG: [[LBI0:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0)>
+// CHECK-DAG: [[UBI0:#map[0-9]*]] = affine_map<(d0)[s0, s1, s2] -> (d0 * s2 + s2, s0, 4096 floordiv s1)>
+// CHECK-DAG: [[UBO0:#map[0-9]*]] = affine_map<()[s0, s1, s2] -> (s0 ceildiv s2, (4096 floordiv s1) ceildiv s2)>
 
 // CHECK: func @tile_loop_with_div_in_upper_bound([[ARG0:%arg[0-9]+]]: index, %{{.*}}: memref<?xi32>, %{{.*}}: index, %{{.*}}: index)
 #ub = affine_map<()[s0, s1] -> (s0, 4096 floordiv s1)>
@@ -85,9 +85,9 @@ func.func @tile_loop_with_div_in_upper_bound(%t5 : index, %A : memref<? x i32>,
 
 // -----
 
-// CHECK-DAG: [[LBI0:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0)>
-// CHECK-DAG: [[UBI0:#map[0-9]+]] = affine_map<(d0)[s0, s1, s2] -> (d0 * s2 + s2 * 4, s0, 4096 floordiv s1)>
-// CHECK-DAG: [[UBO0:#map[0-9]+]] = affine_map<()[s0, s1, s2] -> (s0 ceildiv s2, (4096 floordiv s1) ceildiv s2)>
+// CHECK-DAG: [[LBI0:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0)>
+// CHECK-DAG: [[UBI0:#map[0-9]*]] = affine_map<(d0)[s0, s1, s2] -> (d0 * s2 + s2 * 4, s0, 4096 floordiv s1)>
+// CHECK-DAG: [[UBO0:#map[0-9]*]] = affine_map<()[s0, s1, s2] -> (s0 ceildiv s2, (4096 floordiv s1) ceildiv s2)>
 
 // CHECK: func @tile_loop_with_div_in_upper_bound_non_unit_step([[ARG0:%arg[0-9]+]]: index, %{{.*}}: memref<?xi32>, %{{.*}}: index, %{{.*}}: index)
 #ub = affine_map<()[s0, s1] -> (s0, 4096 floordiv s1)>
@@ -105,12 +105,12 @@ func.func @tile_loop_with_div_in_upper_bound_non_unit_step(%t5 : index, %A : mem
 
 // -----
 
-// CHECK-DAG: [[LBI0:#map[0-9]+]] = affine_map<(d0)[s0] -> ((d0 - 8) * s0 + 8)>
-// CHECK-DAG: [[UBI2:#map[0-9]+]] = affine_map<(d0)[s0, s1] -> ((d0 - 8) * s1 + s1 * 4 + 8, s0 + 16)>
-// CHECK-DAG: [[UBI1:#map[0-9]+]] = affine_map<(d0)[s0, s1] -> ((d0 - 8) * s1 + s1 + 8, s0 + 16)>
-// CHECK-DAG: [[UBI0:#map[0-9]+]] = affine_map<(d0)[s0] -> ((d0 - 8) * s0 + s0 + 8, 256)>
-// CHECK-DAG: [[UBO1:#map[0-9]+]] = affine_map<()[s0, s1] -> ((s0 + 8) ceildiv s1 + 8)>
-// CHECK-DAG: [[UBO0:#map[0-9]+]] = affine_map<()[s0] -> (248 ceildiv s0 + 8)>
+// CHECK-DAG: [[LBI0:#map[0-9]*]] = affine_map<(d0)[s0] -> ((d0 - 8) * s0 + 8)>
+// CHECK-DAG: [[UBI2:#map[0-9]*]] = affine_map<(d0)[s0, s1] -> ((d0 - 8) * s1 + s1 * 4 + 8, s0 + 16)>
+// CHECK-DAG: [[UBI1:#map[0-9]*]] = affine_map<(d0)[s0, s1] -> ((d0 - 8) * s1 + s1 + 8, s0 + 16)>
+// CHECK-DAG: [[UBI0:#map[0-9]*]] = affine_map<(d0)[s0] -> ((d0 - 8) * s0 + s0 + 8, 256)>
+// CHECK-DAG: [[UBO1:#map[0-9]*]] = affine_map<()[s0, s1] -> ((s0 + 8) ceildiv s1 + 8)>
+// CHECK-DAG: [[UBO0:#map[0-9]*]] = affine_map<()[s0] -> (248 ceildiv s0 + 8)>
 
 // CHECK: func @tile_loop_with_non_zero_lb([[ARG0:%arg[0-9]+]]: index, [[ARG1:%arg[0-9]+]]: index, [[ARG2:%arg[0-9]+]]: index, %{{.*}}: index)
 // CHECK-NEXT:  affine.for [[ARG3:%arg[0-9+]]] = 8 to [[UBO0]]{{.*}}[[ARG0]]{{.*}}
@@ -134,11 +134,11 @@ func.func @tile_loop_with_non_zero_lb(%t0: index, %t1: index, %t2: index, %U: in
 
 // -----
 
-// CHECK-DAG: [[LBI:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0)>
-// CHECK-DAG: [[UBI0:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0 + s0, 256)>
-// CHECK-DAG: [[UBI1:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0 + s0, 250)>
-// CHECK-DAG: [[UBO0:#map[0-9]+]] = affine_map<()[s0] -> (256 ceildiv s0)>
-// CHECK-DAG: [[UBO1:#map[0-9]+]] = affine_map<()[s0] -> (250 ceildiv s0)>
+// CHECK-DAG: [[LBI:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0)>
+// CHECK-DAG: [[UBI0:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0 + s0, 256)>
+// CHECK-DAG: [[UBI1:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0 + s0, 250)>
+// CHECK-DAG: [[UBO0:#map[0-9]*]] = affine_map<()[s0] -> (256 ceildiv s0)>
+// CHECK-DAG: [[UBO1:#map[0-9]*]] = affine_map<()[s0] -> (250 ceildiv s0)>
 
 // CHECK: func @simple_matmul([[ARG0:%arg[0-9]+]]: index, [[ARG1:%arg[0-9]+]]: index, [[ARG2:%arg[0-9]+]]: index{{.*}})
 // CHECK-NEXT:   affine.for [[ARG3:%arg[0-9]+]] = 0 to [[UBO0]](){{.*}}[[ARG0]]{{.*}}
@@ -171,9 +171,9 @@ func.func @simple_matmul(%t6 : index, %t7 : index, %t8 : index, %arg0: memref<25
 
 // -----
 
-// CHECK-DAG: [[LBI0:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0)>
-// CHECK-DAG: [[UBI0:#map[0-9]+]] = affine_map<(d0)[s0, s1] -> (d0 * s1 + s1, s0)>
-// CHECK-DAG: [[UBO0:#map[0-9]+]] = affine_map<()[s0, s1] -> (s0 ceildiv s1)>
+// CHECK-DAG: [[LBI0:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0)>
+// CHECK-DAG: [[UBI0:#map[0-9]*]] = affine_map<(d0)[s0, s1] -> (d0 * s1 + s1, s0)>
+// CHECK-DAG: [[UBO0:#map[0-9]*]] = affine_map<()[s0, s1] -> (s0 ceildiv s1)>
 
 // CHECK: func @tile_with_symbolic_loop_upper_bounds([[ARG0:%arg[0-9]+]]: index, [[ARG1:%arg[0-9]+]]: index{{.*}}){{.*}}
 // CHECK:        affine.for [[ARG2:%arg[0-9]+]] = 0 to [[UBO0]](){{.*}}[[ARG0]]{{.*}}
@@ -210,9 +210,9 @@ func.func @tile_with_symbolic_loop_upper_bounds(%t9 : index, %t10: index, %arg0:
 
 // -----
 
-// CHECK-DAG: [[LBI0:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0)>
-// CHECK-DAG: [[UBI0:#map[0-9]+]] = affine_map<(d0)[s0, s1, s2] -> (d0 * s2 + s2, s0 + s1)>
-// CHECK-DAG: [[UBO0:#map[0-9]+]] = affine_map<()[s0, s1, s2] -> ((s0 + s1) ceildiv s2)>
+// CHECK-DAG: [[LBI0:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0)>
+// CHECK-DAG: [[UBI0:#map[0-9]*]] = affine_map<(d0)[s0, s1, s2] -> (d0 * s2 + s2, s0 + s1)>
+// CHECK-DAG: [[UBO0:#map[0-9]*]] = affine_map<()[s0, s1, s2] -> ((s0 + s1) ceildiv s2)>
 
 // CHECK: func @tile_with_loop_upper_bounds_in_two_symbols([[ARG0:%arg[0-9]+]]: index{{.*}}){{.*}}
 func.func @tile_with_loop_upper_bounds_in_two_symbols(%t11 : index, %arg0: memref<?xf32>, %limit: index) {
@@ -229,11 +229,11 @@ func.func @tile_with_loop_upper_bounds_in_two_symbols(%t11 : index, %arg0: memre
 
 // -----
 
-// CHECK-DAG: [[LBI0:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0)>
-// CHECK-DAG: [[UBI1:#map[0-9]+]] = affine_map<(d0, d1)[s0, s1] -> (d1 * s1 + s1, d0 + s0 + 4)>
-// CHECK-DAG: [[UBI0:#map[0-9]+]] = affine_map<(d0, d1)[s0, s1] -> (d1 * s1 + s1, d0 + s0 + 2)>
-// CHECK-DAG: [[UBO1:#map[0-9]+]] = affine_map<(d0)[s0, s1] -> ((d0 + s0 + 4) ceildiv s1)>
-// CHECK-DAG: [[UBO0:#map[0-9]+]] = affine_map<(d0)[s0, s1] -> ((d0 + s0 + 2) ceildiv s1)>
+// CHECK-DAG: [[LBI0:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0)>
+// CHECK-DAG: [[UBI1:#map[0-9]*]] = affine_map<(d0, d1)[s0, s1] -> (d1 * s1 + s1, d0 + s0 + 4)>
+// CHECK-DAG: [[UBI0:#map[0-9]*]] = affine_map<(d0, d1)[s0, s1] -> (d1 * s1 + s1, d0 + s0 + 2)>
+// CHECK-DAG: [[UBO1:#map[0-9]*]] = affine_map<(d0)[s0, s1] -> ((d0 + s0 + 4) ceildiv s1)>
+// CHECK-DAG: [[UBO0:#map[0-9]*]] = affine_map<(d0)[s0, s1] -> ((d0 + s0 + 2) ceildiv s1)>
 
 // CHECK: func @tile_with_upper_bounds_in_dimensions_and_symbols([[ARG0:%arg[0-9]+]]: index, [[ARG1:%arg[0-9]+]]: index, [[ARG2:%arg[0-9]+]]: index, [[ARG3:%arg[0-9]+]]: index{{.*}}){{.*}}
 // CHECK-NEXT: affine.for [[ARG4:%arg[0-9]+]] = 0 to [[UBO0]]({{.*}}){{.*}}[[ARG0]]
@@ -251,11 +251,11 @@ func.func @tile_with_upper_bounds_in_dimensions_and_symbols(%t12 : index, %t13 :
 
 // -----
 
-// CHECK-DAG: [[LBI0:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 * s0)>
-// CHECK-DAG: [[UBI1:#map[0-9]+]] = affine_map<(d0, d1)[s0, s1] -> (d1 * s1 + s1 * 4, d0 + s0 + 4)>
-// CHECK-DAG: [[UBI0:#map[0-9]+]] = affine_map<(d0, d1)[s0, s1] -> (d1 * s1 + s1 * 2, d0 + s0 + 2)>
-// CHECK-DAG: [[UBO1:#map[0-9]+]] = affine_map<(d0)[s0, s1] -> ((d0 + s0 + 4) ceildiv s1)>
-// CHECK-DAG: [[UBO0:#map[0-9]+]] = affine_map<(d0)[s0, s1] -> ((d0 + s0 + 2) ceildiv s1)>
+// CHECK-DAG: [[LBI0:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 * s0)>
+// CHECK-DAG: [[UBI1:#map[0-9]*]] = affine_map<(d0, d1)[s0, s1] -> (d1 * s1 + s1 * 4, d0 + s0 + 4)>
+// CHECK-DAG: [[UBI0:#map[0-9]*]] = affine_map<(d0, d1)[s0, s1] -> (d1 * s1 + s1 * 2, d0 + s0 + 2)>
+// CHECK-DAG: [[UBO1:#map[0-9]*]] = affine_map<(d0)[s0, s1] -> ((d0 + s0 + 4) ceildiv s1)>
+// CHECK-DAG: [[UBO0:#map[0-9]*]] = affine_map<(d0)[s0, s1] -> ((d0 + s0 + 2) ceildiv s1)>
 
 // CHECK: func @tile_with_upper_bounds_in_dimensions_and_symbols_non_unit_steps
 // CHECK-SAME: ([[ARG0:%arg[0-9]+]]: index, [[ARG1:%arg[0-9]+]]: index, [[ARG2:%arg[0-9]+]]: index, [[ARG3:%arg[0-9]+]]: index{{.*}}){{.*}}

diff  --git a/mlir/test/Dialect/Affine/loop-tiling-validity.mlir b/mlir/test/Dialect/Affine/loop-tiling-validity.mlir
index 7fe940c8430f4..d1b80520ca7fe 100644
--- a/mlir/test/Dialect/Affine/loop-tiling-validity.mlir
+++ b/mlir/test/Dialect/Affine/loop-tiling-validity.mlir
@@ -4,8 +4,8 @@
 
 // There is no dependence violated in this case. No error should be raised.
 
-// CHECK-DAG: [[$LB:#map[0-9]+]] = affine_map<(d0) -> (d0)>
-// CHECK-DAG: [[$UB:#map[0-9]+]] = affine_map<(d0) -> (d0 + 32)>
+// CHECK-DAG: [[$LB:#map[0-9]*]] = affine_map<(d0) -> (d0)>
+// CHECK-DAG: [[$UB:#map[0-9]*]] = affine_map<(d0) -> (d0 + 32)>
 
 // CHECK-LABEL: func @legal_loop()
 func.func @legal_loop() {

diff  --git a/mlir/test/Dialect/Affine/loop-tiling.mlir b/mlir/test/Dialect/Affine/loop-tiling.mlir
index 04c1cf334d140..b84ffe10867a9 100644
--- a/mlir/test/Dialect/Affine/loop-tiling.mlir
+++ b/mlir/test/Dialect/Affine/loop-tiling.mlir
@@ -4,10 +4,10 @@
 
 // -----
 
-// CHECK-DAG: [[$UB:#map[0-9]+]] = affine_map<(d0) -> (d0 + 32)>
-// CHECK-DAG: [[$UB_MIN:#map[0-9]+]] = affine_map<(d0) -> (d0 + 32, 50)>
-// CHECK-DAG: [[$ID:#map[0-9]+]] = affine_map<(d0) -> (d0)>
-// CHECK-DAG: [[$ID_PLUS_21:#map[0-9]+]] = affine_map<(d0) -> (d0 + 21)>
+// CHECK-DAG: [[$UB:#map[0-9]*]] = affine_map<(d0) -> (d0 + 32)>
+// CHECK-DAG: [[$UB_MIN:#map[0-9]*]] = affine_map<(d0) -> (d0 + 32, 50)>
+// CHECK-DAG: [[$ID:#map[0-9]*]] = affine_map<(d0) -> (d0)>
+// CHECK-DAG: [[$ID_PLUS_21:#map[0-9]*]] = affine_map<(d0) -> (d0 + 21)>
 
 // CHECK-LABEL: func @loop_tiling()
 // CHECK-NEXT:   affine.for %{{.*}} = 0 to 256 step 32 {
@@ -57,10 +57,10 @@ func.func @loop_tiling() {
 
 // -----
 
-// CHECK-DAG: [[$IDENTITY:#map[0-9]+]] = affine_map<(d0) -> (d0)>
-// CHECK-DAG: [[$LB:#map[0-9]+]] = affine_map<()[s0] -> (0, s0)>
-// CHECK-DAG: [[$UB:#map[0-9]+]] = affine_map<()[s0, s1] -> (s0, 4096 floordiv s1)>
-// CHECK-DAG: [[$UB_INTRA_TILE:#map[0-9]+]] = affine_map<(d0)[s0, s1] -> (d0 + 32, s0, 4096 floordiv s1)>
+// CHECK-DAG: [[$IDENTITY:#map[0-9]*]] = affine_map<(d0) -> (d0)>
+// CHECK-DAG: [[$LB:#map[0-9]*]] = affine_map<()[s0] -> (0, s0)>
+// CHECK-DAG: [[$UB:#map[0-9]*]] = affine_map<()[s0, s1] -> (s0, 4096 floordiv s1)>
+// CHECK-DAG: [[$UB_INTRA_TILE:#map[0-9]*]] = affine_map<(d0)[s0, s1] -> (d0 + 32, s0, 4096 floordiv s1)>
 
 #lb = affine_map<()[s0] -> (0, s0)>
 #ub = affine_map<()[s0, s1] -> (s0, 4096 floordiv s1)>
@@ -108,7 +108,7 @@ func.func @simple_matmul(%arg0: memref<256x256xvector<64xf32>>, %arg1: memref<25
 
 // -----
 
-// CHECK-DAG: [[$UBMAP:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 + 32, s0)>
+// CHECK-DAG: [[$UBMAP:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 + 32, s0)>
 
 func.func @tile_with_symbolic_loop_upper_bounds(%arg0: memref<?x?xf32>, %arg1: memref<?x?xf32>, %arg2: memref<?x?xf32>) {
   %cst = arith.constant 0.000000e+00 : f32
@@ -133,8 +133,8 @@ func.func @tile_with_symbolic_loop_upper_bounds(%arg0: memref<?x?xf32>, %arg1: m
 // CHECK:       memref.dim %{{.*}}, %c0 : memref<?x?xf32>
 // CHECK-NEXT:  affine.for %{{.*}} = 0 to %{{.*}} step 32 {
 // CHECK-NEXT:    affine.for %{{.*}} = 0 to %{{.*}} step 32 {
-// CHECK-NEXT:      affine.for %{{.*}} = #map0(%{{.*}}) to min [[$UBMAP]](%{{.*}})[%{{.*}}] {
-// CHECK-NEXT:        affine.for %{{.*}} = #map0(%{{.*}}) to min [[$UBMAP]](%{{.*}})[%{{.*}}] {
+// CHECK-NEXT:      affine.for %{{.*}} = #map(%{{.*}}) to min [[$UBMAP]](%{{.*}})[%{{.*}}] {
+// CHECK-NEXT:        affine.for %{{.*}} = #map(%{{.*}}) to min [[$UBMAP]](%{{.*}})[%{{.*}}] {
 // CHECK-NEXT:          affine.store %{{.*}}, %{{.*}}[%{{.*}}, %{{.*}}] : memref<?x?xf32>
 // CHECK-NEXT:          affine.for %{{.*}} = 0 to %{{.*}} {
 // CHECK-NEXT:            affine.load
@@ -152,9 +152,9 @@ func.func @tile_with_symbolic_loop_upper_bounds(%arg0: memref<?x?xf32>, %arg1: m
 
 // -----
 
-// CHECK-DAG: [[MAP0:#map[0-9]+]] = affine_map<(d0) -> (d0)>
-// CHECK-DAG: [[MAP1:#map[0-9]+]] = affine_map<()[s0, s1] -> (s0 + s1)>
-// CHECK-DAG: [[$UBMAP:#map[0-9]+]] = affine_map<(d0)[s0, s1] -> (d0 + 32, s0 + s1)>
+// CHECK-DAG: [[MAP0:#map[0-9]*]] = affine_map<(d0) -> (d0)>
+// CHECK-DAG: [[MAP1:#map[0-9]*]] = affine_map<()[s0, s1] -> (s0 + s1)>
+// CHECK-DAG: [[$UBMAP:#map[0-9]*]] = affine_map<(d0)[s0, s1] -> (d0 + 32, s0 + s1)>
 
 func.func @tile_with_loop_upper_bounds_in_two_symbols(%arg0: memref<?xf32>, %limit: index) {
   %c0 = arith.constant 0 : index
@@ -175,7 +175,7 @@ func.func @tile_with_loop_upper_bounds_in_two_symbols(%arg0: memref<?xf32>, %lim
 // -----
 
 // CHECK-DAG:  #[[$ID:.*]] = affine_map<(d0) -> (d0)>
-// CHECK-DAG:  [[$UBMAP:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 + 160, s0)>
+// CHECK-DAG:  [[$UBMAP:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 + 160, s0)>
 
 func.func @tile_loop_with_non_unit_step(%arg0 : memref<50xf32>, %arg1 : index) {
   affine.for %i = 0 to %arg1 step 5 {

diff  --git a/mlir/test/Dialect/Affine/ops.mlir b/mlir/test/Dialect/Affine/ops.mlir
index 49b100ccdb5c0..9485dae6690db 100644
--- a/mlir/test/Dialect/Affine/ops.mlir
+++ b/mlir/test/Dialect/Affine/ops.mlir
@@ -52,7 +52,7 @@ func.func @affine.yield() {
   // GENERIC:      "affine.for"() ({
   // GENERIC-NEXT: ^bb0(%{{.*}}: index):	
   // GENERIC-NEXT:   "affine.yield"() : () -> ()
-  // GENERIC-NEXT: }) {lower_bound = #map0, step = 1 : index, upper_bound = #map1} : () -> ()
+  // GENERIC-NEXT: }) {lower_bound = #map, step = 1 : index, upper_bound = #map1} : () -> ()
   affine.for %i = 0 to 10 {
     "affine.yield"() : () -> ()
   }
@@ -61,10 +61,10 @@ func.func @affine.yield() {
 
 // -----
 
-// CHECK-DAG: #[[$MAP0:map[0-9]+]] = affine_map<(d0)[s0] -> (1000, d0 + 512, s0)>
-// CHECK-DAG: #[[$MAP1:map[0-9]+]] = affine_map<(d0, d1)[s0] -> (d0 - d1, s0 + 512)>
-// CHECK-DAG: #[[$MAP2:map[0-9]+]] = affine_map<()[s0, s1] -> (s0 - s1, 11)>
-// CHECK-DAG: #[[$MAP3:map[0-9]+]] = affine_map<() -> (77, 78, 79)>
+// CHECK-DAG: #[[$MAP0:map[0-9]*]] = affine_map<(d0)[s0] -> (1000, d0 + 512, s0)>
+// CHECK-DAG: #[[$MAP1:map[0-9]*]] = affine_map<(d0, d1)[s0] -> (d0 - d1, s0 + 512)>
+// CHECK-DAG: #[[$MAP2:map[0-9]*]] = affine_map<()[s0, s1] -> (s0 - s1, 11)>
+// CHECK-DAG: #[[$MAP3:map[0-9]*]] = affine_map<() -> (77, 78, 79)>
 
 // CHECK-LABEL: @affine_min
 func.func @affine_min(%arg0 : index, %arg1 : index, %arg2 : index) {

diff  --git a/mlir/test/Dialect/Affine/scalrep.mlir b/mlir/test/Dialect/Affine/scalrep.mlir
index 30ee888c9139f..f220ef6502b42 100644
--- a/mlir/test/Dialect/Affine/scalrep.mlir
+++ b/mlir/test/Dialect/Affine/scalrep.mlir
@@ -1,10 +1,10 @@
 // RUN: mlir-opt -allow-unregistered-dialect %s -affine-scalrep | FileCheck %s
 
-// CHECK-DAG: [[$MAP0:#map[0-9]+]] = affine_map<(d0, d1) -> (d1 + 1)>
-// CHECK-DAG: [[$MAP1:#map[0-9]+]] = affine_map<(d0, d1) -> (d0)>
-// CHECK-DAG: [[$MAP2:#map[0-9]+]] = affine_map<(d0, d1) -> (d1)>
-// CHECK-DAG: [[$MAP3:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 - 1)>
-// CHECK-DAG: [[$MAP4:#map[0-9]+]] = affine_map<(d0) -> (d0 + 1)>
+// CHECK-DAG: [[$MAP0:#map[0-9]*]] = affine_map<(d0, d1) -> (d1 + 1)>
+// CHECK-DAG: [[$MAP1:#map[0-9]*]] = affine_map<(d0, d1) -> (d0)>
+// CHECK-DAG: [[$MAP2:#map[0-9]*]] = affine_map<(d0, d1) -> (d1)>
+// CHECK-DAG: [[$MAP3:#map[0-9]*]] = affine_map<(d0, d1) -> (d0 - 1)>
+// CHECK-DAG: [[$MAP4:#map[0-9]*]] = affine_map<(d0) -> (d0 + 1)>
 
 // CHECK-LABEL: func @simple_store_load() {
 func.func @simple_store_load() {

diff  --git a/mlir/test/Dialect/Affine/unroll-jam.mlir b/mlir/test/Dialect/Affine/unroll-jam.mlir
index 01fbc977363f1..7874580b1c39c 100644
--- a/mlir/test/Dialect/Affine/unroll-jam.mlir
+++ b/mlir/test/Dialect/Affine/unroll-jam.mlir
@@ -1,14 +1,14 @@
 // RUN: mlir-opt -allow-unregistered-dialect %s -affine-loop-unroll-jam="unroll-jam-factor=2" | FileCheck %s
 // RUN: mlir-opt -allow-unregistered-dialect %s -affine-loop-unroll-jam="unroll-jam-factor=4" | FileCheck --check-prefix=UJAM-FOUR %s
 
-// CHECK-DAG: [[$MAP_PLUS_1:#map[0-9]+]] = affine_map<(d0) -> (d0 + 1)>
-// CHECK-DAG: [[$MAP_DIV_OFFSET:#map[0-9]+]] = affine_map<()[s0] -> (((s0 - 1) floordiv 2) * 2 + 1)>
-// CHECK-DAG: [[$MAP_SYM_UB:#map[0-9]+]] = affine_map<()[s0, s1] -> (s0, s1, 1024)>
+// CHECK-DAG: [[$MAP_PLUS_1:#map[0-9]*]] = affine_map<(d0) -> (d0 + 1)>
+// CHECK-DAG: [[$MAP_DIV_OFFSET:#map[0-9]*]] = affine_map<()[s0] -> (((s0 - 1) floordiv 2) * 2 + 1)>
+// CHECK-DAG: [[$MAP_SYM_UB:#map[0-9]*]] = affine_map<()[s0, s1] -> (s0, s1, 1024)>
 
-// UJAM-FOUR-DAG: [[$UBMAP:#map[0-9]+]] = affine_map<()[s0] -> (s0 + 8)>
-// UJAM-FOUR-DAG: [[$MAP_PLUS_1:#map[0-9]+]] = affine_map<(d0) -> (d0 + 1)>
-// UJAM-FOUR-DAG: [[$MAP_PLUS_2:#map[0-9]+]] = affine_map<(d0) -> (d0 + 2)>
-// UJAM-FOUR-DAG: [[$MAP_PLUS_3:#map[0-9]+]] = affine_map<(d0) -> (d0 + 3)>
+// UJAM-FOUR-DAG: [[$UBMAP:#map[0-9]*]] = affine_map<()[s0] -> (s0 + 8)>
+// UJAM-FOUR-DAG: [[$MAP_PLUS_1:#map[0-9]*]] = affine_map<(d0) -> (d0 + 1)>
+// UJAM-FOUR-DAG: [[$MAP_PLUS_2:#map[0-9]*]] = affine_map<(d0) -> (d0 + 2)>
+// UJAM-FOUR-DAG: [[$MAP_PLUS_3:#map[0-9]*]] = affine_map<(d0) -> (d0 + 3)>
 
 // CHECK-LABEL: func @unroll_jam_imperfect_nest() {
 func.func @unroll_jam_imperfect_nest() {

diff  --git a/mlir/test/Dialect/Affine/unroll.mlir b/mlir/test/Dialect/Affine/unroll.mlir
index 2d324740feb41..c6fe6ef655fb9 100644
--- a/mlir/test/Dialect/Affine/unroll.mlir
+++ b/mlir/test/Dialect/Affine/unroll.mlir
@@ -4,24 +4,24 @@
 // RUN: mlir-opt -allow-unregistered-dialect %s -affine-loop-unroll="unroll-factor=1" | FileCheck %s --check-prefix UNROLL-BY-1
 // RUN: mlir-opt -allow-unregistered-dialect %s -affine-loop-unroll="unroll-factor=5 cleanup-unroll=true" | FileCheck %s --check-prefix UNROLL-CLEANUP-LOOP
 
-// UNROLL-FULL-DAG: [[$MAP0:#map[0-9]+]] = affine_map<(d0) -> (d0 + 1)>
-// UNROLL-FULL-DAG: [[$MAP1:#map[0-9]+]] = affine_map<(d0) -> (d0 + 2)>
-// UNROLL-FULL-DAG: [[$MAP2:#map[0-9]+]] = affine_map<(d0) -> (d0 + 3)>
-// UNROLL-FULL-DAG: [[$MAP3:#map[0-9]+]] = affine_map<(d0) -> (d0 + 4)>
-// UNROLL-FULL-DAG: [[$MAP4:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 + 1)>
-// UNROLL-FULL-DAG: [[$MAP5:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 + 3)>
-// UNROLL-FULL-DAG: [[$MAP6:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 + s0 + 1)>
-
-// SHORT-DAG: [[$MAP0:#map[0-9]+]] = affine_map<(d0) -> (d0 + 1)>
-
-// UNROLL-BY-4-DAG: [[$MAP0:#map[0-9]+]] = affine_map<(d0) -> (d0 + 1)>
-// UNROLL-BY-4-DAG: [[$MAP1:#map[0-9]+]] = affine_map<(d0) -> (d0 + 2)>
-// UNROLL-BY-4-DAG: [[$MAP2:#map[0-9]+]] = affine_map<(d0) -> (d0 + 3)>
-// UNROLL-BY-4-DAG: [[$MAP3:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 + 1)>
-// UNROLL-BY-4-DAG: [[$MAP4:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 + 3)>
-// UNROLL-BY-4-DAG: [[$MAP5:#map[0-9]+]] = affine_map<(d0)[s0] -> (d0 + s0 + 1)>
-// UNROLL-BY-4-DAG: [[$MAP6:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 * 16 + d1)>
-// UNROLL-BY-4-DAG: [[$MAP11:#map[0-9]+]] = affine_map<(d0) -> (d0)>
+// UNROLL-FULL-DAG: [[$MAP0:#map[0-9]*]] = affine_map<(d0) -> (d0 + 1)>
+// UNROLL-FULL-DAG: [[$MAP1:#map[0-9]*]] = affine_map<(d0) -> (d0 + 2)>
+// UNROLL-FULL-DAG: [[$MAP2:#map[0-9]*]] = affine_map<(d0) -> (d0 + 3)>
+// UNROLL-FULL-DAG: [[$MAP3:#map[0-9]*]] = affine_map<(d0) -> (d0 + 4)>
+// UNROLL-FULL-DAG: [[$MAP4:#map[0-9]*]] = affine_map<(d0, d1) -> (d0 + 1)>
+// UNROLL-FULL-DAG: [[$MAP5:#map[0-9]*]] = affine_map<(d0, d1) -> (d0 + 3)>
+// UNROLL-FULL-DAG: [[$MAP6:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 + s0 + 1)>
+
+// SHORT-DAG: [[$MAP0:#map[0-9]*]] = affine_map<(d0) -> (d0 + 1)>
+
+// UNROLL-BY-4-DAG: [[$MAP0:#map[0-9]*]] = affine_map<(d0) -> (d0 + 1)>
+// UNROLL-BY-4-DAG: [[$MAP1:#map[0-9]*]] = affine_map<(d0) -> (d0 + 2)>
+// UNROLL-BY-4-DAG: [[$MAP2:#map[0-9]*]] = affine_map<(d0) -> (d0 + 3)>
+// UNROLL-BY-4-DAG: [[$MAP3:#map[0-9]*]] = affine_map<(d0, d1) -> (d0 + 1)>
+// UNROLL-BY-4-DAG: [[$MAP4:#map[0-9]*]] = affine_map<(d0, d1) -> (d0 + 3)>
+// UNROLL-BY-4-DAG: [[$MAP5:#map[0-9]*]] = affine_map<(d0)[s0] -> (d0 + s0 + 1)>
+// UNROLL-BY-4-DAG: [[$MAP6:#map[0-9]*]] = affine_map<(d0, d1) -> (d0 * 16 + d1)>
+// UNROLL-BY-4-DAG: [[$MAP11:#map[0-9]*]] = affine_map<(d0) -> (d0)>
 
 // UNROLL-FULL-LABEL: func @loop_nest_simplest() {
 func.func @loop_nest_simplest() {
@@ -323,13 +323,13 @@ func.func @unroll_unit_stride_no_cleanup() {
     // UNROLL-BY-4: for [[L1:%arg[0-9]+]] = 0 to 8 step 4 {
     // UNROLL-BY-4-NEXT: %0 = "addi32"([[L1]], [[L1]]) : (index, index) -> i32
     // UNROLL-BY-4-NEXT: %1 = "addi32"(%0, %0) : (i32, i32) -> i32
-    // UNROLL-BY-4-NEXT: %2 = affine.apply #map{{[0-9]+}}([[L1]])
+    // UNROLL-BY-4-NEXT: %2 = affine.apply #map{{[0-9]*}}([[L1]])
     // UNROLL-BY-4-NEXT: %3 = "addi32"(%2, %2) : (index, index) -> i32
     // UNROLL-BY-4-NEXT: %4 = "addi32"(%3, %3) : (i32, i32) -> i32
-    // UNROLL-BY-4-NEXT: %5 = affine.apply #map{{[0-9]+}}([[L1]])
+    // UNROLL-BY-4-NEXT: %5 = affine.apply #map{{[0-9]*}}([[L1]])
     // UNROLL-BY-4-NEXT: %6 = "addi32"(%5, %5) : (index, index) -> i32
     // UNROLL-BY-4-NEXT: %7 = "addi32"(%6, %6) : (i32, i32) -> i32
-    // UNROLL-BY-4-NEXT: %8 = affine.apply #map{{[0-9]+}}([[L1]])
+    // UNROLL-BY-4-NEXT: %8 = affine.apply #map{{[0-9]*}}([[L1]])
     // UNROLL-BY-4-NEXT: %9 = "addi32"(%8, %8) : (index, index) -> i32
     // UNROLL-BY-4-NEXT: %10 = "addi32"(%9, %9) : (i32, i32) -> i32
     // UNROLL-BY-4-NEXT: }
@@ -352,13 +352,13 @@ func.func @unroll_unit_stride_cleanup() {
     // UNROLL-BY-4: for [[L1:%arg[0-9]+]] = 0 to 8 step 4 {
     // UNROLL-BY-4-NEXT:   %0 = "addi32"([[L1]], [[L1]]) : (index, index) -> i32
     // UNROLL-BY-4-NEXT:   %1 = "addi32"(%0, %0) : (i32, i32) -> i32
-    // UNROLL-BY-4-NEXT:   %2 = affine.apply #map{{[0-9]+}}([[L1]])
+    // UNROLL-BY-4-NEXT:   %2 = affine.apply #map{{[0-9]*}}([[L1]])
     // UNROLL-BY-4-NEXT:   %3 = "addi32"(%2, %2) : (index, index) -> i32
     // UNROLL-BY-4-NEXT:   %4 = "addi32"(%3, %3) : (i32, i32) -> i32
-    // UNROLL-BY-4-NEXT:   %5 = affine.apply #map{{[0-9]+}}([[L1]])
+    // UNROLL-BY-4-NEXT:   %5 = affine.apply #map{{[0-9]*}}([[L1]])
     // UNROLL-BY-4-NEXT:   %6 = "addi32"(%5, %5) : (index, index) -> i32
     // UNROLL-BY-4-NEXT:   %7 = "addi32"(%6, %6) : (i32, i32) -> i32
-    // UNROLL-BY-4-NEXT:   %8 = affine.apply #map{{[0-9]+}}([[L1]])
+    // UNROLL-BY-4-NEXT:   %8 = affine.apply #map{{[0-9]*}}([[L1]])
     // UNROLL-BY-4-NEXT:   %9 = "addi32"(%8, %8) : (index, index) -> i32
     // UNROLL-BY-4-NEXT:   %10 = "addi32"(%9, %9) : (i32, i32) -> i32
     // UNROLL-BY-4-NEXT: }
@@ -381,13 +381,13 @@ func.func @unroll_non_unit_stride_cleanup() {
     // UNROLL-BY-4: for [[L1:%arg[0-9]+]] = 2 to 42 step 20 {
     // UNROLL-BY-4-NEXT: %0 = "addi32"([[L1]], [[L1]]) : (index, index) -> i32
     // UNROLL-BY-4-NEXT: %1 = "addi32"(%0, %0) : (i32, i32) -> i32
-    // UNROLL-BY-4-NEXT: %2 = affine.apply #map{{[0-9]+}}([[L1]])
+    // UNROLL-BY-4-NEXT: %2 = affine.apply #map{{[0-9]*}}([[L1]])
     // UNROLL-BY-4-NEXT: %3 = "addi32"(%2, %2) : (index, index) -> i32
     // UNROLL-BY-4-NEXT: %4 = "addi32"(%3, %3) : (i32, i32) -> i32
-    // UNROLL-BY-4-NEXT: %5 = affine.apply #map{{[0-9]+}}([[L1]])
+    // UNROLL-BY-4-NEXT: %5 = affine.apply #map{{[0-9]*}}([[L1]])
     // UNROLL-BY-4-NEXT: %6 = "addi32"(%5, %5) : (index, index) -> i32
     // UNROLL-BY-4-NEXT: %7 = "addi32"(%6, %6) : (i32, i32) -> i32
-    // UNROLL-BY-4-NEXT: %8 = affine.apply #map{{[0-9]+}}([[L1]])
+    // UNROLL-BY-4-NEXT: %8 = affine.apply #map{{[0-9]*}}([[L1]])
     // UNROLL-BY-4-NEXT: %9 = "addi32"(%8, %8) : (index, index) -> i32
     // UNROLL-BY-4-NEXT: %10 = "addi32"(%9, %9) : (i32, i32) -> i32
     // UNROLL-BY-4-NEXT: }
@@ -432,7 +432,7 @@ func.func @loop_nest_single_iteration_after_unroll(%N: index) {
 // UNROLL-BY-4-LABEL: func @loop_nest_operand1() {
 func.func @loop_nest_operand1() {
 // UNROLL-BY-4:      affine.for %arg0 = 0 to 100 step 2 {
-// UNROLL-BY-4-NEXT:   affine.for %arg1 = 0 to #map{{[0-9]+}}(%arg0) step 4
+// UNROLL-BY-4-NEXT:   affine.for %arg1 = 0 to #map{{[0-9]*}}(%arg0) step 4
 // UNROLL-BY-4-NEXT:      %0 = "foo"() : () -> i32
 // UNROLL-BY-4-NEXT:      %1 = "foo"() : () -> i32
 // UNROLL-BY-4-NEXT:      %2 = "foo"() : () -> i32
@@ -452,7 +452,7 @@ func.func @loop_nest_operand1() {
 // UNROLL-BY-4-LABEL: func @loop_nest_operand2() {
 func.func @loop_nest_operand2() {
 // UNROLL-BY-4:      affine.for %arg0 = 0 to 100 step 2 {
-// UNROLL-BY-4-NEXT:   affine.for %arg1 = [[$MAP11]](%arg0) to #map{{[0-9]+}}(%arg0) step 4 {
+// UNROLL-BY-4-NEXT:   affine.for %arg1 = [[$MAP11]](%arg0) to #map{{[0-9]*}}(%arg0) step 4 {
 // UNROLL-BY-4-NEXT:     %0 = "foo"() : () -> i32
 // UNROLL-BY-4-NEXT:     %1 = "foo"() : () -> i32
 // UNROLL-BY-4-NEXT:     %2 = "foo"() : () -> i32
@@ -498,7 +498,7 @@ func.func @floordiv_mod_ub(%M : index, %N : index) {
 func.func @loop_nest_operand3() {
   // UNROLL-BY-4: affine.for %arg0 = 0 to 100 step 2 {
   affine.for %i = 0 to 100 step 2 {
-    // UNROLL-BY-4: affine.for %arg1 = [[$MAP11]](%arg0) to #map{{[0-9]+}}(%arg0) step 4 {
+    // UNROLL-BY-4: affine.for %arg1 = [[$MAP11]](%arg0) to #map{{[0-9]*}}(%arg0) step 4 {
     // UNROLL-BY-4-NEXT: %1 = "foo"() : () -> i32
     // UNROLL-BY-4-NEXT: %2 = "foo"() : () -> i32
     // UNROLL-BY-4-NEXT: %3 = "foo"() : () -> i32
@@ -516,14 +516,14 @@ func.func @loop_nest_operand3() {
 func.func @loop_nest_symbolic_bound(%N : index) {
   // UNROLL-BY-4: affine.for %arg1 = 0 to 100 {
   affine.for %i = 0 to 100 {
-    // UNROLL-BY-4: affine.for %arg2 = 0 to #map{{[0-9]+}}()[%arg0] step 4 {
+    // UNROLL-BY-4: affine.for %arg2 = 0 to #map{{[0-9]*}}()[%arg0] step 4 {
     // UNROLL-BY-4: %0 = "foo"() : () -> i32
     // UNROLL-BY-4-NEXT: %1 = "foo"() : () -> i32
     // UNROLL-BY-4-NEXT: %2 = "foo"() : () -> i32
     // UNROLL-BY-4-NEXT: %3 = "foo"() : () -> i32
     // UNROLL-BY-4-NEXT: }
     // A cleanup loop will be be generated here.
-    // UNROLL-BY-4-NEXT: affine.for %arg2 = #map{{[0-9]+}}()[%arg0] to %arg0 {
+    // UNROLL-BY-4-NEXT: affine.for %arg2 = #map{{[0-9]*}}()[%arg0] to %arg0 {
     // UNROLL-BY-4-NEXT: %0 = "foo"() : () -> i32
     // UNROLL-BY-4-NEXT: }
     affine.for %j = 0 to %N {
@@ -541,14 +541,14 @@ func.func @loop_nest_symbolic_bound_with_step(%N : index) {
     affine.for %j = 0 to %N step 3 {
       %x = "foo"() : () -> i32
     }
-// UNROLL-BY-4:      affine.for %{{.*}} = 0 to #map{{[0-9]+}}()[%[[N]]] step 12 {
+// UNROLL-BY-4:      affine.for %{{.*}} = 0 to #map{{[0-9]*}}()[%[[N]]] step 12 {
 // UNROLL-BY-4:        "foo"()
 // UNROLL-BY-4-NEXT:   "foo"()
 // UNROLL-BY-4-NEXT:   "foo"()
 // UNROLL-BY-4-NEXT:   "foo"()
 // UNROLL-BY-4-NEXT: }
 // A cleanup loop will be be generated here.
-// UNROLL-BY-4-NEXT: affine.for %{{.*}} = #map{{[0-9]+}}()[%[[N]]] to %[[N]] step 3 {
+// UNROLL-BY-4-NEXT: affine.for %{{.*}} = #map{{[0-9]*}}()[%[[N]]] to %[[N]] step 3 {
 // UNROLL-BY-4-NEXT:   "foo"()
 // UNROLL-BY-4-NEXT: }
   }

diff  --git a/mlir/test/Dialect/Linalg/bubble-up-extract-slice-op.mlir b/mlir/test/Dialect/Linalg/bubble-up-extract-slice-op.mlir
index 957dc120fdb78..0e353a1fa43fc 100644
--- a/mlir/test/Dialect/Linalg/bubble-up-extract-slice-op.mlir
+++ b/mlir/test/Dialect/Linalg/bubble-up-extract-slice-op.mlir
@@ -21,7 +21,7 @@ func.func @dynamic(%arg0: tensor<?x?xf32>, %arg1: tensor<?xf32>, %arg2: index, %
 //      CHECK: %[[SLICE0:.+]] = tensor.extract_slice %arg0[%arg2, %arg3] [%arg4, %arg5] [1, 1] : tensor<?x?xf32> to tensor<?x?xf32>
 //      CHECK: %[[SLICE1:.+]] = tensor.extract_slice %arg1[%arg3] [%arg5] [1] : tensor<?xf32> to tensor<?xf32>
 //      CHECK: %[[SLICE2:.+]] = tensor.extract_slice %arg0[%arg2, %arg3] [%arg4, %arg5] [1, 1] : tensor<?x?xf32> to tensor<?x?xf32>
-//      CHECK: %[[GENERIC:.+]] = linalg.generic {indexing_maps = [#map0, #map1, #map0], iterator_types = ["parallel", "parallel"]}
+//      CHECK: %[[GENERIC:.+]] = linalg.generic {indexing_maps = [#map, #map1, #map], iterator_types = ["parallel", "parallel"]}
 // CHECK-SAME: ins(%[[SLICE0]], %[[SLICE1]] : tensor<?x?xf32>, tensor<?xf32>) outs(%[[SLICE2]] : tensor<?x?xf32>)
 //      CHECK: return %[[GENERIC]] : tensor<?x?xf32>
 
@@ -48,7 +48,7 @@ func.func @static(%arg0: tensor<16x8xf32>, %arg1: tensor<8xf32>) -> tensor<4x2xf
 //      CHECK: %[[SLICE0:.+]] = tensor.extract_slice %arg0[8, 4] [4, 2] [1, 1] : tensor<16x8xf32> to tensor<4x2xf32>
 //      CHECK: %[[SLICE1:.+]] = tensor.extract_slice %arg1[4] [2] [1] : tensor<8xf32> to tensor<2xf32>
 //      CHECK: %[[SLICE2:.+]] = tensor.extract_slice %arg0[8, 4] [4, 2] [1, 1] : tensor<16x8xf32> to tensor<4x2xf32>
-//      CHECK: %[[GENERIC:.+]] = linalg.generic {indexing_maps = [#map0, #map1, #map0], iterator_types = ["parallel", "parallel"]}
+//      CHECK: %[[GENERIC:.+]] = linalg.generic {indexing_maps = [#map, #map1, #map], iterator_types = ["parallel", "parallel"]}
 // CHECK-SAME: ins(%[[SLICE0]], %[[SLICE1]] : tensor<4x2xf32>, tensor<2xf32>) outs(%[[SLICE2]] : tensor<4x2xf32>)
 //      CHECK: return %[[GENERIC]] : tensor<4x2xf32>
 
@@ -75,7 +75,7 @@ func.func @mixed(%arg0: tensor<?x8xf32>, %arg1: tensor<8xf32>, %arg2: index, %ar
 //      CHECK: %[[SLICE0:.+]] = tensor.extract_slice %arg0[8, %arg2] [%arg3, 2] [1, 1] : tensor<?x8xf32> to tensor<?x2xf32>
 //      CHECK: %[[SLICE1:.+]] = tensor.extract_slice %arg1[%arg2] [2] [1] : tensor<8xf32> to tensor<2xf32>
 //      CHECK: %[[SLICE2:.+]] = tensor.extract_slice %arg0[8, %arg2] [%arg3, 2] [1, 1] : tensor<?x8xf32> to tensor<?x2xf32>
-//      CHECK: %[[GENERIC:.+]] = linalg.generic {indexing_maps = [#map0, #map1, #map0], iterator_types = ["parallel", "parallel"]}
+//      CHECK: %[[GENERIC:.+]] = linalg.generic {indexing_maps = [#map, #map1, #map], iterator_types = ["parallel", "parallel"]}
 // CHECK-SAME: ins(%[[SLICE0]], %[[SLICE1]] : tensor<?x2xf32>, tensor<2xf32>) outs(%[[SLICE2]] : tensor<?x2xf32>)
 //      CHECK: return %[[GENERIC]] : tensor<?x2xf32>
 
@@ -102,7 +102,7 @@ func.func @dynamic_to_static(%arg0: tensor<?x?xf32>, %arg1: tensor<?xf32>) -> te
 //      CHECK: %[[SLICE0:.+]] = tensor.extract_slice %arg0[8, 4] [4, 2] [1, 1] : tensor<?x?xf32> to tensor<4x2xf32>
 //      CHECK: %[[SLICE1:.+]] = tensor.extract_slice %arg1[4] [2] [1] : tensor<?xf32> to tensor<2xf32>
 //      CHECK: %[[SLICE2:.+]] = tensor.extract_slice %arg0[8, 4] [4, 2] [1, 1] : tensor<?x?xf32> to tensor<4x2xf32>
-//      CHECK: %[[GENERIC:.+]] = linalg.generic {indexing_maps = [#map0, #map1, #map0], iterator_types = ["parallel", "parallel"]}
+//      CHECK: %[[GENERIC:.+]] = linalg.generic {indexing_maps = [#map, #map1, #map], iterator_types = ["parallel", "parallel"]}
 // CHECK-SAME: ins(%[[SLICE0]], %[[SLICE1]] : tensor<4x2xf32>, tensor<2xf32>) outs(%[[SLICE2]] : tensor<4x2xf32>)
 //      CHECK: return %[[GENERIC]] : tensor<4x2xf32>
 

diff  --git a/mlir/test/Dialect/Linalg/tile-to-foreach-thread.mlir b/mlir/test/Dialect/Linalg/tile-to-foreach-thread.mlir
index fb5c72c4f7101..ce0afdfe313b5 100644
--- a/mlir/test/Dialect/Linalg/tile-to-foreach-thread.mlir
+++ b/mlir/test/Dialect/Linalg/tile-to-foreach-thread.mlir
@@ -96,7 +96,7 @@ transform.sequence failures(propagate) {
 func.func @matmul_tile_size_dynamic(%A: tensor<?x?xf32>, %B: tensor<?x?xf32>, %C: tensor<?x?xf32>) -> tensor<?x?xf32> {
   //      CHECK: %[[M:.+]] = tensor.dim %[[A]], %c0 :
   //      CHECK: %[[N:.+]] = tensor.dim %[[B]], %c1 :
-  //      CHECK: %[[NT0:.+]] = affine.apply #map0()[%[[M]]]
+  //      CHECK: %[[NT0:.+]] = affine.apply #map()[%[[M]]]
   //      CHECK: %[[NT1:.+]] = affine.apply #map1()[%[[N]]]
   //      CHECK: scf.foreach_thread (%[[IV0:.+]], %[[IV1:.+]]) in (%[[NT0]], %[[NT1]]) shared_outs(%[[C_BLK:.*]] = %[[C]])
   //      CHECK:   %[[TS0:.+]] = affine.min #[[$map2]](%[[IV0]])[%[[M]]]

diff  --git a/mlir/test/Dialect/MemRef/subview.mlir b/mlir/test/Dialect/MemRef/subview.mlir
index 48af627b327fd..16ba46fbdce9a 100644
--- a/mlir/test/Dialect/MemRef/subview.mlir
+++ b/mlir/test/Dialect/MemRef/subview.mlir
@@ -1,10 +1,10 @@
 // RUN: mlir-opt %s | mlir-opt | FileCheck %s
 // RUN: mlir-opt %s --mlir-print-op-generic | mlir-opt | FileCheck %s
 
-// CHECK-DAG: #[[$BASE_MAP1:map[0-9]+]] = affine_map<(d0)[s0] -> (d0 + s0)>
-// CHECK-DAG: #[[$SUBVIEW_MAP1:map[0-9]+]] = affine_map<(d0)[s0, s1] -> (d0 * s1 + s0)>
-// CHECK-DAG: #[[$SUBVIEW_MAP11:map[0-9]+]] = affine_map<() -> (4)>
-// CHECK-DAG: #[[$SUBVIEW_MAP12:map[0-9]+]] = affine_map<()[s0] -> (s0)>
+// CHECK-DAG: #[[$BASE_MAP1:map[0-9]*]] = affine_map<(d0)[s0] -> (d0 + s0)>
+// CHECK-DAG: #[[$SUBVIEW_MAP1:map[0-9]*]] = affine_map<(d0)[s0, s1] -> (d0 * s1 + s0)>
+// CHECK-DAG: #[[$SUBVIEW_MAP11:map[0-9]*]] = affine_map<() -> (4)>
+// CHECK-DAG: #[[$SUBVIEW_MAP12:map[0-9]*]] = affine_map<()[s0] -> (s0)>
 
 // CHECK-LABEL: func @memref_subview(%arg0
 func.func @memref_subview(%arg0 : index, %arg1 : index, %arg2 : index) {

diff  --git a/mlir/test/Dialect/SCF/parallel-loop-specialization.mlir b/mlir/test/Dialect/SCF/parallel-loop-specialization.mlir
index 0a472b59a9205..f03254405bfee 100644
--- a/mlir/test/Dialect/SCF/parallel-loop-specialization.mlir
+++ b/mlir/test/Dialect/SCF/parallel-loop-specialization.mlir
@@ -26,7 +26,7 @@ func.func @parallel_loop(%outer_i0: index, %outer_i1: index, %A: memref<?x?xf32>
 // CHECK:           [[VAL_7:%.*]] = arith.constant 1 : index
 // CHECK:           [[VAL_8:%.*]] = memref.dim [[VAL_2]], [[VAL_6]] : memref<?x?xf32>
 // CHECK:           [[VAL_9:%.*]] = memref.dim [[VAL_2]], [[VAL_7]] : memref<?x?xf32>
-// CHECK:           [[VAL_10:%.*]] = affine.min #map0(){{\[}}[[VAL_8]], [[VAL_0]]]
+// CHECK:           [[VAL_10:%.*]] = affine.min #map(){{\[}}[[VAL_8]], [[VAL_0]]]
 // CHECK:           [[VAL_11:%.*]] = affine.min #map1(){{\[}}[[VAL_9]], [[VAL_1]]]
 // CHECK:           [[VAL_12:%.*]] = arith.constant 1024 : index
 // CHECK:           [[VAL_13:%.*]] = arith.cmpi eq, [[VAL_10]], [[VAL_12]] : index

diff  --git a/mlir/test/Dialect/Vector/vector-transforms.mlir b/mlir/test/Dialect/Vector/vector-transforms.mlir
index 5d2a981a7e4b7..0c86c7c4b6527 100644
--- a/mlir/test/Dialect/Vector/vector-transforms.mlir
+++ b/mlir/test/Dialect/Vector/vector-transforms.mlir
@@ -1,6 +1,6 @@
 // RUN: mlir-opt %s -test-vector-to-vector-lowering="unroll" | FileCheck %s
 
-// CHECK-DAG: #[[MAP1:map[0-9]+]] = affine_map<(d0, d1, d2) -> (d1, d2)>
+// CHECK-DAG: #[[MAP1:map[0-9]*]] = affine_map<(d0, d1, d2) -> (d1, d2)>
 
 // CHECK-LABEL: func @add4x2
 //      CHECK: %[[S1:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [0, 0], sizes = [2, 2], strides = [1, 1]} : vector<4x2xf32> to vector<2x2xf32>
@@ -82,20 +82,20 @@ func.func @add4x4(%0: vector<4x4xf32>, %1: vector<4x4xf32>) -> vector<4x4xf32> {
 // CHECK-NEXT: %[[S5:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 // CHECK-NEXT: %[[S3:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [0, 0], sizes = [2, 2], strides = [1, 1]} : vector<4x4xf32> to vector<2x2xf32>
 
-// CHECK-NEXT: %[[R1S00:.*]] = vector.contract {indexing_maps = [#map0, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S1]], %[[S2]], %[[S3]], %[[S4]], %[[S5]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R1S00:.*]] = vector.contract {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S1]], %[[S2]], %[[S3]], %[[S4]], %[[S5]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // CHECK-NEXT: %[[S6:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [0, 2], sizes = [2, 2], strides = [1, 1]} : vector<4x6xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S8:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 // CHECK-NEXT: %[[S7:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [2, 0], sizes = [2, 2], strides = [1, 1]} : vector<6x4xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S9:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 
-// CHECK-NEXT: %[[R2S00:.*]] = vector.contract {indexing_maps = [#map0, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S6]], %[[S7]], %[[R1S00]], %[[S8]], %[[S9]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R2S00:.*]] = vector.contract {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S6]], %[[S7]], %[[R1S00]], %[[S8]], %[[S9]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // CHECK-NEXT: %[[S10:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [0, 4], sizes = [2, 2], strides = [1, 1]} : vector<4x6xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S12:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 // CHECK-NEXT: %[[S11:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [4, 0], sizes = [2, 2], strides = [1, 1]} : vector<6x4xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S13:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
-// CHECK-NEXT: %[[R3S00:.*]] = vector.contract {indexing_maps = [#map0, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S10]], %[[S11]], %[[R2S00]], %[[S12]], %[[S13]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R3S00:.*]] = vector.contract {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S10]], %[[S11]], %[[R2S00]], %[[S12]], %[[S13]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // Reducing output vector [0, 2]
 // CHECK-NEXT: %[[S14:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [0, 0], sizes = [2, 2], strides = [1, 1]} : vector<4x6xf32> to vector<2x2xf32>
@@ -103,19 +103,19 @@ func.func @add4x4(%0: vector<4x4xf32>, %1: vector<4x4xf32>) -> vector<4x4xf32> {
 // CHECK-NEXT: %[[S15:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [0, 2], sizes = [2, 2], strides = [1, 1]} : vector<6x4xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S18:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 // CHECK-NEXT: %[[S16:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [0, 2], sizes = [2, 2], strides = [1, 1]} : vector<4x4xf32> to vector<2x2xf32>
-// CHECK-NEXT: %[[R1S02:.*]] = vector.contract {indexing_maps = [#map0, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S14]], %[[S15]], %[[S16]], %[[S17]], %[[S18]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R1S02:.*]] = vector.contract {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S14]], %[[S15]], %[[S16]], %[[S17]], %[[S18]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // CHECK-NEXT: %[[S19:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [0, 2], sizes = [2, 2], strides = [1, 1]} : vector<4x6xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S21:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 // CHECK-NEXT: %[[S20:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [2, 2], sizes = [2, 2], strides = [1, 1]} : vector<6x4xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S22:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
-// CHECK-NEXT: %[[R2S02:.*]] = vector.contract {indexing_maps = [#map0, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S19]], %[[S20]], %[[R1S02]], %[[S21]], %[[S22]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R2S02:.*]] = vector.contract {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S19]], %[[S20]], %[[R1S02]], %[[S21]], %[[S22]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // CHECK-NEXT: %[[S23:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [0, 4], sizes = [2, 2], strides = [1, 1]} : vector<4x6xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S25:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 // CHECK-NEXT: %[[S24:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [4, 2], sizes = [2, 2], strides = [1, 1]} : vector<6x4xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S26:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
-// CHECK-NEXT: %[[R3S02:.*]] = vector.contract {indexing_maps = [#map0, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S23]], %[[S24]], %[[R2S02]], %[[S25]], %[[S26]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R3S02:.*]] = vector.contract {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S23]], %[[S24]], %[[R2S02]], %[[S25]], %[[S26]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // Reducing output vector [2, 0]
 
@@ -124,19 +124,19 @@ func.func @add4x4(%0: vector<4x4xf32>, %1: vector<4x4xf32>) -> vector<4x4xf32> {
 // CHECK-NEXT: %[[S28:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [0, 0], sizes = [2, 2], strides = [1, 1]} : vector<6x4xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S31:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 // CHECK-NEXT: %[[S29:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [2, 0], sizes = [2, 2], strides = [1, 1]} : vector<4x4xf32> to vector<2x2xf32>
-// CHECK-NEXT: %[[R1S20:.*]] = vector.contract {indexing_maps = [#map0, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S27]], %[[S28]], %[[S29]], %[[S30]], %[[S31]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R1S20:.*]] = vector.contract {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S27]], %[[S28]], %[[S29]], %[[S30]], %[[S31]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // CHECK-NEXT: %[[S32:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [2, 2], sizes = [2, 2], strides = [1, 1]} : vector<4x6xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S34:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 // CHECK-NEXT: %[[S33:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [2, 0], sizes = [2, 2], strides = [1, 1]} : vector<6x4xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S35:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
-// CHECK-NEXT:  %[[R2S20:.*]] = vector.contract {indexing_maps = [#map0, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S32]], %[[S33]], %[[R1S20]], %[[S34]], %[[S35]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT:  %[[R2S20:.*]] = vector.contract {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S32]], %[[S33]], %[[R1S20]], %[[S34]], %[[S35]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // CHECK-NEXT: %[[S36:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [2, 4], sizes = [2, 2], strides = [1, 1]} : vector<4x6xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S38:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 // CHECK-NEXT: %[[S37:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [4, 0], sizes = [2, 2], strides = [1, 1]} : vector<6x4xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S39:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
-// CHECK-NEXT:  %[[R3S20:.*]] = vector.contract {indexing_maps = [#map0, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S36]], %[[S37]], %[[R2S20]], %[[S38]], %[[S39]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT:  %[[R3S20:.*]] = vector.contract {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S36]], %[[S37]], %[[R2S20]], %[[S38]], %[[S39]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // Reducing output vector [2, 2]
 
@@ -145,19 +145,19 @@ func.func @add4x4(%0: vector<4x4xf32>, %1: vector<4x4xf32>) -> vector<4x4xf32> {
 // CHECK-NEXT: %[[S41:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [0, 2], sizes = [2, 2], strides = [1, 1]} : vector<6x4xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S44:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 // CHECK-NEXT: %[[S42:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [2, 2], sizes = [2, 2], strides = [1, 1]} : vector<4x4xf32> to vector<2x2xf32>
-// CHECK-NEXT: %[[R1S22:.*]] = vector.contract {indexing_maps = [#map0, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S40]], %[[S41]], %[[S42]], %[[S43]], %[[S44]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R1S22:.*]] = vector.contract {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S40]], %[[S41]], %[[S42]], %[[S43]], %[[S44]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // CHECK-NEXT: %[[S45:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [2, 2], sizes = [2, 2], strides = [1, 1]} : vector<4x6xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S47:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 // CHECK-NEXT: %[[S46:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [2, 2], sizes = [2, 2], strides = [1, 1]} : vector<6x4xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S48:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
-// CHECK-NEXT: %[[R2S22:.*]] = vector.contract {indexing_maps = [#map0, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S45]], %[[S46]], %[[R1S22]], %[[S47]], %[[S48]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R2S22:.*]] = vector.contract {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S45]], %[[S46]], %[[R1S22]], %[[S47]], %[[S48]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // CHECK-NEXT: %[[S49:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [2, 4], sizes = [2, 2], strides = [1, 1]} : vector<4x6xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S51:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 // CHECK-NEXT: %[[S50:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [4, 2], sizes = [2, 2], strides = [1, 1]} : vector<6x4xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S52:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
-// CHECK-NEXT: %[[R3S22:.*]] = vector.contract {indexing_maps = [#map0, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S49]], %[[S50]], %[[R2S22]], %[[S51]], %[[S52]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R3S22:.*]] = vector.contract {indexing_maps = [#map, #map1, #map2], iterator_types = ["parallel", "parallel", "reduction"], kind = #vector.kind<add>} %[[S49]], %[[S50]], %[[R2S22]], %[[S51]], %[[S52]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // CHECK-NEXT: %[[VEC1:.*]] = vector.insert_strided_slice %[[R3S00]], %{{.*}} {offsets = [0, 0], strides = [1, 1]} : vector<2x2xf32> into vector<4x4xf32>
 // CHECK-NEXT: %[[VEC2:.*]] = vector.insert_strided_slice %[[R3S02]], %[[VEC1]] {offsets = [0, 2], strides = [1, 1]} : vector<2x2xf32> into vector<4x4xf32>
@@ -196,7 +196,7 @@ func.func @contraction4x4_ijk(%arg0 : vector<4x6xf32>, %arg1 : vector<6x4xf32>,
 // CHECK-NEXT: %[[S2:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [0, 0], sizes = [2, 2], strides = [1, 1]} : vector<2x4xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S5:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 // CHECK-NEXT: %[[S3:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [0, 0], sizes = [2, 2], strides = [1, 1]} : vector<4x4xf32> to vector<2x2xf32>
-// CHECK-NEXT: %[[R1S00:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map0], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[S1]], %[[S2]], %[[S3]], %[[S4]], %[[S5]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R1S00:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[S1]], %[[S2]], %[[S3]], %[[S4]], %[[S5]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // Reducing output vector [0, 2]
 
@@ -205,7 +205,7 @@ func.func @contraction4x4_ijk(%arg0 : vector<4x6xf32>, %arg1 : vector<6x4xf32>,
 // CHECK-NEXT: %[[S7:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [0, 2], sizes = [2, 2], strides = [1, 1]} : vector<2x4xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S10:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 // CHECK-NEXT: %[[S8:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [0, 2], sizes = [2, 2], strides = [1, 1]} : vector<4x4xf32> to vector<2x2xf32>
-// CHECK-NEXT: %[[R1S02:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map0], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[S6]], %[[S7]], %[[S8]], %[[S9]], %[[S10]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R1S02:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[S6]], %[[S7]], %[[S8]], %[[S9]], %[[S10]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // Reducing output vector [2, 0]
 
@@ -214,7 +214,7 @@ func.func @contraction4x4_ijk(%arg0 : vector<4x6xf32>, %arg1 : vector<6x4xf32>,
 // CHECK-NEXT: %[[S12:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [0, 0], sizes = [2, 2], strides = [1, 1]} : vector<2x4xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S15:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 // CHECK-NEXT: %[[S13:.*]] = vector.extract_strided_slice %{{.*}} {offsets = [2, 0], sizes = [2, 2], strides = [1, 1]} : vector<4x4xf32> to vector<2x2xf32>
-// CHECK-NEXT: %[[R1S20:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map0], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[S11]], %[[S12]], %[[S13]], %[[S14]], %[[S15]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R1S20:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[S11]], %[[S12]], %[[S13]], %[[S14]], %[[S15]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // Reducing output vector [2, 2]
 
@@ -223,7 +223,7 @@ func.func @contraction4x4_ijk(%arg0 : vector<4x6xf32>, %arg1 : vector<6x4xf32>,
 // CHECK-NEXT: %[[S17:.*]] = vector.extract_strided_slice %arg1 {offsets = [0, 2], sizes = [2, 2], strides = [1, 1]} : vector<2x4xf32> to vector<2x2xf32>
 // CHECK-NEXT: %[[S20:.*]] = vector.constant_mask [2, 2] : vector<2x2xi1>
 // CHECK-NEXT: %[[S18:.*]] = vector.extract_strided_slice %arg2 {offsets = [2, 2], sizes = [2, 2], strides = [1, 1]} : vector<4x4xf32> to vector<2x2xf32>
-// CHECK-NEXT: %[[R1S22:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map0], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[S16]], %[[S17]], %[[S18]], %[[S19]], %[[S20]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R1S22:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[S16]], %[[S17]], %[[S18]], %[[S19]], %[[S20]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // CHECK-NEXT: %[[VEC0:.*]] = vector.insert_strided_slice %[[R1S00]], %{{.*}} {offsets = [0, 0], strides = [1, 1]} : vector<2x2xf32> into vector<4x4xf32>
 // CHECK-NEXT: %[[VEC1:.*]] = vector.insert_strided_slice %[[R1S02]], %[[VEC0]] {offsets = [0, 2], strides = [1, 1]} : vector<2x2xf32> into vector<4x4xf32>
@@ -260,10 +260,10 @@ func.func @contraction4x4_ikj(%arg0 : vector<4x2xf32>, %arg1 : vector<2x4xf32>,
 // CHECK-NEXT: %[[VTR6:.*]] = vector.transfer_read %{{.*}}[%[[C2]], %[[C0]]], %{{.*}} : memref<4x4xf32>, vector<2x2xf32>
 // CHECK-NEXT: %[[VTR7:.*]] = vector.transfer_read %{{.*}}[%[[C2]], %[[C2]]], %{{.*}} : memref<4x4xf32>, vector<2x2xf32>
 
-// CHECK-NEXT: %[[R0:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map0], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[VTR0]], %[[VTR2]], %[[VTR4]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
-// CHECK-NEXT: %[[R1:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map0], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[VTR0]], %[[VTR3]], %[[VTR5]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
-// CHECK-NEXT: %[[R2:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map0], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[VTR1]], %[[VTR2]], %[[VTR6]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
-// CHECK-NEXT: %[[R3:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map0], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[VTR1]], %[[VTR3]], %[[VTR7]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R0:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[VTR0]], %[[VTR2]], %[[VTR4]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R1:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[VTR0]], %[[VTR3]], %[[VTR5]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R2:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[VTR1]], %[[VTR2]], %[[VTR6]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R3:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[VTR1]], %[[VTR3]], %[[VTR7]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // CHECK-NEXT: vector.transfer_write %[[R0]], %{{.*}}[%[[C0]], %[[C0]]] {in_bounds = [true, true]} : vector<2x2xf32>, memref<4x4xf32>
 // CHECK-NEXT: vector.transfer_write %[[R1]], %{{.*}}[%[[C0]], %[[C2]]] {in_bounds = [true, true]} : vector<2x2xf32>, memref<4x4xf32>
@@ -389,10 +389,10 @@ func.func @elementwise_unroll(%arg0 : memref<4x4xf32>, %arg1 : memref<4x4xf32>)
 // CHECK-NEXT: %[[VTR6:.*]] = vector.transfer_read %{{.*}}[%[[C2]], %[[C0]]], %{{.*}} : tensor<4x4xf32>, vector<2x2xf32>
 // CHECK-NEXT: %[[VTR7:.*]] = vector.transfer_read %{{.*}}[%[[C2]], %[[C2]]], %{{.*}} : tensor<4x4xf32>, vector<2x2xf32>
 
-// CHECK-NEXT: %[[R0:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map0], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[VTR0]], %[[VTR2]], %[[VTR4]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
-// CHECK-NEXT: %[[R1:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map0], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[VTR0]], %[[VTR3]], %[[VTR5]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
-// CHECK-NEXT: %[[R2:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map0], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[VTR1]], %[[VTR2]], %[[VTR6]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
-// CHECK-NEXT: %[[R3:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map0], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[VTR1]], %[[VTR3]], %[[VTR7]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R0:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[VTR0]], %[[VTR2]], %[[VTR4]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R1:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[VTR0]], %[[VTR3]], %[[VTR5]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R2:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[VTR1]], %[[VTR2]], %[[VTR6]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
+// CHECK-NEXT: %[[R3:.*]] = vector.contract {indexing_maps = [#map2, #map3, #map], iterator_types = ["parallel", "reduction", "parallel"], kind = #vector.kind<add>} %[[VTR1]], %[[VTR3]], %[[VTR7]] : vector<2x2xf32>, vector<2x2xf32> into vector<2x2xf32>
 
 // CHECK-NEXT: %[[VTW0:.*]] = vector.transfer_write %[[R0]], %{{.*}}[%[[C0]], %[[C0]]] {in_bounds = [true, true]} : vector<2x2xf32>, tensor<4x4xf32>
 // CHECK-NEXT: %[[VTW1:.*]] = vector.transfer_write %[[R1]], %[[VTW0]][%[[C0]], %[[C2]]] {in_bounds = [true, true]} : vector<2x2xf32>, tensor<4x4xf32>

diff  --git a/mlir/test/IR/affine-map.mlir b/mlir/test/IR/affine-map.mlir
index 3de5b839ef748..56a105630f9d2 100644
--- a/mlir/test/IR/affine-map.mlir
+++ b/mlir/test/IR/affine-map.mlir
@@ -1,13 +1,13 @@
 // RUN: mlir-opt -allow-unregistered-dialect %s | FileCheck %s
 
 // Identity maps used in trivial compositions in MemRefs are optimized away.
-// CHECK-NOT: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0, d1)>
+// CHECK-NOT: #map{{[0-9]*}} = affine_map<(d0, d1) -> (d0, d1)>
 #map0 = affine_map<(i, j) -> (i, j)>
 
-// CHECK-NOT: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0, d1)>
+// CHECK-NOT: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0, d1)>
 #map1 = affine_map<(i, j)[s0] -> (i, j)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<() -> (0)>
+// CHECK: #map{{[0-9]*}} = affine_map<() -> (0)>
 // A map may have 0 inputs.
 // However, an affine.apply always takes at least one input.
 #map2 = affine_map<() -> (0)>
@@ -15,7 +15,7 @@
 // All the maps in the following block are equivalent and are unique'd as one
 // map. Therefore there should be only one output and we explicitly CHECK-NOT
 // for the others.
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0 + 1, d1 * 4 + 2)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1) -> (d0 + 1, d1 * 4 + 2)>
 #map3  = affine_map<(i, j) -> (i+1, 4*j + 2)>
 // CHECK-NOT: #map3{{[a-z]}}
 #map3a = affine_map<(i, j) -> (1+i, 4*j + 2)>
@@ -33,122 +33,122 @@
 // The following reduction should be unique'd out too but such expression
 // simplification is not performed for IR parsing, but only through analyses
 // and transforms.
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d1 - d0 + (d0 - d1 + 1) * 2 + d1 - 1, d1 * 4 + 2)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1) -> (d1 - d0 + (d0 - d1 + 1) * 2 + d1 - 1, d1 * 4 + 2)>
 #map3l = affine_map<(i, j) -> ((j - i) + 2*(i - j + 1) + j - 1 + 0, j + j + 1 + j + j + 1)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0 + 2, d1)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1) -> (d0 + 2, d1)>
 #map4  = affine_map<(i, j) -> (3+3-2*2+i, j)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + s0, d1)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0 + s0, d1)>
 #map5 = affine_map<(i, j)[s0] -> (i + s0, j)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + s0, d1 + 5)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0 + s0, d1 + 5)>
 #map6 = affine_map<(i, j)[s0] -> (i + s0, j + 5)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + s0, d1)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + s0, d1)>
 #map7 = affine_map<(i, j)[s0] -> (i + j + s0, j)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + s0 + 5, d1)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + s0 + 5, d1)>
 #map8 = affine_map<(i, j)[s0] -> (5 + i + j + s0, j)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + 5, d1)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + 5, d1)>
 #map9 = affine_map<(i, j)[s0] -> ((i + j) + 5, j)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + 5, d1)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + 5, d1)>
 #map10 = affine_map<(i, j)[s0] -> (i + (j + 5), j)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 * 2, d1 * 3)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0 * 2, d1 * 3)>
 #map11 = affine_map<(i, j)[s0] -> (2*i, 3*j)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + (d1 + s0 * 3) * 5 + 12, d1)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0 + (d1 + s0 * 3) * 5 + 12, d1)>
 #map12 = affine_map<(i, j)[s0] -> (i + 2*6 + 5*(j+s0*3), j)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 * 5 + d1, d1)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0 * 5 + d1, d1)>
 #map13 = affine_map<(i, j)[s0] -> (5*i + j, j)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + d1, d1)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0 + d1, d1)>
 #map14 = affine_map<(i, j)[s0] -> ((i + j), (j))>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + 7, d1 + 3)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + 7, d1 + 3)>
 #map15 = affine_map<(i, j)[s0] -> ((i + j + 2) + 5, (j)+3)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0, 0)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0, 0)>
 #map16 = affine_map<(i, j)[s1] -> (i, 0)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0, d1 * s0)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0, d1 * s0)>
 #map17 = affine_map<(i, j)[s0] -> (i, s0*j)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0, d0 * 3 + d1)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1) -> (d0, d0 * 3 + d1)>
 #map19 = affine_map<(i, j) -> (i, 3*i + j)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0, d0 + d1 * 3)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1) -> (d0, d0 + d1 * 3)>
 #map20 = affine_map<(i, j)  -> (i, i + 3*j)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0, d0 * ((s0 * s0) * 9) + 3)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0, d0 * ((s0 * s0) * 9) + 3)>
 #map18 = affine_map<(i, j)[N] -> (i, 2 + N*N*9*i + 1)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (1, d0 + d1 * 3 + 5)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1) -> (1, d0 + d1 * 3 + 5)>
 #map21 = affine_map<(i, j)  -> (1, i + 3*j + 5)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (s0 * 5, d0 + d1 * 3 + d0 * 5)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (s0 * 5, d0 + d1 * 3 + d0 * 5)>
 #map22 = affine_map<(i, j)[s0] -> (5*s0, i + 3*j + 5*i)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0 * (s0 * s1), d1)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0, s1] -> (d0 * (s0 * s1), d1)>
 #map23 = affine_map<(i, j)[s0, s1] -> (i*(s0*s1), j)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0, d1 mod 5)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0, s1] -> (d0, d1 mod 5)>
 #map24 = affine_map<(i, j)[s0, s1] -> (i, j mod 5)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0, d1 floordiv 5)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0, s1] -> (d0, d1 floordiv 5)>
 #map25 = affine_map<(i, j)[s0, s1] -> (i, j floordiv 5)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0, d1 ceildiv 5)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0, s1] -> (d0, d1 ceildiv 5)>
 #map26 = affine_map<(i, j)[s0, s1] -> (i, j ceildiv 5)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0, d0 - d1 - 5)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0, s1] -> (d0, d0 - d1 - 5)>
 #map29 = affine_map<(i, j)[s0, s1] -> (i, i - j - 5)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0, d0 - d1 * s1 + 2)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0, s1] -> (d0, d0 - d1 * s1 + 2)>
 #map30 = affine_map<(i, j)[M, N] -> (i, i - N*j + 2)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0 * -5, d1 * -3, -2, -(d0 + d1), -s0)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0, s1] -> (d0 * -5, d1 * -3, -2, -(d0 + d1), -s0)>
 #map32 = affine_map<(i, j)[s0, s1] -> (-5*i, -3*j, -2, -1*(i+j), -1*s0)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (-4, -d0)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1) -> (-4, -d0)>
 #map33 = affine_map<(i, j) -> (-2+-5-(-3), -1*i)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0, d1 floordiv s0, d1 mod s0)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0, s1] -> (d0, d1 floordiv s0, d1 mod s0)>
 #map34 = affine_map<(i, j)[s0, s1] -> (i, j floordiv s0, j mod s0)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1, d2)[s0, s1, s2] -> ((d0 * s1) * s2 + d1 * s1 + d2)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1, d2)[s0, s1, s2] -> ((d0 * s1) * s2 + d1 * s1 + d2)>
 #map35 = affine_map<(i, j, k)[s0, s1, s2] -> (i*s1*s2 + j*s1 + k)>
 
 // Constant folding.
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (8, 4, 1, 3, 2, 4)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1) -> (8, 4, 1, 3, 2, 4)>
 #map36 = affine_map<(i, j) -> (5+3, 2*2, 8-7, 100 floordiv 32, 5 mod 3, 10 ceildiv 3)>
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (4, 11, 512, 15)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1) -> (4, 11, 512, 15)>
 #map37 = affine_map<(i, j) -> (5 mod 3 + 2, 5*3 - 4, 128 * (500 ceildiv 128), 40 floordiv 7 * 3)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0 * 2 + 1, d1 + 2)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1) -> (d0 * 2 + 1, d1 + 2)>
 #map38 = affine_map<(i, j) -> (1 + i*2, 2 + j)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (d0 * s0, d0 + s0, d0 + 2, d1 * 2, s1 * 2, s0 + 2)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0, s1] -> (d0 * s0, d0 + s0, d0 + 2, d1 * 2, s1 * 2, s0 + 2)>
 #map39 = affine_map<(i, j)[M, N] -> (i*M, M + i, 2+i, j*2, N*2, 2 + M)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> ((d0 * 5) floordiv 4, (d1 ceildiv 7) mod s0)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> ((d0 * 5) floordiv 4, (d1 ceildiv 7) mod s0)>
 #map43 = affine_map<(i, j) [s0] -> ( i * 5 floordiv 4, j ceildiv 7 mod s0)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0 - d1 * 2, (d1 * 6) floordiv 4)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1) -> (d0 - d1 * 2, (d1 * 6) floordiv 4)>
 #map44 = affine_map<(i, j) -> (i - 2*j, j * 6 floordiv 4)>
 
 // Simplifications
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1, d2)[s0] -> (d0 + d1 + d2 + 1, d2 + d1, (d0 * s0) * 8)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1, d2)[s0] -> (d0 + d1 + d2 + 1, d2 + d1, (d0 * s0) * 8)>
 #map45 = affine_map<(i, j, k) [N] -> (1 + i + 3 + j - 3 + k, k + 5 + j - 5, 2*i*4*N)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1, d2) -> (0, d1, d0 * 2, 0)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1, d2) -> (0, d1, d0 * 2, 0)>
 #map46 = affine_map<(i, j, k) -> (i*0, 1*j, i * 128 floordiv 64, j * 0 floordiv 64)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1, d2) -> (d0, d0 * 4, 0, 0, 0)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1, d2) -> (d0, d0 * 4, 0, 0, 0)>
 #map47 = affine_map<(i, j, k) -> (i * 64 ceildiv 64, i * 512 ceildiv 128, 4 * j mod 4, 4*j*4 mod 8, k mod 1)>
 
 // floordiv should resolve similarly to ceildiv and be unique'd out.
@@ -156,59 +156,59 @@
 #map48 = affine_map<(i, j, k) -> (i * 64 floordiv 64, i * 512 floordiv 128, 4 * j mod 4, 4*j*4 mod 8)>
 
 // Simplifications for mod using known GCD's of the LHS expr.
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (0, 0, 0, 1)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (0, 0, 0, 1)>
 #map49 = affine_map<(i, j)[s0] -> ( (i * 4 + 8) mod 4, 32 * j * s0 * 8 mod 256, (4*i + (j * (s0 * 2))) mod 2, (4*i + 3) mod 2)>
 
 // Floordiv, ceildiv divide by one.
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 * 2 + 1, d1 + s0)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0 * 2 + 1, d1 + s0)>
 #map50 = affine_map<(i, j)[s0] -> ( (i * 2 + 1) ceildiv 1, (j + s0) floordiv 1)>
 
 // floordiv, ceildiv, and mod where LHS is negative.
-// CHECK: #map{{[0-9]+}} = affine_map<(d0) -> (-2, 1, -1)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0) -> (-2, 1, -1)>
 #map51 = affine_map<(i) -> (-5 floordiv 3, -5 mod 3, -5 ceildiv 3)>
 
 // Parenthesis elision.
-// CHECK: #map{{[0-9]+}} = affine_map<(d0) -> (d0 * 16 - (d0 + 1) + 15)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0) -> (d0 * 16 - (d0 + 1) + 15)>
 #map52 = affine_map<(d0) -> (16*d0 + ((d0 + 1) * -1) + 15)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0) -> (d0 - (d0 + 1))>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0) -> (d0 - (d0 + 1))>
 #map53 = affine_map<(d0) -> (d0 - (d0 + 1))>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0)[s0] -> ((-s0) floordiv 4, d0 floordiv -1)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0)[s0] -> ((-s0) floordiv 4, d0 floordiv -1)>
 #map54 = affine_map<(d0)[s0] -> (-s0 floordiv 4, d0 floordiv -1)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<() -> ()>
+// CHECK: #map{{[0-9]*}} = affine_map<() -> ()>
 #map55 = affine_map<() -> ()>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0, d0 * 2 + d1 * 4 + 2, 1, 2, (d0 * 4) mod 8)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1) -> (d0, d0 * 2 + d1 * 4 + 2, 1, 2, (d0 * 4) mod 8)>
 #map56 = affine_map<(d0, d1) -> ((4*d0 + 2) floordiv 4, (4*d0 + 8*d1 + 5) floordiv 2, (2*d0 + 4*d1 + 3) mod 2, (3*d0 - 4) mod 3, (4*d0 + 8*d1) mod 8)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d1, d0, 0)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1) -> (d1, d0, 0)>
 #map57 = affine_map<(d0, d1) -> (d0 - d0 + d1, -d0 + d0 + d0, (1 + d0 + d1 floordiv 4) - (d0 + d1 floordiv 4 + 1))>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0 * 3, (d0 + d1) * 2, d0 mod 2)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1) -> (d0 * 3, (d0 + d1) * 2, d0 mod 2)>
 #map58 = affine_map<(d0, d1) -> (4*d0 - 2*d0 + d0, (d0 + d1) + (d0 + d1), 2 * (d0 mod 2) - d0 mod 2)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0 mod 5, (d1 mod 35) mod 4)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1) -> (d0 mod 5, (d1 mod 35) mod 4)>
 #map59 = affine_map<(d0, d1) -> ((d0 mod 35) mod 5, (d1 mod 35) mod 4)>
 
 // Check if parser can parse affine_map with identifiers that collide with
 // integer types.
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0, d1)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1) -> (d0, d1)>
 #map60 = affine_map<(i0, i1) -> (i0, i1)>
 
 // Check if parser can parse affine_map with identifiers that collide with
 // reserved keywords.
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (-d0 + s0, -d1 + s1)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0, s1] -> (-d0 + s0, -d1 + s1)>
 #map61 = affine_map<(d0, d1)[step, loc] -> (step - d0, loc - d1)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (-d0 + s0 floordiv 2, -d1 + s1 mod 3)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0, s1] -> (-d0 + s0 floordiv 2, -d1 + s1 mod 3)>
 #map62 = affine_map<(d0, d1)[mod, floordiv] -> (mod floordiv 2 - d0, floordiv mod 3 - d1)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0, s1] -> (-d0 + s1 floordiv 2, -d1 + s0 mod 3)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0, s1] -> (-d0 + s1 floordiv 2, -d1 + s0 mod 3)>
 #map63 = affine_map<(d0, d1)[mod, floordiv] -> (floordiv floordiv 2 - d0, mod mod 3 - d1)>
 
-// CHECK: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + s0)>
+// CHECK: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + s0)>
 #map64 = affine_map<(i0, i1)[mod] -> (i0 + i1 + mod)>
 
 // Single identity maps are removed.
@@ -219,197 +219,197 @@ func.func private @f0(memref<2x4xi8, #map0, 1>)
 // CHECK: @f1(memref<2x4xi8, 1>)
 func.func private @f1(memref<2x4xi8, #map1, 1>)
 
-// CHECK: @f2(memref<i8, #map{{[0-9]+}}, 1>)
+// CHECK: @f2(memref<i8, #map{{[0-9]*}}, 1>)
 func.func private @f2(memref<i8, #map2, 1>)
 
-// CHECK: @f3(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f3(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f3(memref<2x4xi8, #map3, 1>)
-// CHECK: @f3a(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f3a(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f3a(memref<2x4xi8, #map3a, 1>)
-// CHECK: @f3b(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f3b(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f3b(memref<2x4xi8, #map3b, 1>)
-// CHECK: @f3c(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f3c(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f3c(memref<2x4xi8, #map3c, 1>)
-// CHECK: @f3d(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f3d(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f3d(memref<2x4xi8, #map3d, 1>)
-// CHECK: @f3e(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f3e(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f3e(memref<2x4xi8, #map3e, 1>)
-// CHECK: @f3f(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f3f(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f3f(memref<2x4xi8, #map3f, 1>)
-// CHECK: @f3g(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f3g(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f3g(memref<2x4xi8, #map3g, 1>)
-// CHECK: @f3h(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f3h(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f3h(memref<2x4xi8, #map3h, 1>)
-// CHECK: @f3i(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f3i(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f3i(memref<2x4xi8, #map3i, 1>)
-// CHECK: @f3j(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f3j(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f3j(memref<2x4xi8, #map3j, 1>)
-// CHECK: @f3k(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f3k(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f3k(memref<2x4xi8, #map3k, 1>)
-// CHECK: @f3l(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f3l(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f3l(memref<2x4xi8, #map3l, 1>)
 
-// CHECK: @f4(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f4(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f4(memref<2x4xi8, #map4, 1>)
 
-// CHECK: @f5(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f5(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f5(memref<2x4xi8, #map5, 1>)
 
-// CHECK: @f6(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f6(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f6(memref<2x4xi8, #map6, 1>)
 
-// CHECK: @f7(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f7(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f7(memref<2x4xi8, #map7, 1>)
 
-// CHECK: @f8(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f8(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f8(memref<2x4xi8, #map8, 1>)
 
-// CHECK: @f9(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f9(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f9(memref<2x4xi8, #map9, 1>)
 
-// CHECK: @f10(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f10(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f10(memref<2x4xi8, #map10, 1>)
 
-// CHECK: @f11(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f11(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f11(memref<2x4xi8, #map11, 1>)
 
-// CHECK: @f12(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f12(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f12(memref<2x4xi8, #map12, 1>)
 
-// CHECK: @f13(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f13(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f13(memref<2x4xi8, #map13, 1>)
 
-// CHECK: @f14(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f14(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f14(memref<2x4xi8, #map14, 1>)
 
-// CHECK: @f15(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f15(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f15(memref<2x4xi8, #map15, 1>)
 
-// CHECK: @f16(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f16(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f16(memref<2x4xi8, #map16, 1>)
 
-// CHECK: @f17(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f17(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f17(memref<2x4xi8, #map17, 1>)
 
-// CHECK: @f19(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f19(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f19(memref<2x4xi8, #map19, 1>)
 
-// CHECK: @f20(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f20(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f20(memref<2x4xi8, #map20, 1>)
 
-// CHECK: @f18(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f18(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f18(memref<2x4xi8, #map18, 1>)
 
-// CHECK: @f21(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f21(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f21(memref<2x4xi8, #map21, 1>)
 
-// CHECK: @f22(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f22(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f22(memref<2x4xi8, #map22, 1>)
 
-// CHECK: @f23(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f23(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f23(memref<2x4xi8, #map23, 1>)
 
-// CHECK: @f24(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f24(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f24(memref<2x4xi8, #map24, 1>)
 
-// CHECK: @f25(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f25(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f25(memref<2x4xi8, #map25, 1>)
 
-// CHECK: @f26(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f26(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f26(memref<2x4xi8, #map26, 1>)
 
-// CHECK: @f29(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f29(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f29(memref<2x4xi8, #map29, 1>)
 
-// CHECK: @f30(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f30(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f30(memref<2x4xi8, #map30, 1>)
 
-// CHECK: @f32(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f32(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f32(memref<2x4xi8, #map32, 1>)
 
-// CHECK: @f33(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f33(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f33(memref<2x4xi8, #map33, 1>)
 
-// CHECK: @f34(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f34(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f34(memref<2x4xi8, #map34, 1>)
 
-// CHECK: @f35(memref<2x4x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f35(memref<2x4x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f35(memref<2x4x4xi8, #map35, 1>)
 
-// CHECK: @f36(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f36(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f36(memref<2x4xi8, #map36, 1>)
 
-// CHECK: @f37(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f37(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f37(memref<2x4xi8, #map37, 1>)
 
-// CHECK: @f38(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f38(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f38(memref<2x4xi8, #map38, 1>)
 
-// CHECK: @f39(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+// CHECK: @f39(memref<2x4xi8, #map{{[0-9]*}}, 1>)
 func.func private @f39(memref<2x4xi8, #map39, 1>)
 
-// CHECK: @f43(memref<2x4xi8, #map{{[0-9]+}}>)
+// CHECK: @f43(memref<2x4xi8, #map{{[0-9]*}}>)
 func.func private @f43(memref<2x4xi8, #map43>)
 
-// CHECK: @f44(memref<2x4xi8, #map{{[0-9]+}}>)
+// CHECK: @f44(memref<2x4xi8, #map{{[0-9]*}}>)
 func.func private @f44(memref<2x4xi8, #map44>)
 
-// CHECK: @f45(memref<100x100x100xi8, #map{{[0-9]+}}>)
+// CHECK: @f45(memref<100x100x100xi8, #map{{[0-9]*}}>)
 func.func private @f45(memref<100x100x100xi8, #map45>)
 
-// CHECK: @f46(memref<100x100x100xi8, #map{{[0-9]+}}>)
+// CHECK: @f46(memref<100x100x100xi8, #map{{[0-9]*}}>)
 func.func private @f46(memref<100x100x100xi8, #map46>)
 
-// CHECK: @f47(memref<100x100x100xi8, #map{{[0-9]+}}>)
+// CHECK: @f47(memref<100x100x100xi8, #map{{[0-9]*}}>)
 func.func private @f47(memref<100x100x100xi8, #map47>)
 
-// CHECK: @f48(memref<100x100x100xi8, #map{{[0-9]+}}>)
+// CHECK: @f48(memref<100x100x100xi8, #map{{[0-9]*}}>)
 func.func private @f48(memref<100x100x100xi8, #map48>)
 
-// CHECK: @f49(memref<100x100xi8, #map{{[0-9]+}}>)
+// CHECK: @f49(memref<100x100xi8, #map{{[0-9]*}}>)
 func.func private @f49(memref<100x100xi8, #map49>)
 
-// CHECK: @f50(memref<100x100xi8, #map{{[0-9]+}}>)
+// CHECK: @f50(memref<100x100xi8, #map{{[0-9]*}}>)
 func.func private @f50(memref<100x100xi8, #map50>)
 
-// CHECK: @f51(memref<1xi8, #map{{[0-9]+}}>)
+// CHECK: @f51(memref<1xi8, #map{{[0-9]*}}>)
 func.func private @f51(memref<1xi8, #map51>)
 
-// CHECK: @f52(memref<1xi8, #map{{[0-9]+}}>)
+// CHECK: @f52(memref<1xi8, #map{{[0-9]*}}>)
 func.func private @f52(memref<1xi8, #map52>)
 
-// CHECK: @f53(memref<1xi8, #map{{[0-9]+}}>)
+// CHECK: @f53(memref<1xi8, #map{{[0-9]*}}>)
 func.func private @f53(memref<1xi8, #map53>)
 
-// CHECK: @f54(memref<10xi32, #map{{[0-9]+}}>)
+// CHECK: @f54(memref<10xi32, #map{{[0-9]*}}>)
 func.func private @f54(memref<10xi32, #map54>)
 
-// CHECK: "foo.op"() {map = #map{{[0-9]+}}} : () -> ()
+// CHECK: "foo.op"() {map = #map{{[0-9]*}}} : () -> ()
 "foo.op"() {map = #map55} : () -> ()
 
-// CHECK: @f56(memref<1x1xi8, #map{{[0-9]+}}>)
+// CHECK: @f56(memref<1x1xi8, #map{{[0-9]*}}>)
 func.func private @f56(memref<1x1xi8, #map56>)
 
-// CHECK: "f57"() {map = #map{{[0-9]+}}} : () -> ()
+// CHECK: "f57"() {map = #map{{[0-9]*}}} : () -> ()
 "f57"() {map = #map57} : () -> ()
 
-// CHECK: "f58"() {map = #map{{[0-9]+}}} : () -> ()
+// CHECK: "f58"() {map = #map{{[0-9]*}}} : () -> ()
 "f58"() {map = #map58} : () -> ()
 
-// CHECK: "f59"() {map = #map{{[0-9]+}}} : () -> ()
+// CHECK: "f59"() {map = #map{{[0-9]*}}} : () -> ()
 "f59"() {map = #map59} : () -> ()
 
-// CHECK: "f60"() {map = #map{{[0-9]+}}} : () -> ()
+// CHECK: "f60"() {map = #map{{[0-9]*}}} : () -> ()
 "f60"() {map = #map60} : () -> ()
 
-// CHECK: "f61"() {map = #map{{[0-9]+}}} : () -> ()
+// CHECK: "f61"() {map = #map{{[0-9]*}}} : () -> ()
 "f61"() {map = #map61} : () -> ()
 
-// CHECK: "f62"() {map = #map{{[0-9]+}}} : () -> ()
+// CHECK: "f62"() {map = #map{{[0-9]*}}} : () -> ()
 "f62"() {map = #map62} : () -> ()
 
-// CHECK: "f63"() {map = #map{{[0-9]+}}} : () -> ()
+// CHECK: "f63"() {map = #map{{[0-9]*}}} : () -> ()
 "f63"() {map = #map63} : () -> ()
 
-// CHECK: "f64"() {map = #map{{[0-9]+}}} : () -> ()
+// CHECK: "f64"() {map = #map{{[0-9]*}}} : () -> ()
 "f64"() {map = #map64} : () -> ()

diff  --git a/mlir/test/IR/affine-set.mlir b/mlir/test/IR/affine-set.mlir
index c719f206b6a2f..7b022cc167e37 100644
--- a/mlir/test/IR/affine-set.mlir
+++ b/mlir/test/IR/affine-set.mlir
@@ -1,113 +1,113 @@
 // RUN: mlir-opt -allow-unregistered-dialect %s | FileCheck %s
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<() : (0 == 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<() : (0 == 0)>
 #set0 = affine_set<() : ()>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0) : (d0 == 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0) : (d0 == 0)>
 #set1 = affine_set<(i) : (i == 0)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0) : (d0 >= 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0) : (d0 >= 0)>
 #set2 = affine_set<(i) : (i >= 0)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0, d1) : (d0 >= 0, d1 >= 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1) : (d0 >= 0, d1 >= 0)>
 #set3 = affine_set<(i, j) : (i >= 0, j >= 0)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0, d1) : (d0 == 0, d1 >= 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1) : (d0 == 0, d1 >= 0)>
 #set4 = affine_set<(i, j) : (i == 0, j >= 0)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0, d1)[s0, s1] : (d0 * 2 + s0 >= 0, d1 * 2 + s1 >= 0, d0 >= 0, d1 >= 0, s0 == 0, s1 == 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1)[s0, s1] : (d0 * 2 + s0 >= 0, d1 * 2 + s1 >= 0, d0 >= 0, d1 >= 0, s0 == 0, s1 == 0)>
 #set5 = affine_set<(i, j)[N, M] : (i * 2 + N >= 0, j * 2 + M >= 0, i >= 0, j >= 0, N == 0, M == 0)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0, d1)[s0, s1] : (-d0 + s0 >= 0, -d1 + s1 >= 0, d0 >= 0, d1 >= 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1)[s0, s1] : (-d0 + s0 >= 0, -d1 + s1 >= 0, d0 >= 0, d1 >= 0)>
 #set6 = affine_set<(i, j)[N, M] : (N - i >= 0, M - j >= 0, i >= 0, j >= 0)>
 
 // Check if affine constraints with affine exprs on RHS can be parsed.
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0) : (d0 - 1 == 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0) : (d0 - 1 == 0)>
 #set7 = affine_set<(i) : (i == 1)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0)[s0, s1] : (d0 >= 0, -d0 + s0 >= 0, s0 - 5 == 0, -d0 + s1 + 1 >= 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0)[s0, s1] : (d0 >= 0, -d0 + s0 >= 0, s0 - 5 == 0, -d0 + s1 + 1 >= 0)>
 #set8 = affine_set<(i)[N, M] : (i >= 0, N >= i, N == 5, M + 1 >= i)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0, d1)[s0] : (d0 >= 0, -d0 + s0 >= 0, d1 >= 0, d0 - d1 >= 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1)[s0] : (d0 >= 0, -d0 + s0 >= 0, d1 >= 0, d0 - d1 >= 0)>
 #set9 = affine_set<(i, j)[N] : (i >= 0, N >= i, j >= 0, i >= j)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0, d1)[s0, s1] : (-(d0 + d1 + s0 + s1) == 0, d0 + d1 - (s0 + s1) == 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1)[s0, s1] : (-(d0 + d1 + s0 + s1) == 0, d0 + d1 - (s0 + s1) == 0)>
 #set10 = affine_set<(i0, i1)[N, M] : (0 == i0 + i1 + N + M, i0 + i1 == N + M)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0, d1)[s0, s1] : (-(d0 + d1 + s0 + s1) >= 0, d0 + d1 - (s0 + s1) >= 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1)[s0, s1] : (-(d0 + d1 + s0 + s1) >= 0, d0 + d1 - (s0 + s1) >= 0)>
 #set11 = affine_set<(i0, i1)[N, M] : (0 >= i0 + i1 + N + M, i0 + i1 >= N + M)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0, d1, d2, d3) : ((d0 + d1) mod 2 - (d2 + d3) floordiv 2 == 0, d0 mod 2 + d1 mod 2 - (d2 + d3 + d2) >= 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1, d2, d3) : ((d0 + d1) mod 2 - (d2 + d3) floordiv 2 == 0, d0 mod 2 + d1 mod 2 - (d2 + d3 + d2) >= 0)>
 #set12 = affine_set<(d0, d1, r0, r1) : ((d0 + d1) mod 2 == (r0 + r1) floordiv 2, ((d0) mod 2) + ((d1) mod 2) >= (r0 + r1) + r0)>
 
 // Check if affine constraints with <= can be parsed.
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0) : (-d0 >= 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0) : (-d0 >= 0)>
 #set13 = affine_set<(i) : (i <= 0)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0) : (d0 >= 0, -d0 + 10 >= 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0) : (d0 >= 0, -d0 + 10 >= 0)>
 #set14 = affine_set<(i) : (i >= 0, i <= 10)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0, d1)[s0, s1] : (d0 >= 0, -d0 + s0 >= 0, d1 >= 0, -d1 + s1 >= 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1)[s0, s1] : (d0 >= 0, -d0 + s0 >= 0, d1 >= 0, -d1 + s1 >= 0)>
 #set15 = affine_set<(i, j)[N, M] : (i >= 0, i <= N, j >= 0, j <= M)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0)[s0] : (d0 >= 0, -d0 + s0 >= 0, -d0 + s0 floordiv 2 >= 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0)[s0] : (d0 >= 0, -d0 + s0 >= 0, -d0 + s0 floordiv 2 >= 0)>
 #set16 = affine_set<(i)[N] : (i >= 0, i <= N, i <= N floordiv 2)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0, d1, d2, d3, d4) : (-d0 >= 0, -d1 >= 0, -d2 >= 0, -d3 >= 0, -d4 >= 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1, d2, d3, d4) : (-d0 >= 0, -d1 >= 0, -d2 >= 0, -d3 >= 0, -d4 >= 0)>
 #set17 = affine_set<(i0, i1, i2, i3, i4)[] : (i0 <= 0, i1 <= 0, i2 <= 0, i3 <= 0, i4 <= 0)>
 
-// CHECK-DAG: "testset0"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset0"() {set = #set{{[0-9]*}}} : () -> ()
 "testset0"() {set = #set0} : () -> ()
 
-// CHECK-DAG: "testset1"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset1"() {set = #set{{[0-9]*}}} : () -> ()
 "testset1"() {set = #set1} : () -> ()
 
-// CHECK-DAG: "testset2"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset2"() {set = #set{{[0-9]*}}} : () -> ()
 "testset2"() {set = #set2} : () -> ()
 
-// CHECK-DAG: "testset3"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset3"() {set = #set{{[0-9]*}}} : () -> ()
 "testset3"() {set = #set3} : () -> ()
 
-// CHECK-DAG: "testset4"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset4"() {set = #set{{[0-9]*}}} : () -> ()
 "testset4"() {set = #set4} : () -> ()
 
-// CHECK-DAG: "testset5"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset5"() {set = #set{{[0-9]*}}} : () -> ()
 "testset5"() {set = #set5} : () -> ()
 
-// CHECK-DAG: "testset6"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset6"() {set = #set{{[0-9]*}}} : () -> ()
 "testset6"() {set = #set6} : () -> ()
 
-// CHECK-DAG: "testset7"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset7"() {set = #set{{[0-9]*}}} : () -> ()
 "testset7"() {set = #set7} : () -> ()
 
-// CHECK-DAG: "testset8"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset8"() {set = #set{{[0-9]*}}} : () -> ()
 "testset8"() {set = #set8} : () -> ()
 
-// CHECK-DAG: "testset9"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset9"() {set = #set{{[0-9]*}}} : () -> ()
 "testset9"() {set = #set9} : () -> ()
 
-// CHECK-DAG: "testset10"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset10"() {set = #set{{[0-9]*}}} : () -> ()
 "testset10"() {set = #set10} : () -> ()
 
-// CHECK-DAG: "testset11"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset11"() {set = #set{{[0-9]*}}} : () -> ()
 "testset11"() {set = #set11} : () -> ()
 
-// CHECK-DAG: "testset12"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset12"() {set = #set{{[0-9]*}}} : () -> ()
 "testset12"() {set = #set12} : () -> ()
 
-// CHECK-DAG: "testset13"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset13"() {set = #set{{[0-9]*}}} : () -> ()
 "testset13"() {set = #set13} : () -> ()
 
-// CHECK-DAG: "testset14"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset14"() {set = #set{{[0-9]*}}} : () -> ()
 "testset14"() {set = #set14} : () -> ()
 
-// CHECK-DAG: "testset15"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset15"() {set = #set{{[0-9]*}}} : () -> ()
 "testset15"() {set = #set15} : () -> ()
 
-// CHECK-DAG: "testset16"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset16"() {set = #set{{[0-9]*}}} : () -> ()
 "testset16"() {set = #set16} : () -> ()
 
-// CHECK-DAG: "testset17"() {set = #set{{[0-9]+}}} : () -> ()
+// CHECK-DAG: "testset17"() {set = #set{{[0-9]*}}} : () -> ()
 "testset17"() {set = #set17} : () -> ()

diff  --git a/mlir/test/IR/core-ops.mlir b/mlir/test/IR/core-ops.mlir
index 7f661dc180a98..10cabadb7aac0 100644
--- a/mlir/test/IR/core-ops.mlir
+++ b/mlir/test/IR/core-ops.mlir
@@ -4,7 +4,7 @@
 // Verify the generic form can be parsed.
 // RUN: mlir-opt -allow-unregistered-dialect -mlir-print-op-generic %s | mlir-opt -allow-unregistered-dialect | FileCheck %s
 
-// CHECK: #map0 = affine_map<(d0) -> (d0 + 1)>
+// CHECK: #map = affine_map<(d0) -> (d0 + 1)>
 
 // CHECK: #map1 = affine_map<()[s0] -> (s0 + 1)>
 
@@ -161,7 +161,7 @@ func.func @affine_apply() {
   %i = "arith.constant"() {value = 0: index} : () -> index
   %j = "arith.constant"() {value = 1: index} : () -> index
 
-  // CHECK: affine.apply #map0(%c0)
+  // CHECK: affine.apply #map(%c0)
   %a = "affine.apply" (%i) { map = affine_map<(d0) -> (d0 + 1)> } :
     (index) -> (index)
 

diff  --git a/mlir/test/IR/parser.mlir b/mlir/test/IR/parser.mlir
index ba57a91150f09..82b3bd6109ad8 100644
--- a/mlir/test/IR/parser.mlir
+++ b/mlir/test/IR/parser.mlir
@@ -1,47 +1,47 @@
 // RUN: mlir-opt -allow-unregistered-dialect %s | FileCheck %s
 
-// CHECK-DAG: #map{{[0-9]+}} = affine_map<(d0, d1, d2, d3, d4)[s0] -> (d0, d1, d2, d4, d3)>
-#map0 = affine_map<(d0, d1, d2, d3, d4)[s0] -> (d0, d1, d2, d4, d3)>
+// CHECK-DAG: #map{{[0-9]*}} = affine_map<(d0, d1, d2, d3, d4)[s0] -> (d0, d1, d2, d4, d3)>
+#map = affine_map<(d0, d1, d2, d3, d4)[s0] -> (d0, d1, d2, d4, d3)>
 
-// CHECK-DAG: #map{{[0-9]+}} = affine_map<(d0) -> (d0)>
+// CHECK-DAG: #map{{[0-9]*}} = affine_map<(d0) -> (d0)>
 #map1 = affine_map<(d0) -> (d0)>
 
-// CHECK-DAG: #map{{[0-9]+}} = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
+// CHECK-DAG: #map{{[0-9]*}} = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
 #map2 = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
 
-// CHECK-DAG: #map{{[0-9]+}} = affine_map<(d0, d1, d2) -> (d1, d0, d2)>
+// CHECK-DAG: #map{{[0-9]*}} = affine_map<(d0, d1, d2) -> (d1, d0, d2)>
 #map3 = affine_map<(d0, d1, d2) -> (d1, d0, d2)>
 
-// CHECK-DAG: #map{{[0-9]+}} = affine_map<()[s0] -> (0, s0 - 1)>
+// CHECK-DAG: #map{{[0-9]*}} = affine_map<()[s0] -> (0, s0 - 1)>
 #inline_map_minmax_loop1 = affine_map<()[s0] -> (0, s0 - 1)>
 
-// CHECK-DAG: #map{{[0-9]+}} = affine_map<()[s0] -> (100, s0 + 1)>
+// CHECK-DAG: #map{{[0-9]*}} = affine_map<()[s0] -> (100, s0 + 1)>
 #inline_map_minmax_loop2 = affine_map<()[s0] -> (100, s0 + 1)>
 
-// CHECK-DAG: #map{{[0-9]+}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + s0)>
+// CHECK-DAG: #map{{[0-9]*}} = affine_map<(d0, d1)[s0] -> (d0 + d1 + s0)>
 #bound_map1 = affine_map<(i, j)[s] -> (i + j + s)>
 
-// CHECK-DAG: #map{{[0-9]+}} = affine_map<(d0, d1) -> (d0 + d1)>
+// CHECK-DAG: #map{{[0-9]*}} = affine_map<(d0, d1) -> (d0 + d1)>
 #inline_map_loop_bounds2 = affine_map<(d0, d1) -> (d0 + d1)>
 
-// CHECK-DAG: #map{{[0-9]+}} = affine_map<(d0)[s0] -> (d0 + s0, d0 - s0)>
+// CHECK-DAG: #map{{[0-9]*}} = affine_map<(d0)[s0] -> (d0 + s0, d0 - s0)>
 #bound_map2 = affine_map<(i)[s] -> (i + s, i - s)>
 
 // All maps appear in arbitrary order before all sets, in arbitrary order.
 // CHECK-NOT: Placeholder
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0)[s0, s1] : (d0 >= 0, -d0 + s0 >= 0, s0 - 5 == 0, -d0 + s1 + 1 >= 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0)[s0, s1] : (d0 >= 0, -d0 + s0 >= 0, s0 - 5 == 0, -d0 + s1 + 1 >= 0)>
 #set0 = affine_set<(i)[N, M] : (i >= 0, -i + N >= 0, N - 5 == 0, -i + M + 1 >= 0)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0, d1)[s0] : (d0 >= 0, d1 >= 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0, d1)[s0] : (d0 >= 0, d1 >= 0)>
 #set1 = affine_set<(d0, d1)[s0] : (d0 >= 0, d1 >= 0)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0) : (d0 - 1 == 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0) : (d0 - 1 == 0)>
 #set2 = affine_set<(d0) : (d0 - 1 == 0)>
 
 // CHECK-DAG: [[$SET_TRUE:#set[0-9]+]] = affine_set<() : (0 == 0)>
 
-// CHECK-DAG: #set{{[0-9]+}} = affine_set<(d0)[s0] : (d0 - 2 >= 0, -d0 + 4 >= 0)>
+// CHECK-DAG: #set{{[0-9]*}} = affine_set<(d0)[s0] : (d0 - 2 >= 0, -d0 + 4 >= 0)>
 
 // CHECK: func private @foo(i32, i64) -> f32
 func.func private @foo(i32, i64) -> f32
@@ -80,8 +80,8 @@ func.func private @tensor_encoding(tensor<16x32xf64, "sparse">)
 // CHECK: func private @large_shape_dimension(tensor<9223372036854775807xf32>)
 func.func private @large_shape_dimension(tensor<9223372036854775807xf32>)
 
-// CHECK: func private @functions((memref<1x?x4x?x?xi32, #map0>, memref<8xi8>) -> (), () -> ())
-func.func private @functions((memref<1x?x4x?x?xi32, #map0, 0>, memref<8xi8, #map1, 0>) -> (), ()->())
+// CHECK: func private @functions((memref<1x?x4x?x?xi32, #map>, memref<8xi8>) -> (), () -> ())
+func.func private @functions((memref<1x?x4x?x?xi32, #map, 0>, memref<8xi8, #map1, 0>) -> (), ()->())
 
 // CHECK: func private @memrefs2(memref<2x4x8xi8, 1>)
 func.func private @memrefs2(memref<2x4x8xi8, #map2, 1>)
@@ -103,25 +103,25 @@ func.func private @memrefs_drop_triv_id_inline1(memref<2xi8, affine_map<(d0) ->
 // CHECK: func private @memrefs_nomap_nospace(memref<5x6x7xf32>)
 func.func private @memrefs_nomap_nospace(memref<5x6x7xf32>)
 
-// CHECK: func private @memrefs_map_nospace(memref<5x6x7xf32, #map{{[0-9]+}}>)
+// CHECK: func private @memrefs_map_nospace(memref<5x6x7xf32, #map{{[0-9]*}}>)
 func.func private @memrefs_map_nospace(memref<5x6x7xf32, #map3>)
 
 // CHECK: func private @memrefs_nomap_intspace(memref<5x6x7xf32, 3>)
 func.func private @memrefs_nomap_intspace(memref<5x6x7xf32, 3>)
 
-// CHECK: func private @memrefs_map_intspace(memref<5x6x7xf32, #map{{[0-9]+}}, 5>)
+// CHECK: func private @memrefs_map_intspace(memref<5x6x7xf32, #map{{[0-9]*}}, 5>)
 func.func private @memrefs_map_intspace(memref<5x6x7xf32, #map3, 5>)
 
 // CHECK: func private @memrefs_nomap_strspace(memref<5x6x7xf32, "local">)
 func.func private @memrefs_nomap_strspace(memref<5x6x7xf32, "local">)
 
-// CHECK: func private @memrefs_map_strspace(memref<5x6x7xf32, #map{{[0-9]+}}, "private">)
+// CHECK: func private @memrefs_map_strspace(memref<5x6x7xf32, #map{{[0-9]*}}, "private">)
 func.func private @memrefs_map_strspace(memref<5x6x7xf32, #map3, "private">)
 
 // CHECK: func private @memrefs_nomap_dictspace(memref<5x6x7xf32, {memSpace = "special", subIndex = 1 : i64}>)
 func.func private @memrefs_nomap_dictspace(memref<5x6x7xf32, {memSpace = "special", subIndex = 1}>)
 
-// CHECK: func private @memrefs_map_dictspace(memref<5x6x7xf32, #map{{[0-9]+}}, {memSpace = "special", subIndex = 3 : i64}>)
+// CHECK: func private @memrefs_map_dictspace(memref<5x6x7xf32, #map{{[0-9]*}}, {memSpace = "special", subIndex = 3 : i64}>)
 func.func private @memrefs_map_dictspace(memref<5x6x7xf32, #map3, {memSpace = "special", subIndex = 3}>)
 
 // CHECK: func private @complex_types(complex<i1>) -> complex<f32>
@@ -289,7 +289,7 @@ func.func @complex_loops() {
 func.func @triang_loop(%arg0: index, %arg1: memref<?x?xi32>) {
   %c = arith.constant 0 : i32       // CHECK: %{{.*}} = arith.constant 0 : i32
   affine.for %i0 = 1 to %arg0 {      // CHECK: affine.for %{{.*}} = 1 to %{{.*}} {
-    affine.for %i1 = affine_map<(d0)[]->(d0)>(%i0)[] to %arg0 {  // CHECK:   affine.for %{{.*}} = #map{{[0-9]+}}(%{{.*}}) to %{{.*}} {
+    affine.for %i1 = affine_map<(d0)[]->(d0)>(%i0)[] to %arg0 {  // CHECK:   affine.for %{{.*}} = #map{{[0-9]*}}(%{{.*}}) to %{{.*}} {
       memref.store %c, %arg1[%i0, %i1] : memref<?x?xi32>  // CHECK: memref.store %{{.*}}, %{{.*}}[%{{.*}}, %{{.*}}]
     }          // CHECK:     }
   }            // CHECK:   }
@@ -312,7 +312,7 @@ func.func @loop_bounds(%N : index) {
   %s = "foo"(%N) : (index) -> index
   // CHECK: affine.for %{{.*}} = %{{.*}} to %{{.*}}
   affine.for %i = %s to %N {
-    // CHECK: affine.for %{{.*}} = #map{{[0-9]+}}(%{{.*}}) to 0
+    // CHECK: affine.for %{{.*}} = #map{{[0-9]*}}(%{{.*}}) to 0
     affine.for %j = affine_map<(d0)[]->(d0)>(%i)[] to 0 step 1 {
        // CHECK: %{{.*}} = affine.apply #map{{.*}}(%{{.*}}, %{{.*}})[%{{.*}}]
        %w1 = affine.apply affine_map<(d0, d1)[s0] -> (d0+d1)> (%i, %j) [%s]
@@ -382,22 +382,22 @@ func.func @attributes() {
   // CHECK: "foo"() {a = 1 : i64, b = -423 : i64, c = [true, false], d = 1.600000e+01 : f64}  : () -> ()
   "foo"() {a = 1, b = -423, c = [true, false], d = 16.0 } : () -> ()
 
-  // CHECK: "foo"() {map1 = #map{{[0-9]+}}}
+  // CHECK: "foo"() {map1 = #map{{[0-9]*}}}
   "foo"() {map1 = #map1} : () -> ()
 
-  // CHECK: "foo"() {map2 = #map{{[0-9]+}}}
+  // CHECK: "foo"() {map2 = #map{{[0-9]*}}}
   "foo"() {map2 = affine_map<(d0, d1, d2) -> (d0, d1, d2)>} : () -> ()
 
-  // CHECK: "foo"() {map12 = [#map{{[0-9]+}}, #map{{[0-9]+}}]}
+  // CHECK: "foo"() {map12 = [#map{{[0-9]*}}, #map{{[0-9]*}}]}
   "foo"() {map12 = [#map1, #map2]} : () -> ()
 
-  // CHECK: "foo"() {set1 = #set{{[0-9]+}}}
+  // CHECK: "foo"() {set1 = #set{{[0-9]*}}}
   "foo"() {set1 = #set1} : () -> ()
 
-  // CHECK: "foo"() {set2 = #set{{[0-9]+}}}
+  // CHECK: "foo"() {set2 = #set{{[0-9]*}}}
   "foo"() {set2 = affine_set<(d0, d1, d2) : (d0 >= 0, d1 >= 0, d2 - d1 == 0)>} : () -> ()
 
-  // CHECK: "foo"() {set12 = [#set{{[0-9]+}}, #set{{[0-9]+}}]}
+  // CHECK: "foo"() {set12 = [#set{{[0-9]*}}, #set{{[0-9]*}}]}
   "foo"() {set12 = [#set1, #set2]} : () -> ()
 
   // CHECK: "foo"() {dictionary = {bool = true, fn = @ifinst}}

diff  --git a/mlir/test/IR/print-attr-type-aliases.mlir b/mlir/test/IR/print-attr-type-aliases.mlir
index 0c900a773818a..4d65ae68559b6 100644
--- a/mlir/test/IR/print-attr-type-aliases.mlir
+++ b/mlir/test/IR/print-attr-type-aliases.mlir
@@ -11,7 +11,7 @@
 // CHECK-DAG: #_0_test_alias = "alias_test:prefixed_digit"
 "test.op"() {alias_test = "alias_test:prefixed_digit"} : () -> ()
 
-// CHECK-DAG: #test_alias_conflict0_0 = "alias_test:sanitize_conflict_a"
+// CHECK-DAG: #test_alias_conflict0_ = "alias_test:sanitize_conflict_a"
 // CHECK-DAG: #test_alias_conflict0_1 = "alias_test:sanitize_conflict_b"
 "test.op"() {alias_test = ["alias_test:sanitize_conflict_a", "alias_test:sanitize_conflict_b"]} : () -> ()
 
@@ -28,3 +28,7 @@
 // CHECK-DAG: !test_ui8_ = !test.int<unsigned, 8>
 // CHECK-DAG: tensor<32x!test_ui8_>
 "test.op"() : () -> tensor<32x!test.int<unsigned, 8>>
+
+// CHECK-DAG: #loc2 = loc("nested")
+// CHECK-DAG: #loc3 = loc(fused<#loc2>["test.mlir":10:8])
+"test.op"() {alias_test = loc(fused<loc("nested")>["test.mlir":10:8])} : () -> ()

diff  --git a/mlir/test/Transforms/loop-fusion-2.mlir b/mlir/test/Transforms/loop-fusion-2.mlir
index f12c7f595c2a9..729e1dc2d9e80 100644
--- a/mlir/test/Transforms/loop-fusion-2.mlir
+++ b/mlir/test/Transforms/loop-fusion-2.mlir
@@ -225,8 +225,8 @@ func.func @should_fuse_live_out_writer(%arg0 : memref<10xf32>) -> memref<10xf32>
 
 // The fused slice has 16 iterations from along %i0.
 
-// CHECK-DAG: [[$MAP_LB:#map[0-9]+]] = affine_map<(d0) -> (d0 * 16)>
-// CHECK-DAG: [[$MAP_UB:#map[0-9]+]] = affine_map<(d0) -> (d0 * 16 + 16)>
+// CHECK-DAG: [[$MAP_LB:#map[0-9]*]] = affine_map<(d0) -> (d0 * 16)>
+// CHECK-DAG: [[$MAP_UB:#map[0-9]*]] = affine_map<(d0) -> (d0 * 16 + 16)>
 
 // CHECK-LABEL: slice_tile
 func.func @slice_tile(%arg0: memref<128x8xf32>, %arg1: memref<32x8xf32>, %0 : f32) -> memref<32x8xf32> {
@@ -303,8 +303,8 @@ func.func @test_add_slice_bounds() {
 // CHECK:        affine.for %{{.*}} = 0 to 10 {
 // CHECK-NEXT:     affine.for %{{.*}} = 0 to 10 {
 // CHECK-NEXT:       affine.for %{{.*}} = 0 to 10 {
-// CHECK-NEXT:         affine.apply #map0(%{{.*}})
-// CHECK-NEXT:         affine.apply #map0(%{{.*}})
+// CHECK-NEXT:         affine.apply #map(%{{.*}})
+// CHECK-NEXT:         affine.apply #map(%{{.*}})
 // CHECK-NEXT:         affine.apply #map1(%{{.*}}, %{{.*}})
 // CHECK-NEXT:         affine.store %{{.*}}, %{{.*}}[%{{.*}}] : memref<10xf32>
 // CHECK-NEXT:       }
@@ -484,14 +484,14 @@ func.func @should_not_slice_past_slice_barrier() {
 
 // -----
 
-#map0 = affine_map<(d0, d1) -> (d0 * 16 + d1)>
+#map = affine_map<(d0, d1) -> (d0 * 16 + d1)>
 func.func @fuse_across_dim_mismatch(%arg0: memref<4x4x16x1xf32>, %arg1: memref<144x9xf32>, %arg2: memref<9xf32>) {
   %1 = memref.alloc() : memref<144x4xf32>
   %2 = arith.constant 0.0 : f32
   affine.for %i2 = 0 to 9 {
     affine.for %i3 = 0 to 4 {
       affine.for %i5 = 0 to 16 {
-        %7 = affine.apply #map0(%i2, %i5)
+        %7 = affine.apply #map(%i2, %i5)
         affine.store %2, %1[%7, %i3] : memref<144x4xf32>
       }
     }
@@ -500,7 +500,7 @@ func.func @fuse_across_dim_mismatch(%arg0: memref<4x4x16x1xf32>, %arg1: memref<1
     affine.for %i7 = 0 to 9 {
       affine.for %i8 = 0 to 4 {
         affine.for %i10 = 0 to 16 {
-          %10 = affine.apply #map0(%i6, %i10)
+          %10 = affine.apply #map(%i6, %i10)
           %11 = affine.load %1[%10, %i8] : memref<144x4xf32>
         }
       }
@@ -574,13 +574,13 @@ func.func @fuse_across_varying_dims_complex(%arg0: f32) {
   }
   return
 }
-// MAXIMAL-DAG: [[$MAP0:#map[0-9]+]] = affine_map<(d0, d1) -> ((d0 * 72 + d1) floordiv 2304)>
-// MAXIMAL-DAG: [[$MAP1:#map[0-9]+]] = affine_map<(d0, d1) -> (((d0 * 72 + d1) mod 2304) floordiv 1152)>
-// MAXIMAL-DAG: [[$MAP2:#map[0-9]+]] = affine_map<(d0, d1) -> ((((d0 * 72 + d1) mod 1152) floordiv 9) floordiv 8)>
-// MAXIMAL-DAG: [[$MAP3:#map[0-9]+]] = affine_map<(d0, d1) -> ((d1 mod 9) floordiv 3)>
-// MAXIMAL-DAG: [[$MAP4:#map[0-9]+]] = affine_map<(d0, d1) -> (d1 mod 3)>
-// MAXIMAL-DAG: [[$MAP7:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 * 16 + d1)>
-// MAXIMAL-DAG: [[$MAP8:#map[0-9]+]] = affine_map<(d0, d1) -> (d0 * 16 - d1 + 15)>
+// MAXIMAL-DAG: [[$MAP0:#map[0-9]*]] = affine_map<(d0, d1) -> ((d0 * 72 + d1) floordiv 2304)>
+// MAXIMAL-DAG: [[$MAP1:#map[0-9]*]] = affine_map<(d0, d1) -> (((d0 * 72 + d1) mod 2304) floordiv 1152)>
+// MAXIMAL-DAG: [[$MAP2:#map[0-9]*]] = affine_map<(d0, d1) -> ((((d0 * 72 + d1) mod 1152) floordiv 9) floordiv 8)>
+// MAXIMAL-DAG: [[$MAP3:#map[0-9]*]] = affine_map<(d0, d1) -> ((d1 mod 9) floordiv 3)>
+// MAXIMAL-DAG: [[$MAP4:#map[0-9]*]] = affine_map<(d0, d1) -> (d1 mod 3)>
+// MAXIMAL-DAG: [[$MAP7:#map[0-9]*]] = affine_map<(d0, d1) -> (d0 * 16 + d1)>
+// MAXIMAL-DAG: [[$MAP8:#map[0-9]*]] = affine_map<(d0, d1) -> (d0 * 16 - d1 + 15)>
 // MAXIMAL-LABEL: func @fuse_across_varying_dims_complex
 // MAXIMAL-NEXT:  memref.alloc() : memref<64x1xf32>
 // MAXIMAL-NEXT:  arith.constant 0 : index

diff  --git a/mlir/test/Transforms/loop-fusion.mlir b/mlir/test/Transforms/loop-fusion.mlir
index 82c23db4a0c2e..fcf8c67dac003 100644
--- a/mlir/test/Transforms/loop-fusion.mlir
+++ b/mlir/test/Transforms/loop-fusion.mlir
@@ -73,9 +73,9 @@ func.func @should_fuse_reduction_to_pointwise() {
 
 // -----
 
-// CHECK-DAG: [[$MAP_SHIFT_MINUS_ONE_R1:#map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0 - 1)>
-// CHECK-DAG: [[$MAP_SHIFT_D0_BY_ONE:#map[0-9a-zA-Z_]+]] = affine_map<(d0, d1) -> (d0 + 1)>
-// CHECK-DAG: [[$MAP_SHIFT_D1_BY_ONE:#map[0-9a-zA-Z_]+]] = affine_map<(d0, d1) -> (d1 + 1)>
+// CHECK-DAG: [[$MAP_SHIFT_MINUS_ONE_R1:#map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0 - 1)>
+// CHECK-DAG: [[$MAP_SHIFT_D0_BY_ONE:#map[0-9a-zA-Z_]*]] = affine_map<(d0, d1) -> (d0 + 1)>
+// CHECK-DAG: [[$MAP_SHIFT_D1_BY_ONE:#map[0-9a-zA-Z_]*]] = affine_map<(d0, d1) -> (d1 + 1)>
 
 // CHECK-LABEL: func @should_fuse_loop_nests_with_shifts() {
 func.func @should_fuse_loop_nests_with_shifts() {
@@ -618,9 +618,9 @@ func.func @permute_and_fuse() {
 
 // -----
 
-// CHECK-DAG: [[$MAP0:#map[0-9a-zA-Z_]+]] = affine_map<(d0, d1) -> (d0 * 4 + d1)>
-// CHECK-DAG: [[$MAP1:#map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0 floordiv 4)>
-// CHECK-DAG: [[$MAP2:#map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0 mod 4)>
+// CHECK-DAG: [[$MAP0:#map[0-9a-zA-Z_]*]] = affine_map<(d0, d1) -> (d0 * 4 + d1)>
+// CHECK-DAG: [[$MAP1:#map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0 floordiv 4)>
+// CHECK-DAG: [[$MAP2:#map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0 mod 4)>
 
 // Reshape from a 64 x f32 to 16 x 4 x f32.
 // CHECK-LABEL: func @fuse_reshape_64_16_4
@@ -648,9 +648,9 @@ func.func @fuse_reshape_64_16_4(%in : memref<64xf32>) {
 }
 
 // -----
-// CHECK-DAG: [[$MAP0:#map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0 floordiv 4)>
-// CHECK-DAG: [[$MAP1:#map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0 mod 4)>
-// CHECK-DAG: [[$MAP2:#map[0-9a-zA-Z_]+]] = affine_map<(d0, d1) -> (d0 * 4 + d1)>
+// CHECK-DAG: [[$MAP0:#map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0 floordiv 4)>
+// CHECK-DAG: [[$MAP1:#map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0 mod 4)>
+// CHECK-DAG: [[$MAP2:#map[0-9a-zA-Z_]*]] = affine_map<(d0, d1) -> (d0 * 4 + d1)>
 
 // Reshape a 16x4xf32 to 64xf32.
 // CHECK-LABEL: func @fuse_reshape_16_4_64
@@ -735,18 +735,18 @@ func.func @R6_to_R2_reshape_square() -> memref<64x9xi32> {
 // Everything above is fused to a single 2-d loop nest, and the 6-d tensor %in
 // is eliminated if -memref-dataflow-opt is also supplied.
 //
-// CHECK-DAG: [[$MAP0:#map[0-9a-zA-Z_]+]] = affine_map<(d0, d1) -> ((d0 * 9 + d1) floordiv 288)>
-// CHECK-DAG: [[$MAP1:#map[0-9a-zA-Z_]+]] = affine_map<(d0, d1) -> (((d0 * 9 + d1) mod 288) floordiv 144)>
-// CHECK-DAG: [[$MAP2:#map[0-9a-zA-Z_]+]] = affine_map<(d0, d1) -> (((d0 * 9 + d1) mod 144) floordiv 48)>
-// CHECK-DAG: [[$MAP3:#map[0-9a-zA-Z_]+]] = affine_map<(d0, d1) -> (((d0 * 9 + d1) mod 48) floordiv 16)>
-// CHECK-DAG: [[$MAP4:#map[0-9a-zA-Z_]+]] = affine_map<(d0, d1) -> ((d0 * 9 + d1) mod 16)>
-// CHECK-DAG: [[$MAP11:#map[0-9a-zA-Z_]+]] = affine_map<(d0, d1) -> (d0 * 9 + d1)>
-// CHECK-DAG: [[$MAP12:#map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0 floordiv 288)>
-// CHECK-DAG: [[$MAP13:#map[0-9a-zA-Z_]+]] = affine_map<(d0) -> ((d0 mod 288) floordiv 144)>
-// CHECK-DAG: [[$MAP14:#map[0-9a-zA-Z_]+]] = affine_map<(d0) -> ((d0 mod 144) floordiv 48)>
-// CHECK-DAG: [[$MAP15:#map[0-9a-zA-Z_]+]] = affine_map<(d0) -> ((d0 mod 48) floordiv 16)>
-// CHECK-DAG: [[$MAP16:#map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0 mod 16)>
-// CHECK-DAG: [[$MAP17:#map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (0)>
+// CHECK-DAG: [[$MAP0:#map[0-9a-zA-Z_]*]] = affine_map<(d0, d1) -> ((d0 * 9 + d1) floordiv 288)>
+// CHECK-DAG: [[$MAP1:#map[0-9a-zA-Z_]*]] = affine_map<(d0, d1) -> (((d0 * 9 + d1) mod 288) floordiv 144)>
+// CHECK-DAG: [[$MAP2:#map[0-9a-zA-Z_]*]] = affine_map<(d0, d1) -> (((d0 * 9 + d1) mod 144) floordiv 48)>
+// CHECK-DAG: [[$MAP3:#map[0-9a-zA-Z_]*]] = affine_map<(d0, d1) -> (((d0 * 9 + d1) mod 48) floordiv 16)>
+// CHECK-DAG: [[$MAP4:#map[0-9a-zA-Z_]*]] = affine_map<(d0, d1) -> ((d0 * 9 + d1) mod 16)>
+// CHECK-DAG: [[$MAP11:#map[0-9a-zA-Z_]*]] = affine_map<(d0, d1) -> (d0 * 9 + d1)>
+// CHECK-DAG: [[$MAP12:#map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0 floordiv 288)>
+// CHECK-DAG: [[$MAP13:#map[0-9a-zA-Z_]*]] = affine_map<(d0) -> ((d0 mod 288) floordiv 144)>
+// CHECK-DAG: [[$MAP14:#map[0-9a-zA-Z_]*]] = affine_map<(d0) -> ((d0 mod 144) floordiv 48)>
+// CHECK-DAG: [[$MAP15:#map[0-9a-zA-Z_]*]] = affine_map<(d0) -> ((d0 mod 48) floordiv 16)>
+// CHECK-DAG: [[$MAP16:#map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0 mod 16)>
+// CHECK-DAG: [[$MAP17:#map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (0)>
 
 //
 // CHECK-LABEL: func @R6_to_R2_reshape
@@ -1324,9 +1324,9 @@ func.func @R3_to_R2_reshape() {
   }
   return
 }
-// CHECK-DAG: [[$MAP0:#map[0-9a-zA-Z_]+]] = affine_map<(d0, d1) -> ((d0 * 3 + d1) floordiv 48)>
-// CHECK-DAG: [[$MAP1:#map[0-9a-zA-Z_]+]] = affine_map<(d0, d1) -> (d0 * 3 + d1)>
-// CHECK-DAG: [[$MAP2:#map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0 floordiv 48)>
+// CHECK-DAG: [[$MAP0:#map[0-9a-zA-Z_]*]] = affine_map<(d0, d1) -> ((d0 * 3 + d1) floordiv 48)>
+// CHECK-DAG: [[$MAP1:#map[0-9a-zA-Z_]*]] = affine_map<(d0, d1) -> (d0 * 3 + d1)>
+// CHECK-DAG: [[$MAP2:#map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0 floordiv 48)>
 
 // CHECK-LABEL: func @R3_to_R2_reshape()
 // CHECK-DAG:    memref.alloc() : memref<1x1x1xi32>

diff  --git a/mlir/test/Transforms/pipeline-data-transfer.mlir b/mlir/test/Transforms/pipeline-data-transfer.mlir
index 78e47ac3cd119..9ea282b1dc858 100644
--- a/mlir/test/Transforms/pipeline-data-transfer.mlir
+++ b/mlir/test/Transforms/pipeline-data-transfer.mlir
@@ -2,8 +2,8 @@
 
 // -----
 
-// CHECK-DAG: [[$MOD_2:#map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0 mod 2)>
-// CHECK-DAG: [[$MAP_MINUS_1:#map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0 - 1)>
+// CHECK-DAG: [[$MOD_2:#map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0 mod 2)>
+// CHECK-DAG: [[$MAP_MINUS_1:#map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0 - 1)>
 
 // CHECK-LABEL: func @loop_nest_dma() {
 func.func @loop_nest_dma() {
@@ -64,8 +64,8 @@ func.func @loop_nest_dma() {
 
 // -----
 
-// CHECK-DAG: [[$FLOOR_MOD_2:#map[0-9a-zA-Z_]+]] = affine_map<(d0) -> ((d0 floordiv 4) mod 2)>
-// CHECK-DAG: [[$REMAP_SHIFT_MINUS_4:#map[0-9a-zA-Z_]+]] = affine_map<(d0) -> (d0 - 4)>
+// CHECK-DAG: [[$FLOOR_MOD_2:#map[0-9a-zA-Z_]*]] = affine_map<(d0) -> ((d0 floordiv 4) mod 2)>
+// CHECK-DAG: [[$REMAP_SHIFT_MINUS_4:#map[0-9a-zA-Z_]*]] = affine_map<(d0) -> (d0 - 4)>
 
 // CHECK-LABEL: @loop_step
 func.func @loop_step(%arg0: memref<512xf32>,


        


More information about the flang-commits mailing list