1 ; RUN: opt -passes=openmp-opt-cgscc -pass-remarks-analysis=openmp-opt -openmp-print-icv-values -disable-output < %s 2>&1 | FileCheck %s
2 ; RUN: opt -openmp-opt-cgscc -pass-remarks-analysis=openmp-opt -openmp-print-icv-values -disable-output < %s 2>&1 | FileCheck %s
4 ; ModuleID = 'icv_remarks.c'
5 source_filename = "icv_remarks.c"
6 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
7 target triple = "x86_64-unknown-linux-gnu"
9 %struct.ident_t = type { i32, i32, i32, i32, i8* }
11 @.str = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1
12 @0 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i32 0, i32 0) }, align 8
13 @1 = private unnamed_addr constant [26 x i8] c";icv_remarks.c;foo;18;1;;\00", align 1
15 ; CHECK-DAG: remark: icv_remarks.c:12:0: OpenMP ICV nthreads Value: IMPLEMENTATION_DEFINED
16 ; CHECK-DAG: remark: icv_remarks.c:12:0: OpenMP ICV active_levels Value: 0
17 ; CHECK-DAG: remark: icv_remarks.c:12:0: OpenMP ICV cancel Value: 0
18 define dso_local void @foo(i32 %a) local_unnamed_addr #0 !dbg !17 {
20 %.kmpc_loc.addr = alloca %struct.ident_t, align 8
21 %0 = bitcast %struct.ident_t* %.kmpc_loc.addr to i8*
22 call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 8 dereferenceable(24) %0, i8* nonnull align 8 dereferenceable(24) bitcast (%struct.ident_t* @0 to i8*), i64 16, i1 false)
23 call void @llvm.dbg.value(metadata i32 %a, metadata !19, metadata !DIExpression()), !dbg !21
24 tail call void @omp_set_num_threads(i32 %a) #1, !dbg !22
25 %call = tail call i32 @omp_get_max_threads() #1, !dbg !23
26 call void @llvm.dbg.value(metadata i32 %call, metadata !20, metadata !DIExpression()), !dbg !21
27 tail call void @use(i32 %call) #1, !dbg !24
28 %1 = getelementptr inbounds %struct.ident_t, %struct.ident_t* %.kmpc_loc.addr, i64 0, i32 4, !dbg !25
29 store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @1, i64 0, i64 0), i8** %1, align 8, !dbg !25, !tbaa !26
30 call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* nonnull %.kmpc_loc.addr, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* @.omp_outlined. to void (i32*, i32*, ...)*)) #1, !dbg !25
34 declare !dbg !4 dso_local void @omp_set_num_threads(i32) local_unnamed_addr #1
36 declare !dbg !9 dso_local i32 @omp_get_max_threads() local_unnamed_addr #1
38 declare !dbg !12 dso_local void @use(i32) local_unnamed_addr #2
40 ; CHECK-DAG: remark: icv_remarks.c:18:0: OpenMP ICV nthreads Value: IMPLEMENTATION_DEFINED
41 ; CHECK-DAG: remark: icv_remarks.c:18:0: OpenMP ICV active_levels Value: 0
42 ; CHECK-DAG: remark: icv_remarks.c:18:0: OpenMP ICV cancel Value: 0
43 define internal void @.omp_outlined.(i32* noalias nocapture readnone %.global_tid., i32* noalias nocapture readnone %.bound_tid.) #3 !dbg !33 {
45 call void @llvm.dbg.value(metadata i32* %.global_tid., metadata !41, metadata !DIExpression()), !dbg !43
46 call void @llvm.dbg.value(metadata i32* %.bound_tid., metadata !42, metadata !DIExpression()), !dbg !43
47 call void @llvm.dbg.value(metadata i32* undef, metadata !44, metadata !DIExpression()) #1, !dbg !50
48 call void @llvm.dbg.value(metadata i32* undef, metadata !47, metadata !DIExpression()) #1, !dbg !50
49 tail call void @omp_set_num_threads(i32 10) #1, !dbg !52
50 %call.i = tail call i32 @omp_get_max_threads() #1, !dbg !53
51 call void @llvm.dbg.value(metadata i32 %call.i, metadata !48, metadata !DIExpression()) #1, !dbg !54
52 tail call void @use(i32 %call.i) #1, !dbg !55
56 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #4
58 declare !callback !57 dso_local void @__kmpc_fork_call(%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) local_unnamed_addr #1
60 declare void @llvm.dbg.value(metadata, metadata, metadata) #5
62 attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
63 attributes #1 = { nounwind }
64 attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
65 attributes #3 = { norecurse nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
66 attributes #4 = { argmemonly nounwind willreturn }
67 attributes #5 = { nounwind readnone speculatable willreturn }
70 !llvm.module.flags = !{!13, !14, !15, !59}
73 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git 73cea83a6f5ab521edf3cccfc603534776d691ec)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None)
74 !1 = !DIFile(filename: "icv_remarks.c", directory: "/tmp")
77 !4 = !DISubprogram(name: "omp_set_num_threads", scope: !5, file: !5, line: 57, type: !6, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
78 !5 = !DIFile(filename: "/usr/local/lib/clang/11.0.0/include/omp.h", directory: "")
79 !6 = !DISubroutineType(types: !7)
81 !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
82 !9 = !DISubprogram(name: "omp_get_max_threads", scope: !5, file: !5, line: 67, type: !10, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
83 !10 = !DISubroutineType(types: !11)
85 !12 = !DISubprogram(name: "use", scope: !1, file: !1, line: 10, type: !6, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
86 !13 = !{i32 7, !"Dwarf Version", i32 4}
87 !14 = !{i32 2, !"Debug Info Version", i32 3}
88 !15 = !{i32 1, !"wchar_size", i32 4}
89 !16 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 73cea83a6f5ab521edf3cccfc603534776d691ec)"}
90 !17 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 12, type: !6, scopeLine: 12, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !18)
92 !19 = !DILocalVariable(name: "a", arg: 1, scope: !17, file: !1, line: 12, type: !8)
93 !20 = !DILocalVariable(name: "num", scope: !17, file: !1, line: 15, type: !8)
94 !21 = !DILocation(line: 0, scope: !17)
95 !22 = !DILocation(line: 13, column: 3, scope: !17)
96 !23 = !DILocation(line: 15, column: 13, scope: !17)
97 !24 = !DILocation(line: 17, column: 3, scope: !17)
98 !25 = !DILocation(line: 18, column: 1, scope: !17)
99 !26 = !{!27, !31, i64 16}
100 !27 = !{!"ident_t", !28, i64 0, !28, i64 4, !28, i64 8, !28, i64 12, !31, i64 16}
101 !28 = !{!"int", !29, i64 0}
102 !29 = !{!"omnipotent char", !30, i64 0}
103 !30 = !{!"Simple C/C++ TBAA"}
104 !31 = !{!"any pointer", !29, i64 0}
105 !32 = !DILocation(line: 24, column: 1, scope: !17)
106 !33 = distinct !DISubprogram(name: ".omp_outlined.", scope: !1, file: !1, line: 18, type: !34, scopeLine: 18, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !40)
107 !34 = !DISubroutineType(types: !35)
108 !35 = !{null, !36, !36}
109 !36 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !37)
110 !37 = !DIDerivedType(tag: DW_TAG_restrict_type, baseType: !38)
111 !38 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !39, size: 64)
112 !39 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !8)
114 !41 = !DILocalVariable(name: ".global_tid.", arg: 1, scope: !33, type: !36, flags: DIFlagArtificial)
115 !42 = !DILocalVariable(name: ".bound_tid.", arg: 2, scope: !33, type: !36, flags: DIFlagArtificial)
116 !43 = !DILocation(line: 0, scope: !33)
117 !44 = !DILocalVariable(name: ".global_tid.", arg: 1, scope: !45, type: !36, flags: DIFlagArtificial)
118 !45 = distinct !DISubprogram(name: ".omp_outlined._debug__", scope: !1, file: !1, line: 19, type: !34, scopeLine: 19, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !46)
119 !46 = !{!44, !47, !48}
120 !47 = !DILocalVariable(name: ".bound_tid.", arg: 2, scope: !45, type: !36, flags: DIFlagArtificial)
121 !48 = !DILocalVariable(name: "num1", scope: !49, file: !1, line: 21, type: !8)
122 !49 = distinct !DILexicalBlock(scope: !45, file: !1, line: 19, column: 3)
123 !50 = !DILocation(line: 0, scope: !45, inlinedAt: !51)
124 !51 = distinct !DILocation(line: 18, column: 1, scope: !33)
125 !52 = !DILocation(line: 20, column: 5, scope: !49, inlinedAt: !51)
126 !53 = !DILocation(line: 21, column: 16, scope: !49, inlinedAt: !51)
127 !54 = !DILocation(line: 0, scope: !49, inlinedAt: !51)
128 !55 = !DILocation(line: 22, column: 5, scope: !49, inlinedAt: !51)
129 !56 = !DILocation(line: 18, column: 1, scope: !33)
131 !58 = !{i64 2, i64 -1, i64 -1, i1 true}
132 !59 = !{i32 7, !"openmp", i32 50}