brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.0 KiB · 995795b Raw
106 lines · plain
1; RUN: opt %s -passes='cgscc(coro-split)' -S | FileCheck %s2 3; Verifies that suspend points with inlined locations are handled properly,4; i.e., that their debug labels point to the correct subprogram.5 6source_filename = "coro.c"7 8; Function Attrs: nounwind uwtable9define ptr @f() #2 !dbg !16 {10entry:11  %0 = tail call token @llvm.coro.id(i32 0, ptr null, ptr @f, ptr null), !dbg !2612  %1 = tail call i64 @llvm.coro.size.i64(), !dbg !2613  %frame = tail call ptr @malloc(i64 %1), !dbg !2614  %2 = tail call ptr @llvm.coro.begin(token %0, ptr %frame) #3, !dbg !2615  br label %loop1, !dbg !2716 17loop1:18  %3 = tail call token @llvm.coro.save(ptr null), !dbg !3419  %4 = tail call i8 @llvm.coro.suspend(token %3, i1 false), !dbg !3420  switch i8 %4, label %coro_Suspend [21    i8 0, label %loop122    i8 1, label %coro_Cleanup23  ], !dbg !3424 25coro_Cleanup:26  %7 = tail call ptr @llvm.coro.free(token %0, ptr %2), !dbg !3727  tail call void @free(ptr nonnull %7), !dbg !3728  br label %coro_Suspend, !dbg !3729 30coro_Suspend:31  tail call void @llvm.coro.end(ptr null, i1 false, token none) #3, !dbg !4032  ret ptr %2, !dbg !4133}34 35; Check that the resume function contains the `#dbg_label` instructions.36; CHECK-LABEL:   define internal fastcc void @f.resume({{.*}})37; CHECK-SAME:      !dbg ![[RESUME_SUBPROGRAM:[0-9]+]]38; CHECK:         resume.0:39; CHECK-NEXT:        #dbg_label(![[RESUME_0:[0-9]+]], ![[RESUME_LABEL_LOC:[0-9]+]])40 41; Check that the destroy function contains the `#dbg_label` instructions.42; CHECK-LABEL:   define internal fastcc void @f.destroy({{.*}})43; CHECK-SAME:      !dbg ![[DESTROY_SUBPROGRAM:[0-9]+]]44; CHECK:         resume.0:45; CHECK-NEXT:        #dbg_label(![[DESTROY_0:[0-9]+]], ![[DESTROY_LABEL_LOC:[0-9]+]])46 47; Check that the DILabels are correctly based to their "inlined at" location.48; CHECK: ![[RESUME_LABEL_LOC]] = !DILocation(line: 12, column: 6, scope: ![[RESUME_SUBPROGRAM]])49; CHECK: ![[RESUME_0]] = !DILabel(scope: ![[RESUME_SUBPROGRAM]], name: "__coro_resume_0", file: !{{[0-9]*}}, line: 42, column: 2, isArtificial: true, coroSuspendIdx: 0)50 51; CHECK: ![[DESTROY_LABEL_LOC]] = !DILocation(line: 12, column: 6, scope: ![[DESTROY_SUBPROGRAM]])52; CHECK: ![[DESTROY_0]] = !DILabel(scope: ![[DESTROY_SUBPROGRAM]], name: "__coro_resume_0", file: !{{[0-9]*}}, line: 42, column: 2, isArtificial: true, coroSuspendIdx: 0)53 54declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #455 56declare noalias ptr @malloc(i64) local_unnamed_addr #057declare i64 @llvm.coro.size.i64() #158declare ptr @llvm.coro.begin(token, ptr writeonly) #059declare token @llvm.coro.save(ptr) #060declare i8 @llvm.coro.suspend(token, i1) #061declare ptr @llvm.coro.free(token, ptr nocapture readonly) #462declare void @free(ptr nocapture) local_unnamed_addr #063declare void @llvm.coro.end(ptr, i1, token) #064 65attributes #0 = { nounwind }66attributes #1 = { nounwind readnone }67attributes #2 = { nounwind uwtable presplitcoroutine }68attributes #3 = { noduplicate }69attributes #4 = { argmemonly nounwind readonly }70 71!llvm.dbg.cu = !{!0}72!llvm.module.flags = !{!3, !4}73!llvm.ident = !{!5}74 75!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.0 - manually edited", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)76!1 = !DIFile(filename: "coro.c", directory: "/home/gor/build/bin")77!2 = !{}78!3 = !{i32 2, !"Dwarf Version", i32 4}79!4 = !{i32 2, !"Debug Info Version", i32 3}80!5 = !{!"clang version 4.0.0 - manually edited"}81!9 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)82!16 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 8, type: !17, isLocal: false, isDefinition: true, scopeLine: 8, isOptimized: true, unit: !0, retainedNodes: !20)83!17 = !DISubroutineType(types: !18)84!18 = !{!19}85!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64, align: 64)86!20 = !{!21, !22, !24}87!21 = !DILocalVariable(name: "coro_hdl", scope: !16, file: !1, line: 9, type: !19)88!22 = !DILocalVariable(name: "i", scope: !23, file: !1, line: 11, type: !9)89!23 = distinct !DILexicalBlock(scope: !16, file: !1, line: 11, column: 3)90!24 = !DILocalVariable(name: "coro_mem", scope: !16, file: !1, line: 16, type: !19)91!26 = !DILocation(line: 9, column: 3, scope: !16)92!27 = !DILocation(line: 10, column: 8, scope: !23)93!33 = !DILocation(line: 11, column: 6, scope: !23)94!34 = !DILocation(line: 42, column: 2, scope: !100, inlinedAt: !101)95!35 = !DILocation(line: 13, column: 6, scope: !23)96!36 = !DILocation(line: 14, column: 6, scope: !23)97!37 = !DILocation(line: 16, column: 3, scope: !16)98!40 = !DILocation(line: 16, column: 3, scope: !16)99!41 = !DILocation(line: 17, column: 1, scope: !16)100 101!100 = distinct !DISubprogram(name: "callee", scope: !1, file: !1, line: 8, type: !17, scopeLine: 4, isOptimized: true, unit: !0, retainedNodes: !2)102!101 = !DILocation(line: 42, column: 6, scope: !102, inlinedAt: !103)103 104!102 = distinct !DISubprogram(name: "callee_recursive", scope: !1, file: !1, line: 8, type: !17, scopeLine: 4, isOptimized: true, unit: !0, retainedNodes: !2)105!103 = !DILocation(line: 12, column: 6, scope: !16)106