[llvm] [NVPTX] Fixing debug symbols for ptx target emitting (PR #101891)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 18 04:52:35 PDT 2024


================
@@ -0,0 +1,42 @@
+; RUN: llc -mtriple=nvptx64-nvidia-cuda -mcpu=sm_86 < %s | FileCheck %s
+
+; CHECK: .global .align 1 .b8 __func___$__Z10foo_kernelv
+
+; ModuleID = 'test_module'
+source_filename = "test_module.cu"
+target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64"
+target triple = "nvptx64-nvidia-cuda"
+
+ at __func__._Z10foo_kernelv = private unnamed_addr constant [11 x i8] c"foo_kernel\00", align 1, !dbg !0
+
+define dso_local void @_Z10foo_kernelv() #0 !dbg !20 {
+entry:
+  call void @_Z6escapePKc(ptr noundef @__func__._Z10foo_kernelv) #2, !dbg !23
+  ret void, !dbg !24
+}
+
+declare dso_local void @_Z6escapePKc(ptr noundef)
+
+attributes #0 = { noinline nounwind optnone "target-cpu"="sm_86" }
+attributes #1 = { nounwind }
+attributes #2 = { nounwind }
----------------
jhuber6 wrote:

```suggestion
define void @_Z10foo_kernelv() !dbg !20 {
entry:
  call void @_Z6escapePKc(ptr noundef @__func__._Z10foo_kernelv) #2, !dbg !23
  ret void, !dbg !24
}

declare void @_Z6escapePKc(ptr)
```
It would be nice to not have C++ mangled names in the test as well, but you'd need to change it in the debug info as well.

https://github.com/llvm/llvm-project/pull/101891


More information about the llvm-commits mailing list