[Mlir-commits] [mlir] [mlir] Allow trailing digit for alias in AsmPrinter (PR #127993)
River Riddle
llvmlistbot at llvm.org
Wed Mar 5 15:01:22 PST 2025
================
@@ -1079,12 +1073,43 @@ void AliasInitializer::initializeAliases(
return lhs.second < rhs.second;
});
+ // This keeps track of all of the non-numeric names that are in flight,
+ // allowing us to check for duplicates.
+ llvm::BumpPtrAllocator usedAliasAllocator;
+ llvm::StringSet<llvm::BumpPtrAllocator &> usedAliases(usedAliasAllocator);
+
llvm::StringMap<unsigned> nameCounts;
for (auto &[symbol, aliasInfo] : unprocessedAliases) {
if (!aliasInfo.alias)
continue;
StringRef alias = *aliasInfo.alias;
- unsigned nameIndex = nameCounts[alias]++;
+ // Get nameIndex that will not generate conflicting name.
+ unsigned nameIndex = 0;
----------------
River707 wrote:
Can you split this code out into a separate function, the control flow is getting a little complex.
https://github.com/llvm/llvm-project/pull/127993
More information about the Mlir-commits
mailing list