[llvm] [NVPTX] improve identifier renaming for PTX (PR #79459)
Alex MacLean via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 25 11:35:32 PST 2024
================
@@ -73,10 +74,10 @@ std::string NVPTXAssignValidGlobalNames::cleanUpName(StringRef Name) {
std::string ValidName;
raw_string_ostream ValidNameStream(ValidName);
for (char C : Name) {
- if (C == '.' || C == '@' || C == '<' || C == '>') {
- ValidNameStream << "_$_";
- } else {
+ if (isAlnum(C) || C == '_' || C == '$') {
ValidNameStream << C;
+ } else {
+ ValidNameStream << "_$_";
----------------
AlexMaclean wrote:
`setName` will add a postfix number to avoid collisions, so I think correctness is fine. Do you think adding the hex values in necessary for readability? I agree the current renaming leaves much to be desired but the hex scheme suggested will also have ambiguous cases. (i.e. `str.` and `str$2E`)
https://github.com/llvm/llvm-project/pull/79459
More information about the llvm-commits
mailing list