brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.3 KiB · 577ca9a Raw
111 lines · plain
1; Make sure that coro-split correctly deals with debug information.2; The test here is simply that it does not result in bad IR that will crash opt.3; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -disable-output4source_filename = "coro.c"5target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"6target triple = "x86_64-unknown-linux-gnu"7 8; Function Attrs: nounwind readnone9declare void @llvm.dbg.declare(metadata, metadata, metadata)10 11declare void @bar(...) local_unnamed_addr12 13; Function Attrs: nounwind uwtable14define ptr @f() #3 !dbg !16 {15entry:16  %0 = tail call token @llvm.coro.id(i32 0, ptr null, ptr @f, ptr null), !dbg !2617  %1 = tail call i64 @llvm.coro.size.i64(), !dbg !2618  %call = tail call ptr @malloc(i64 %1), !dbg !2619  %2 = tail call ptr @llvm.coro.begin(token %0, ptr %call), !dbg !2620  tail call void @llvm.dbg.value(metadata ptr %2, metadata !21, metadata !12), !dbg !2621  br label %for.cond, !dbg !2722 23for.cond:                                         ; preds = %for.cond, %entry24  tail call void @llvm.dbg.value(metadata i32 undef, metadata !22, metadata !12), !dbg !2825  tail call void @llvm.dbg.value(metadata i32 undef, metadata !11, metadata !12), !dbg !2926  tail call void (...) @bar(), !dbg !3327  %3 = tail call token @llvm.coro.save(ptr null), !dbg !3428  %4 = tail call i8 @llvm.coro.suspend(token %3, i1 false), !dbg !3429  %conv = sext i8 %4 to i32, !dbg !3430  switch i32 %conv, label %coro_Suspend [31    i32 0, label %for.cond32    i32 1, label %coro_Cleanup33  ], !dbg !3434 35coro_Cleanup:                                     ; preds = %for.cond36  %5 = tail call ptr @llvm.coro.free(token %0, ptr %2), !dbg !3537  tail call void @free(ptr nonnull %5), !dbg !3638  br label %coro_Suspend, !dbg !3639 40coro_Suspend:                                     ; preds = %for.cond, %if.then, %coro_Cleanup41  tail call void @llvm.coro.end(ptr null, i1 false, token none), !dbg !3842  ret ptr %2, !dbg !3943}44 45; Function Attrs: argmemonly nounwind46declare void @llvm.lifetime.start.p0(ptr nocapture)47 48; Function Attrs: argmemonly nounwind readonly49declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr)50 51; Function Attrs: nounwind52declare noalias ptr @malloc(i64) local_unnamed_addr53declare i64 @llvm.coro.size.i64()54declare ptr @llvm.coro.begin(token, ptr writeonly)55declare token @llvm.coro.save(ptr)56declare i8 @llvm.coro.suspend(token, i1)57declare void @llvm.lifetime.end.p0(ptr nocapture)58declare ptr @llvm.coro.free(token, ptr nocapture readonly)59declare void @free(ptr nocapture) local_unnamed_addr60declare void @llvm.coro.end(ptr, i1, token)61declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8)62 63declare void @llvm.dbg.value(metadata, metadata, metadata)64 65attributes #3 = { nounwind uwtable presplitcoroutine }66 67!llvm.dbg.cu = !{!0}68!llvm.module.flags = !{!3, !4}69!llvm.ident = !{!5}70 71!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 4.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)72!1 = !DIFile(filename: "coro.c", directory: "/home/gor/build/bin")73!2 = !{}74!3 = !{i32 2, !"Dwarf Version", i32 4}75!4 = !{i32 2, !"Debug Info Version", i32 3}76!5 = !{!"clang version 4.0.0"}77!6 = distinct !DISubprogram(name: "print", scope: !1, file: !1, line: 6, type: !7, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !10)78!7 = !DISubroutineType(types: !8)79!8 = !{null, !9}80!9 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)81!10 = !{!11}82!11 = !DILocalVariable(name: "v", arg: 1, scope: !6, file: !1, line: 6, type: !9)83!12 = !DIExpression()84!13 = !DILocation(line: 6, column: 16, scope: !6)85!14 = !DILocation(line: 6, column: 19, scope: !6)86!15 = !DILocation(line: 6, column: 25, scope: !6)87!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)88!17 = !DISubroutineType(types: !18)89!18 = !{!19}90!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64, align: 64)91!20 = !{!21, !22, !24}92!21 = !DILocalVariable(name: "coro_hdl", scope: !16, file: !1, line: 9, type: !19)93!22 = !DILocalVariable(name: "i", scope: !23, file: !1, line: 11, type: !9)94!23 = distinct !DILexicalBlock(scope: !16, file: !1, line: 11, column: 3)95!24 = !DILocalVariable(name: "coro_mem", scope: !25, file: !1, line: 16, type: !19)96!25 = distinct !DILexicalBlock(scope: !16, file: !1, line: 16, column: 3)97!26 = !DILocation(line: 9, column: 3, scope: !16)98!27 = !DILocation(line: 11, column: 8, scope: !23)99!28 = !DILocation(line: 11, column: 12, scope: !23)100!29 = !DILocation(line: 6, column: 16, scope: !6, inlinedAt: !30)101!30 = distinct !DILocation(line: 12, column: 5, scope: !31)102!31 = distinct !DILexicalBlock(scope: !32, file: !1, line: 11, column: 25)103!32 = distinct !DILexicalBlock(scope: !23, file: !1, line: 11, column: 3)104!33 = !DILocation(line: 6, column: 19, scope: !6, inlinedAt: !30)105!34 = !DILocation(line: 13, column: 5, scope: !31)106!35 = !DILocation(line: 16, column: 3, scope: !25)107!36 = !DILocation(line: 16, column: 3, scope: !37)108!37 = distinct !DILexicalBlock(scope: !25, file: !1, line: 16, column: 3)109!38 = !DILocation(line: 16, column: 3, scope: !16)110!39 = !DILocation(line: 17, column: 1, scope: !16)111