[llvm] [NVPTX] improve identifier renaming for PTX (PR #79459)
Artem Belevich via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 25 11:09:47 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 << "_$_";
----------------
Artem-B wrote:
Ugh. I think we'll have a problem when we have symbols that have different invalid characters in the same place. E.g. `str-` and `str.`.
I think ideally we need to encode specific symbols instead. So, instead of just `_$_` for all invalid characters, emit ` "$"+hex(char)` which will be unambiguous.
https://github.com/llvm/llvm-project/pull/79459
More information about the llvm-commits
mailing list