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