[PATCH] D123702: [NVPTX] Disable parens for identifiers starting with '$'
Artem Belevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 13 14:30:44 PDT 2022
tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.
LGTM.
================
Comment at: llvm/lib/MC/MCExpr.cpp:80-83
+ if (MAI && MAI->useParensForDollarSignNames()) {
+ UseParens =
+ !InParens && !Sym.getName().empty() && Sym.getName()[0] == '$';
+ }
----------------
Nit: LLVM code style typically omits braces around single statement bodies.
It may be even worth folding it all into:
```
bool UseParens = MAI && MAI->useParensForDollarSignNames() && !(InParens || Sym.getName().empty() || Sym.getName()[0] != '$');
```
================
Comment at: llvm/test/CodeGen/NVPTX/no-extra-parens.ll:11
+entry:
+;; CHECK: mov.u64 %rd{{[0-9]+}}, $str;
+ tail call void @str2(i8* getelementptr ([4 x i8], [4 x i8]* addrspacecast ([4 x i8] addrspace(1)* @"$str" to [4 x i8]*), i64 0, i64 0))
----------------
For the record, right now LLVM generates `($str)` and that's what ptxas complains about. https://cuda.godbolt.org/z/s7ahYn5oM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123702/new/
https://reviews.llvm.org/D123702
More information about the llvm-commits
mailing list