Reapply of a22d1c2225543aa9ae7882f6b1a97ee7b2c95574. Using this PR for pre-merge CI. Instead of relying on any pass manager to schedule Polly's passes, add Polly's own pipeline manager which is seen as a monolithic pass in LLVM's pass manager. Polly's former passes are now phases of the new PhaseManager component. Relying on LLVM's pass manager (the legacy as well as the New Pass Manager) to manage Polly's phases never was a good fit that the PhaseManager resolves: * Polly passes were modifying analysis results, in particular RegionInfo and ScopInfo. This means that there was not just one unique and "definite" analysis result, the actual result depended on which analyses ran prior, and the pass manager was not allowed to throw away cached analyses or prior SCoP optimizations would have been forgotten. The LLVM pass manger's persistance of analysis results is not contractual but designed for caching. * Polly depends on a particular execution order of passes and regions (e.g. regression tests, invalidation of consecutive SCoPs). LLVM's pass manager does not guarantee any excecution order. * Polly does not completely preserve DominatorTree, RegionInfo, LoopInfo, or ScalarEvolution, but only as-needed for Polly's own uses. Because the ScopDetection object stores references to those analyses, it still had to lie to the pass manager that they would be preserved, or the pass manager would have released and recomputed the invalidated analysis objects that ScopDetection/ScopInfo was still referencing. To ensure that no non-Polly pass would see these not-completely-preserved analyses, all analyses still had to be thrown away after the ScopPassManager, respectively with a BarrierNoopPass in case of the LPM. * The NPM's PassInstrumentation wraps the IR unit into an `llvm::Any` object, but implementations such as PrintIRInstrumentation call llvm_unreachable on encountering an unknown IR unit, such as SCoPs, with no extension points to add support. Hence LLVM crashes when dumping IR between SCoP passes (such as `-print-before-changed` with Polly being active). The new PhaseManager uses some command line options that previously belonged to Polly's legacy passes, such as `-polly-print-detect` (so the option will continue to work). Hence the LPM support is incompatible with the new approach and support for it is removed.
163 lines
10 KiB
LLVM
163 lines
10 KiB
LLVM
; RUN: opt %loadNPMPolly -polly-parallel -polly-parallel-force -polly-omp-backend=LLVM -polly-codegen-verify '-passes=polly<no-default-opts>' -S < %s | FileCheck %s
|
|
; https://github.com/llvm/llvm-project/issues/56692
|
|
;
|
|
; CHECK: call void (ptr, i32, ptr, ...) @__kmpc_fork_call({{.*}}), !dbg ![[OPTLOC:[0-9]+]]
|
|
; CHECK: call void @__kmpc_dispatch_init_8({{.*}}), !dbg ![[OPTLOC]]
|
|
;
|
|
; CHECK: ![[OPTLOC]] = !DILocation(line: 0, scope: !{{[0-9]+}})
|
|
|
|
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
; Function Attrs: nounwind uwtable
|
|
define dso_local void @foo(i32 noundef %n, ptr noalias noundef nonnull align 8 %A) #0 !dbg !9 {
|
|
entry:
|
|
call void @llvm.dbg.value(metadata i32 %n, metadata !18, metadata !DIExpression()), !dbg !22
|
|
call void @llvm.dbg.value(metadata ptr %A, metadata !19, metadata !DIExpression()), !dbg !22
|
|
call void @llvm.dbg.value(metadata i32 0, metadata !20, metadata !DIExpression()), !dbg !23
|
|
%cmp3 = icmp sgt i32 %n, 0, !dbg !24
|
|
br i1 %cmp3, label %for.body.lr.ph, label %for.end, !dbg !26
|
|
|
|
for.body.lr.ph: ; preds = %entry
|
|
%wide.trip.count = zext i32 %n to i64, !dbg !24
|
|
br label %for.body, !dbg !26
|
|
|
|
for.body: ; preds = %for.body.lr.ph, %for.body
|
|
%indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
|
|
call void @llvm.dbg.value(metadata i64 %indvars.iv, metadata !20, metadata !DIExpression()), !dbg !23
|
|
%arrayidx = getelementptr inbounds double, ptr %A, i64 %indvars.iv, !dbg !27
|
|
%0 = load double, ptr %arrayidx, align 8, !dbg !27, !tbaa !29
|
|
%mul = fmul double %0, 4.200000e+01, !dbg !33
|
|
store double %mul, ptr %arrayidx, align 8, !dbg !34, !tbaa !29
|
|
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !35
|
|
call void @llvm.dbg.value(metadata i64 %indvars.iv.next, metadata !20, metadata !DIExpression()), !dbg !23
|
|
%exitcond = icmp ne i64 %indvars.iv.next, %wide.trip.count, !dbg !24
|
|
br i1 %exitcond, label %for.body, label %for.cond.for.end_crit_edge, !dbg !26, !llvm.loop !36
|
|
|
|
for.cond.for.end_crit_edge: ; preds = %for.body
|
|
br label %for.end, !dbg !26
|
|
|
|
for.end: ; preds = %for.cond.for.end_crit_edge, %entry
|
|
ret void, !dbg !41
|
|
}
|
|
|
|
; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
|
|
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
|
|
|
|
; Function Attrs: argmemonly nocallback nofree nosync nounwind willreturn
|
|
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
|
|
|
|
; Function Attrs: argmemonly nocallback nofree nosync nounwind willreturn
|
|
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
|
|
|
|
; Function Attrs: nounwind uwtable
|
|
define internal void @__kmpc_fork_call(ptr noundef %q, i32 noundef %nargs, ptr noundef %microtask, ...) #0 !dbg !42 {
|
|
entry:
|
|
call void @llvm.dbg.value(metadata ptr %q, metadata !52, metadata !DIExpression()), !dbg !55
|
|
call void @llvm.dbg.value(metadata i32 %nargs, metadata !53, metadata !DIExpression()), !dbg !55
|
|
call void @llvm.dbg.value(metadata ptr %microtask, metadata !54, metadata !DIExpression()), !dbg !55
|
|
ret void, !dbg !56
|
|
}
|
|
|
|
; Function Attrs: nounwind uwtable
|
|
define internal i32 @__kmpc_dispatch_next_8(ptr noundef %loc, i32 noundef %gtid, ptr noundef %p_last, ptr noundef %p_lb, ptr noundef %p_ub, ptr noundef %p_st) #0 !dbg !57 {
|
|
entry:
|
|
call void @llvm.dbg.value(metadata ptr %loc, metadata !70, metadata !DIExpression()), !dbg !76
|
|
call void @llvm.dbg.value(metadata i32 %gtid, metadata !71, metadata !DIExpression()), !dbg !76
|
|
call void @llvm.dbg.value(metadata ptr %p_last, metadata !72, metadata !DIExpression()), !dbg !76
|
|
call void @llvm.dbg.value(metadata ptr %p_lb, metadata !73, metadata !DIExpression()), !dbg !76
|
|
call void @llvm.dbg.value(metadata ptr %p_ub, metadata !74, metadata !DIExpression()), !dbg !76
|
|
call void @llvm.dbg.value(metadata ptr %p_st, metadata !75, metadata !DIExpression()), !dbg !76
|
|
ret i32 0, !dbg !77
|
|
}
|
|
|
|
; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
|
|
declare void @llvm.dbg.value(metadata, metadata, metadata) #1
|
|
|
|
attributes #0 = { nounwind uwtable "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
|
|
attributes #1 = { nocallback nofree nosync nounwind readnone speculatable willreturn }
|
|
attributes #2 = { argmemonly nocallback nofree nosync nounwind willreturn }
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
!llvm.module.flags = !{!2, !3, !4, !5, !6, !7}
|
|
!llvm.ident = !{!8}
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 15.0.0 (/home/meinersbur/src/llvm-project/clang 4e94f6653150511de434fa7e29b684ae7f0e52b6)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
|
|
!1 = !DIFile(filename: "parallel.c", directory: "/home/meinersbur/build/llvm-project/release_clang", checksumkind: CSK_MD5, checksum: "f66d96502f5555302321720f0cab6b0d")
|
|
!2 = !{i32 7, !"Dwarf Version", i32 5}
|
|
!3 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!4 = !{i32 1, !"wchar_size", i32 4}
|
|
!5 = !{i32 7, !"PIC Level", i32 2}
|
|
!6 = !{i32 7, !"PIE Level", i32 2}
|
|
!7 = !{i32 7, !"uwtable", i32 2}
|
|
!8 = !{!"clang version 15.0.0 (/home/meinersbur/src/llvm-project/clang 4e94f6653150511de434fa7e29b684ae7f0e52b6)"}
|
|
!9 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 18, type: !10, scopeLine: 18, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !17)
|
|
!10 = !DISubroutineType(types: !11)
|
|
!11 = !{null, !12, !13}
|
|
!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
|
|
!13 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !14)
|
|
!14 = !DIDerivedType(tag: DW_TAG_restrict_type, baseType: !15)
|
|
!15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64)
|
|
!16 = !DIBasicType(name: "double", size: 64, encoding: DW_ATE_float)
|
|
!17 = !{!18, !19, !20}
|
|
!18 = !DILocalVariable(name: "n", arg: 1, scope: !9, file: !1, line: 18, type: !12)
|
|
!19 = !DILocalVariable(name: "A", arg: 2, scope: !9, file: !1, line: 18, type: !13)
|
|
!20 = !DILocalVariable(name: "i", scope: !21, file: !1, line: 19, type: !12)
|
|
!21 = distinct !DILexicalBlock(scope: !9, file: !1, line: 19, column: 5)
|
|
!22 = !DILocation(line: 0, scope: !9)
|
|
!23 = !DILocation(line: 0, scope: !21)
|
|
!24 = !DILocation(line: 19, column: 23, scope: !25)
|
|
!25 = distinct !DILexicalBlock(scope: !21, file: !1, line: 19, column: 5)
|
|
!26 = !DILocation(line: 19, column: 5, scope: !21)
|
|
!27 = !DILocation(line: 20, column: 21, scope: !28)
|
|
!28 = distinct !DILexicalBlock(scope: !25, file: !1, line: 19, column: 33)
|
|
!29 = !{!30, !30, i64 0}
|
|
!30 = !{!"double", !31, i64 0}
|
|
!31 = !{!"omnipotent char", !32, i64 0}
|
|
!32 = !{!"Simple C/C++ TBAA"}
|
|
!33 = !DILocation(line: 20, column: 19, scope: !28)
|
|
!34 = !DILocation(line: 20, column: 14, scope: !28)
|
|
!35 = !DILocation(line: 19, column: 28, scope: !25)
|
|
!36 = distinct !{!36, !26, !37, !38}
|
|
!37 = !DILocation(line: 21, column: 5, scope: !21)
|
|
!38 = !{!"llvm.loop.mustprogress"}
|
|
!39 = !DILocation(line: 23, column: 5, scope: !9)
|
|
!40 = !DILocation(line: 24, column: 5, scope: !9)
|
|
!41 = !DILocation(line: 25, column: 1, scope: !9)
|
|
!42 = distinct !DISubprogram(name: "__kmpc_fork_call", scope: !1, file: !1, line: 9, type: !43, scopeLine: 9, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !51)
|
|
!43 = !DISubroutineType(types: !44)
|
|
!44 = !{null, !45, !47, !45, null}
|
|
!45 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !46, size: 64)
|
|
!46 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
|
|
!47 = !DIDerivedType(tag: DW_TAG_typedef, name: "int32_t", file: !48, line: 26, baseType: !49)
|
|
!48 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/stdint-intn.h", directory: "", checksumkind: CSK_MD5, checksum: "55bcbdc3159515ebd91d351a70d505f4")
|
|
!49 = !DIDerivedType(tag: DW_TAG_typedef, name: "__int32_t", file: !50, line: 41, baseType: !12)
|
|
!50 = !DIFile(filename: "/usr/include/x86_64-linux-gnu/bits/types.h", directory: "", checksumkind: CSK_MD5, checksum: "d108b5f93a74c50510d7d9bc0ab36df9")
|
|
!51 = !{!52, !53, !54}
|
|
!52 = !DILocalVariable(name: "q", arg: 1, scope: !42, file: !1, line: 9, type: !45)
|
|
!53 = !DILocalVariable(name: "nargs", arg: 2, scope: !42, file: !1, line: 9, type: !47)
|
|
!54 = !DILocalVariable(name: "microtask", arg: 3, scope: !42, file: !1, line: 9, type: !45)
|
|
!55 = !DILocation(line: 0, scope: !42)
|
|
!56 = !DILocation(line: 10, column: 1, scope: !42)
|
|
!57 = distinct !DISubprogram(name: "__kmpc_dispatch_next_8", scope: !1, file: !1, line: 12, type: !58, scopeLine: 14, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !69)
|
|
!58 = !DISubroutineType(types: !59)
|
|
!59 = !{!12, !60, !62, !63, !64, !64, !64}
|
|
!60 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !61, size: 64)
|
|
!61 = !DICompositeType(tag: DW_TAG_structure_type, name: "ident_t", file: !1, line: 5, flags: DIFlagFwdDecl)
|
|
!62 = !DIDerivedType(tag: DW_TAG_typedef, name: "kmp_int32", file: !1, line: 6, baseType: !47)
|
|
!63 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !62, size: 64)
|
|
!64 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !65, size: 64)
|
|
!65 = !DIDerivedType(tag: DW_TAG_typedef, name: "kmp_int64", file: !1, line: 7, baseType: !66)
|
|
!66 = !DIDerivedType(tag: DW_TAG_typedef, name: "int64_t", file: !48, line: 27, baseType: !67)
|
|
!67 = !DIDerivedType(tag: DW_TAG_typedef, name: "__int64_t", file: !50, line: 44, baseType: !68)
|
|
!68 = !DIBasicType(name: "long", size: 64, encoding: DW_ATE_signed)
|
|
!69 = !{!70, !71, !72, !73, !74, !75}
|
|
!70 = !DILocalVariable(name: "loc", arg: 1, scope: !57, file: !1, line: 12, type: !60)
|
|
!71 = !DILocalVariable(name: "gtid", arg: 2, scope: !57, file: !1, line: 12, type: !62)
|
|
!72 = !DILocalVariable(name: "p_last", arg: 3, scope: !57, file: !1, line: 13, type: !63)
|
|
!73 = !DILocalVariable(name: "p_lb", arg: 4, scope: !57, file: !1, line: 13, type: !64)
|
|
!74 = !DILocalVariable(name: "p_ub", arg: 5, scope: !57, file: !1, line: 14, type: !64)
|
|
!75 = !DILocalVariable(name: "p_st", arg: 6, scope: !57, file: !1, line: 14, type: !64)
|
|
!76 = !DILocation(line: 0, scope: !57)
|
|
!77 = !DILocation(line: 15, column: 37, scope: !57)
|