53 lines · plain
1; RUN: opt -passes='default<O2>' -pass-remarks-missed=openmp-opt < %s 2>&1 | FileCheck %s --check-prefix=MODULE2target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64"3 4%struct.ConfigurationEnvironmentTy = type { i8, i8, i8, i32, i32, i32, i32, i32, i32 }5%struct.KernelEnvironmentTy = type { %struct.ConfigurationEnvironmentTy, ptr, ptr }6 7@.str = private unnamed_addr constant [13 x i8] c"Alloc Shared\00", align 18@S = external local_unnamed_addr global ptr9@foo_kernel_environment = local_unnamed_addr constant %struct.KernelEnvironmentTy { %struct.ConfigurationEnvironmentTy { i8 1, i8 0, i8 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0 }, ptr null, ptr null }10 11; MODULE: remark: openmp_opt_module.c:5:7: Found thread data sharing on the GPU. Expect degraded performance due to data globalization.12 13define void @foo() "kernel" {14entry:15 %i = call i32 @__kmpc_target_init(ptr @foo_kernel_environment)16 %x = call ptr @__kmpc_alloc_shared(i64 4), !dbg !1017 call void @use(ptr %x)18 call void @__kmpc_free_shared(ptr %x)19 call void @__kmpc_target_deinit()20 ret void21}22 23declare void @use(ptr %x)24 25define weak ptr @__kmpc_alloc_shared(i64 %DataSize) {26entry:27 %call = call ptr @_Z10SafeMallocmPKc(i64 %DataSize, ptr @.str) #1128 ret ptr %call29}30 31; Function Attrs: convergent nounwind mustprogress32declare ptr @_Z10SafeMallocmPKc(i64 %size, ptr nocapture readnone %msg)33 34declare void @__kmpc_free_shared(ptr)35declare i32 @__kmpc_target_init(ptr)36declare void @__kmpc_target_deinit()37 38!llvm.dbg.cu = !{!0}39!llvm.module.flags = !{!3, !4, !5, !6}40!nvvm.annotations = !{!7}41 42!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)43!1 = !DIFile(filename: "openmp_opt_module.c", directory: "/tmp/openmp_opt_module.c")44!2 = !{}45!3 = !{i32 2, !"Debug Info Version", i32 3}46!4 = !{i32 1, !"wchar_size", i32 4}47!5 = !{i32 7, !"openmp", i32 50}48!6 = !{i32 7, !"openmp-device", i32 50}49!7 = !{ptr @foo, !"kernel", i32 1}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