[PATCH] D154241: [OpenMP][NVPTX] Handle additional invalid PTX characters
Jeff Sandoval via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 30 10:59:12 PDT 2023
sandoval created this revision.
sandoval added reviewers: jdoerfert, ABataev, cchen.
Herald added subscribers: sunshaoce, mattd, gchakrabarti, asavonic, guansong, hiraditya, yaxunl.
Herald added a project: All.
sandoval requested review of this revision.
Herald added subscribers: llvm-commits, jplehr, sstefan1, jholewinski.
Herald added a project: LLVM.
For OpenMP offload, Clang emits global symbols containing the string
'<captured>', which contains characters that are invalid in PTX.
Extend the existing pass that replaces '.' and '@' characters with
'_$_' to also replace '<' and '>' characters.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D154241
Files:
llvm/lib/Target/NVPTX/NVPTXAssignValidGlobalNames.cpp
llvm/test/CodeGen/NVPTX/symbol-naming.ll
Index: llvm/test/CodeGen/NVPTX/symbol-naming.ll
===================================================================
--- llvm/test/CodeGen/NVPTX/symbol-naming.ll
+++ llvm/test/CodeGen/NVPTX/symbol-naming.ll
@@ -7,9 +7,11 @@
; PTX.
; CHECK-NOT: .str
+; CHECK-NOT: <str>
; CHECK-NOT: .function.
; CHECK-DAG: _$_str
+; CHECK-DAG: _$_str_$_
; CHECK-DAG: _$_str1
; CHECK-DAG: _$_function_$_
@@ -20,6 +22,7 @@
@.str = private unnamed_addr constant [13 x i8] c"%d %f %c %d\0A\00", align 1
+@"<str>" = private unnamed_addr constant [13 x i8] c"%d %f %c %d\0A\00", align 1
@_$_str = private unnamed_addr constant [13 x i8] c"%d %f %c %d\0A\00", align 1
@@ -27,6 +30,7 @@
define internal void @.function.() {
entry:
%call = call i32 (ptr, ...) @printf(ptr @.str)
+ %call2 = call i32 (ptr, ...) @printf(ptr @"<str>")
ret void
}
@@ -34,6 +38,7 @@
define internal void @_$_function_$_() {
entry:
%call = call i32 (ptr, ...) @printf(ptr @_$_str)
+ %call2 = call i32 (ptr, ...) @printf(ptr @"<str>")
ret void
}
Index: llvm/lib/Target/NVPTX/NVPTXAssignValidGlobalNames.cpp
===================================================================
--- llvm/lib/Target/NVPTX/NVPTXAssignValidGlobalNames.cpp
+++ llvm/lib/Target/NVPTX/NVPTXAssignValidGlobalNames.cpp
@@ -73,7 +73,7 @@
std::string ValidName;
raw_string_ostream ValidNameStream(ValidName);
for (char C : Name) {
- if (C == '.' || C == '@') {
+ if (C == '.' || C == '@' || C == '<' || C == '>') {
ValidNameStream << "_$_";
} else {
ValidNameStream << C;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154241.536324.patch
Type: text/x-patch
Size: 1571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230630/46575197/attachment.bin>
More information about the llvm-commits
mailing list