1 ; RUN: opt -S -pass-remarks=openmp-opt -passes='attributor,cgscc(openmp-opt-cgscc)' -disable-output < %s 2>&1 | FileCheck %s
2 ; ModuleID = 'parallel_deletion_remarks.ll'
3 source_filename = "parallel_deletion_remarks.c"
4 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-pc-linux-gnu"
7 %struct.ident_t = type { i32, i32, i32, i32, ptr }
9 @.str = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1
10 @0 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 0, ptr @.str }, align 8
12 ; void delete_parallel(void) {
13 ; #pragma omp parallel
14 ; { unknown_willreturn(); }
15 ; #pragma omp parallel
16 ; { readonly_willreturn(); }
17 ; #pragma omp parallel
18 ; { readnone_willreturn(); }
19 ; #pragma omp parallel
23 ; This will delete all but the first parallel region
25 ; CHECK: remark: parallel_deletion_remarks.c:10:1: Removing parallel region with no side-effects.
26 ; CHECK: remark: parallel_deletion_remarks.c:12:1: Removing parallel region with no side-effects.
27 ; CHECK: remark: parallel_deletion_remarks.c:14:1: Removing parallel region with no side-effects.
28 define dso_local void @delete_parallel() local_unnamed_addr !dbg !15 {
29 call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr nonnull @0, i32 0, ptr @.omp_outlined.), !dbg !18
30 call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr nonnull @0, i32 0, ptr @.omp_outlined..2), !dbg !19
31 call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr nonnull @0, i32 0, ptr @.omp_outlined..4), !dbg !20
32 call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr nonnull @0, i32 0, ptr @.omp_outlined..6), !dbg !21
36 declare !callback !23 void @__kmpc_fork_call(ptr, i32, ptr, ...) local_unnamed_addr
38 ; Function Attrs: willreturn
39 declare !dbg !4 void @unknown_willreturn(...) #0
41 ; Function Attrs: readonly willreturn
42 declare !dbg !7 void @readonly_willreturn(...) #1
44 ; Function Attrs: readnone willreturn
45 declare !dbg !8 void @readnone_willreturn(...) #2
47 define internal void @.omp_outlined.(ptr noalias nocapture readnone %0, ptr noalias nocapture readnone %1) !dbg !25 {
48 call void (...) @unknown_willreturn(), !dbg !36
52 define internal void @.omp_outlined..2(ptr noalias nocapture readnone %0, ptr noalias nocapture readnone %1) !dbg !37 {
53 call void (...) @readonly_willreturn(), !dbg !41
57 define internal void @.omp_outlined..4(ptr noalias nocapture readnone %0, ptr noalias nocapture readnone %1) !dbg !42 {
58 call void (...) @readnone_willreturn(), !dbg !46
62 define internal void @.omp_outlined..6(ptr noalias nocapture %0, ptr noalias nocapture %1) !dbg !47 {
66 attributes #0 = { willreturn }
67 attributes #1 = { readonly willreturn }
68 attributes #2 = { readnone willreturn }
71 !llvm.module.flags = !{!9, !10, !11, !12, !13, !52}
74 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None)
75 !1 = !DIFile(filename: "parallel_deletion_remarks.c", directory: "/tmp")
78 !4 = !DISubprogram(name: "unknown_willreturn", scope: !1, file: !1, line: 3, type: !5, spFlags: DISPFlagOptimized, retainedNodes: !2)
79 !5 = !DISubroutineType(types: !6)
81 !7 = !DISubprogram(name: "readonly_willreturn", scope: !1, file: !1, line: 4, type: !5, spFlags: DISPFlagOptimized, retainedNodes: !2)
82 !8 = !DISubprogram(name: "readnone_willreturn", scope: !1, file: !1, line: 5, type: !5, spFlags: DISPFlagOptimized, retainedNodes: !2)
83 !9 = !{i32 7, !"Dwarf Version", i32 4}
84 !10 = !{i32 2, !"Debug Info Version", i32 3}
85 !11 = !{i32 1, !"wchar_size", i32 4}
86 !12 = !{i32 7, !"PIC Level", i32 2}
87 !13 = !{i32 7, !"PIE Level", i32 2}
88 !14 = !{!"clang version 10.0.0 "}
89 !15 = distinct !DISubprogram(name: "delete_parallel", scope: !1, file: !1, line: 7, type: !16, scopeLine: 7, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
90 !16 = !DISubroutineType(types: !17)
92 !18 = !DILocation(line: 8, column: 1, scope: !15)
93 !19 = !DILocation(line: 10, column: 1, scope: !15)
94 !20 = !DILocation(line: 12, column: 1, scope: !15)
95 !21 = !DILocation(line: 14, column: 1, scope: !15)
96 !22 = !DILocation(line: 16, column: 1, scope: !15)
98 !24 = !{i64 2, i64 -1, i64 -1, i1 true}
99 !25 = distinct !DISubprogram(name: ".omp_outlined.", scope: !1, file: !1, line: 9, type: !26, scopeLine: 9, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !33)
100 !26 = !DISubroutineType(types: !27)
101 !27 = !{null, !28, !28}
102 !28 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !29)
103 !29 = !DIDerivedType(tag: DW_TAG_restrict_type, baseType: !30)
104 !30 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !31, size: 64)
105 !31 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !32)
106 !32 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
108 !34 = !DILocalVariable(name: ".global_tid.", arg: 1, scope: !25, type: !28, flags: DIFlagArtificial)
109 !35 = !DILocalVariable(name: ".bound_tid.", arg: 2, scope: !25, type: !28, flags: DIFlagArtificial)
110 !36 = !DILocation(line: 9, column: 2, scope: !25)
111 !37 = distinct !DISubprogram(name: ".omp_outlined..2", scope: !1, file: !1, line: 11, type: !26, scopeLine: 11, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !38)
113 !39 = !DILocalVariable(name: ".global_tid.", arg: 1, scope: !37, type: !28, flags: DIFlagArtificial)
114 !40 = !DILocalVariable(name: ".bound_tid.", arg: 2, scope: !37, type: !28, flags: DIFlagArtificial)
115 !41 = !DILocation(line: 11, column: 2, scope: !37)
116 !42 = distinct !DISubprogram(name: ".omp_outlined..4", scope: !1, file: !1, line: 13, type: !26, scopeLine: 13, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !43)
118 !44 = !DILocalVariable(name: ".global_tid.", arg: 1, scope: !42, type: !28, flags: DIFlagArtificial)
119 !45 = !DILocalVariable(name: ".bound_tid.", arg: 2, scope: !42, type: !28, flags: DIFlagArtificial)
120 !46 = !DILocation(line: 13, column: 2, scope: !42)
121 !47 = distinct !DISubprogram(name: ".omp_outlined..6", scope: !1, file: !1, line: 15, type: !26, scopeLine: 15, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !48)
123 !49 = !DILocalVariable(name: ".global_tid.", arg: 1, scope: !47, type: !28, flags: DIFlagArtificial)
124 !50 = !DILocalVariable(name: ".bound_tid.", arg: 2, scope: !47, type: !28, flags: DIFlagArtificial)
125 !51 = !DILocation(line: 15, column: 2, scope: !47)
126 !52 = !{i32 7, !"openmp", i32 50}