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'
3 source_filename = "declare_target_codegen_globalization.cpp"
4 target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64"
5 target triple = "nvptx64"
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.
10 %struct.ident_t = type { i32, i32, i32, i32, i8* }
12 @S = external local_unnamed_addr global i8*
16 %c = call i32 @__kmpc_target_init(%struct.ident_t* null, i1 false, i1 true, i1 true)
17 %0 = call i8* @__kmpc_alloc_shared(i64 4), !dbg !10
18 %x_on_stack = bitcast i8* %0 to i32*
19 %1 = bitcast i32* %x_on_stack to i8*
20 call void @share(i8* %1), !dbg !10
21 call void @__kmpc_free_shared(i8* %0)
22 call void @__kmpc_target_deinit(%struct.ident_t* null, i1 false, i1 true)
26 define internal void @share(i8* %x) {
32 declare i8* @__kmpc_alloc_shared(i64)
34 declare void @__kmpc_free_shared(i8* nocapture)
36 declare i32 @__kmpc_target_init(%struct.ident_t*, i1, i1, i1);
38 declare void @__kmpc_target_deinit(%struct.ident_t*, i1, i1)
41 !llvm.module.flags = !{!3, !4, !5, !6}
42 !nvvm.annotations = !{!7, !8}
44 !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)
45 !1 = !DIFile(filename: "globalization_remarks.c", directory: "/tmp/globalization_remarks.c")
47 !3 = !{i32 2, !"Debug Info Version", i32 3}
48 !4 = !{i32 1, !"wchar_size", i32 4}
49 !5 = !{i32 7, !"openmp", i32 50}
50 !6 = !{i32 7, !"openmp-device", i32 50}
51 !7 = !{void ()* @foo, !"kernel", i32 1}
52 !8 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
53 !9 = !DISubroutineType(types: !2)
54 !10 = !DILocation(line: 5, column: 7, scope: !8)