101 lines · plain
1; RUN: llc -O1 %s -mtriple=x86_64 -filetype=obj -o %t && llvm-dwarfdump -debug-line %t | FileCheck -v --check-prefix=LINE-TABLE %s2 3; based on4;5; 1: int bar();6; 2: int baz();7; 3;8; 4: int foo(int a) {9; 5: if (a > 20)10; 6: return bar();11; 7: else12; 8: return baz();13; 9: }14;15; compiled with -g -S -emit-llvm -O116 17 18; LINE-TABLE: .debug_line contents:19; LINE-TABLE: Line table prologue:20; LINE-TABLE: total_length: 0x0000006921; LINE-TABLE: format: DWARF3222; LINE-TABLE: version: 523; LINE-TABLE: address_size: 824; LINE-TABLE: seg_select_size: 025; LINE-TABLE: prologue_length: 0x0000003726 27; LINE-TABLE: Address Line Column File ISA Discriminator OpIndex Flags28; LINE-TABLE-NEXT: ------------------ ------ ------ ------ --- ------------- ------- -------------29; LINE-TABLE-NEXT: 0x0000000000000000 4 0 0 0 0 0 is_stmt30; LINE-TABLE-NEXT: 0x0000000000000001 5 9 0 0 0 0 is_stmt prologue_end31; LINE-TABLE-NEXT: 0x0000000000000004 5 7 0 0 0 032; LINE-TABLE-NEXT: 0x0000000000000006 6 12 0 0 0 0 is_stmt33; LINE-TABLE-NEXT: 0x000000000000000b 9 1 0 0 0 0 is_stmt epilogue_begin34; LINE-TABLE-NEXT: 0x000000000000000d 8 12 0 0 0 0 is_stmt35; LINE-TABLE-NEXT: 0x0000000000000012 9 1 0 0 0 0 is_stmt epilogue_begin36; LINE-TABLE-NEXT: 0x0000000000000014 9 1 0 0 0 0 is_stmt end_sequence37 38 39 40 41; Function Attrs: mustprogress uwtable42define dso_local noundef i32 @_Z3fooi(i32 noundef %a) local_unnamed_addr #0 !dbg !8 {43entry:44 call void @llvm.dbg.value(metadata i32 %a, metadata !13, metadata !DIExpression()), !dbg !1445 %cmp = icmp sgt i32 %a, 20, !dbg !1546 br i1 %cmp, label %if.then, label %if.else, !dbg !1747 48if.then: ; preds = %entry49 %call = call noundef i32 @_Z3barv(), !dbg !1850 br label %return, !dbg !1951 52if.else: ; preds = %entry53 %call1 = call noundef i32 @_Z3bazv(), !dbg !2054 br label %return, !dbg !2155 56return: ; preds = %if.else, %if.then57 %retval.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ], !dbg !2258 ret i32 %retval.0, !dbg !2359}60 61declare !dbg !24 dso_local noundef i32 @_Z3barv() local_unnamed_addr #162 63declare !dbg !28 dso_local noundef i32 @_Z3bazv() local_unnamed_addr #164 65; Function Attrs: nofree nosync nounwind readnone speculatable willreturn66declare void @llvm.dbg.value(metadata, metadata, metadata) #267 68!llvm.dbg.cu = !{!0}69!llvm.module.flags = !{!2, !3, !4, !5, !6}70!llvm.ident = !{!7}71 72!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 15.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)73!1 = !DIFile(filename: "q.cpp", directory: "/", checksumkind: CSK_MD5, checksum: "6b5f6118d466ba2f6510ac0790b09bef")74!2 = !{i32 7, !"Dwarf Version", i32 5}75!3 = !{i32 2, !"Debug Info Version", i32 3}76!4 = !{i32 1, !"wchar_size", i32 4}77!5 = !{i32 7, !"uwtable", i32 2}78!6 = !{i32 7, !"frame-pointer", i32 2}79!7 = !{!"clang version 15.0.0"}80!8 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !1, file: !1, line: 4, type: !9, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12)81!9 = !DISubroutineType(types: !10)82!10 = !{!11, !11}83!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)84!12 = !{!13}85!13 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !1, line: 4, type: !11)86!14 = !DILocation(line: 0, scope: !8)87!15 = !DILocation(line: 5, column: 9, scope: !16)88!16 = distinct !DILexicalBlock(scope: !8, file: !1, line: 5, column: 7)89!17 = !DILocation(line: 5, column: 7, scope: !8)90!18 = !DILocation(line: 6, column: 12, scope: !16)91!19 = !DILocation(line: 6, column: 5, scope: !16)92!20 = !DILocation(line: 8, column: 12, scope: !16)93!21 = !DILocation(line: 8, column: 5, scope: !16)94!22 = !DILocation(line: 0, scope: !16)95!23 = !DILocation(line: 9, column: 1, scope: !8)96!24 = !DISubprogram(name: "bar", linkageName: "_Z3barv", scope: !1, file: !1, line: 1, type: !25, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !27)97!25 = !DISubroutineType(types: !26)98!26 = !{!11}99!27 = !{}100!28 = !DISubprogram(name: "baz", linkageName: "_Z3bazv", scope: !1, file: !1, line: 2, type: !25, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !27)101