xref: /llvm-project/llvm/test/Transforms/OpenMP/globalization_remarks.ll (revision 07ed8187acc31ac3f4779da452864a29d48799ac)
1; RUN: opt -passes=openmp-opt -pass-remarks-missed=openmp-opt -disable-output < %s 2>&1 | FileCheck %s
2; ModuleID = 'declare_target_codegen_globalization.cpp'
3source_filename = "declare_target_codegen_globalization.cpp"
4target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64"
5target triple = "nvptx64"
6
7; CHECK: remark: globalization_remarks.c:5:7: Could not move globalized variable to the stack. Variable is potentially captured in call. Mark parameter as `__attribute__((noescape))` to override.
8; CHECK: remark: globalization_remarks.c:5:7: Found thread data sharing on the GPU. Expect degraded performance due to data globalization.
9
10%struct.KernelEnvironmentTy = type { %struct.ConfigurationEnvironmentTy, ptr, ptr }
11%struct.ConfigurationEnvironmentTy = type { i8, i8, i8, i32, i32, i32, i32, i32, i32 }
12
13@S = external local_unnamed_addr global ptr
14@foo_kernel_environment = local_unnamed_addr constant %struct.KernelEnvironmentTy { %struct.ConfigurationEnvironmentTy { i8 0, i8 0, i8 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 }, ptr null, ptr null }
15
16define ptx_kernel void @foo() "kernel" {
17entry:
18  %c = call i32 @__kmpc_target_init(ptr @foo_kernel_environment, ptr null)
19  %0 = call ptr @__kmpc_alloc_shared(i64 4), !dbg !10
20  call void @share(ptr %0), !dbg !10
21  call void @__kmpc_free_shared(ptr %0)
22  call void @__kmpc_target_deinit()
23  ret void
24}
25
26define internal void @share(ptr %x) {
27entry:
28  store ptr %x, ptr @S
29  ret void
30}
31
32declare ptr @__kmpc_alloc_shared(i64)
33
34declare void @__kmpc_free_shared(ptr nocapture)
35
36declare i32 @__kmpc_target_init(ptr, ptr);
37
38declare void @__kmpc_target_deinit()
39
40!llvm.dbg.cu = !{!0}
41!llvm.module.flags = !{!3, !4, !5, !6}
42
43!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
44!1 = !DIFile(filename: "globalization_remarks.c", directory: "/tmp/globalization_remarks.c")
45!2 = !{}
46!3 = !{i32 2, !"Debug Info Version", i32 3}
47!4 = !{i32 1, !"wchar_size", i32 4}
48!5 = !{i32 7, !"openmp", i32 50}
49!6 = !{i32 7, !"openmp-device", i32 50}
50!8 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
51!9 = !DISubroutineType(types: !2)
52!10 = !DILocation(line: 5, column: 7, scope: !8)
53