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' 3source_filename = "parallel_deletion_remarks.c" 4target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 5target triple = "x86_64-pc-linux-gnu" 6 7%struct.ident_t = type { i32, i32, i32, i32, ptr } 8 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 11 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 20; {} 21; } 22; 23; This will delete all but the first parallel region 24 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. 28define 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 33 ret void, !dbg !22 34} 35 36declare !callback !23 void @__kmpc_fork_call(ptr, i32, ptr, ...) local_unnamed_addr 37 38; Function Attrs: willreturn 39declare !dbg !4 void @unknown_willreturn(...) #0 40 41; Function Attrs: readonly willreturn 42declare !dbg !7 void @readonly_willreturn(...) #1 43 44; Function Attrs: readnone willreturn 45declare !dbg !8 void @readnone_willreturn(...) #2 46 47define internal void @.omp_outlined.(ptr noalias nocapture readnone %0, ptr noalias nocapture readnone %1) !dbg !25 { 48 call void (...) @unknown_willreturn(), !dbg !36 49 ret void, !dbg !36 50} 51 52define internal void @.omp_outlined..2(ptr noalias nocapture readnone %0, ptr noalias nocapture readnone %1) !dbg !37 { 53 call void (...) @readonly_willreturn(), !dbg !41 54 ret void, !dbg !41 55} 56 57define internal void @.omp_outlined..4(ptr noalias nocapture readnone %0, ptr noalias nocapture readnone %1) !dbg !42 { 58 call void (...) @readnone_willreturn(), !dbg !46 59 ret void, !dbg !46 60} 61 62define internal void @.omp_outlined..6(ptr noalias nocapture %0, ptr noalias nocapture %1) !dbg !47 { 63 ret void, !dbg !51 64} 65 66attributes #0 = { willreturn } 67attributes #1 = { readonly willreturn } 68attributes #2 = { readnone willreturn } 69 70!llvm.dbg.cu = !{!0} 71!llvm.module.flags = !{!9, !10, !11, !12, !13, !52} 72!llvm.ident = !{!14} 73 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") 76!2 = !{} 77!3 = !{!4, !7, !8} 78!4 = !DISubprogram(name: "unknown_willreturn", scope: !1, file: !1, line: 3, type: !5, spFlags: DISPFlagOptimized, retainedNodes: !2) 79!5 = !DISubroutineType(types: !6) 80!6 = !{null, null} 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) 91!17 = !{null} 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) 97!23 = !{!24} 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) 107!33 = !{!34, !35} 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) 112!38 = !{!39, !40} 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) 117!43 = !{!44, !45} 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) 122!48 = !{!49, !50} 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} 127