[Mlir-commits] [mlir] [mlir] Allow trailing digit for alias in AsmPrinter (PR #127993)

River Riddle llvmlistbot at llvm.org
Wed Mar 5 23:15:41 PST 2025


================
@@ -1073,6 +1073,37 @@ static StringRef sanitizeIdentifier(StringRef name, SmallString<16> &buffer,
   return name;
 }
 
+unsigned AliasInitializer::uniqueAliasNameIndex(
+    StringRef alias, llvm::StringMap<unsigned> &nameCounts,
+    llvm::StringSet<llvm::BumpPtrAllocator &> &usedAliases) {
+  // Get nameIndex that will not generate conflicting name.
+  unsigned nameIndex = 0;
+  if (!usedAliases.count(alias)) {
+    usedAliases.insert(alias);
----------------
River707 wrote:

Can you early exit from this if and drop the else?

https://github.com/llvm/llvm-project/pull/127993


More information about the Mlir-commits mailing list