81 lines · plain
1# REQUIRES: x86-registered-target2# RUN: llc -mtriple=x86_64-unknown-linux-gnu -run-pass=mir-check-debugify -o - %s 2>&1 | FileCheck %s3--- |4 ; ModuleID = 'check-line-and-variables.mir'5 source_filename = "check-line-and-variables.c"6 7 @ga = dso_local local_unnamed_addr global i32 2, align 48 9 ; Function Attrs: nofree norecurse nounwind uwtable writeonly10 define dso_local i32 @foo(i32 %a, i32 %b) local_unnamed_addr #0 !dbg !9 {11 entry:12 %add = add nsw i32 %b, %a, !dbg !1513 call void @llvm.dbg.value(metadata i32 %add, metadata !12, metadata !DIExpression()), !dbg !1514 %mul = shl nsw i32 %add, 1, !dbg !1615 call void @llvm.dbg.value(metadata i32 %mul, metadata !14, metadata !DIExpression()), !dbg !1616 store i32 %mul, ptr @ga, align 4, !dbg !1717 ret i32 %add, !dbg !1818 }19 20 declare void @llvm.dbg.value(metadata, metadata, metadata) #121 22 !llvm.module.flags = !{!0, !1}23 !llvm.ident = !{!2}24 !llvm.dbg.cu = !{!3}25 !llvm.mir.debugify = !{!6, !7}26 !llvm.debugify = !{!8, !7}27 28 !0 = !{i32 1, !"wchar_size", i32 4}29 !1 = !{i32 2, !"Debug Info Version", i32 3}30 !2 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git c0a922b3db2d39f36c0c01776cce90cc160a7d62)"}31 !3 = distinct !DICompileUnit(language: DW_LANG_C, file: !4, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !5)32 !4 = !DIFile(filename: "main.mir", directory: "/")33 !5 = !{}34 !6 = !{i32 6}35 !7 = !{i32 2}36 !8 = !{i32 4}37 !9 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: !4, line: 1, type: !10, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !3, retainedNodes: !11)38 !10 = !DISubroutineType(types: !5)39 !11 = !{!12, !14}40 !12 = !DILocalVariable(name: "1", scope: !9, file: !4, line: 1, type: !13)41 !13 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)42 !14 = !DILocalVariable(name: "2", scope: !9, file: !4, line: 2, type: !13)43 !15 = !DILocation(line: 1, column: 1, scope: !9)44 !16 = !DILocation(line: 2, column: 1, scope: !9)45 !17 = !DILocation(line: 3, column: 1, scope: !9)46 !18 = !DILocation(line: 4, column: 1, scope: !9)47 48...49---50name: foo51body: |52 bb.0.entry:53 liveins: $edi, $esi54 55 %1:gr32 = COPY $esi, debug-location !1556 DBG_VALUE %1, $noreg, !12, !DIExpression(), debug-location !1557 ; Let it missing !14 and debug-location !1658 ; %0:gr32 = COPY $edi, debug-location !1659 ; DBG_VALUE %0, $noreg, !14, !DIExpression(), debug-location !1660 %0:gr32 = COPY $edi61 %2:gr32 = nsw ADD32rr %1, %0, implicit-def dead $eflags, debug-location !1762 DBG_VALUE %2, $noreg, !12, !DIExpression(), debug-location !1763 DBG_VALUE $eflags, $noreg, !12, !DIExpression(), debug-location !1764 %3:gr32 = nsw ADD32rr %2, %2, implicit-def dead $eflags, debug-location !1865 DBG_VALUE %3, $noreg, !12, !DIExpression(), debug-location !1866 DBG_VALUE $eflags, $noreg, !12, !DIExpression(), debug-location !1867 MOV32mr $rip, 1, $noreg, @ga, $noreg, killed %3, debug-location !DILocation(line: 5, column: 1, scope: !9) :: (store (s32) into @ga, !tbaa !18)68 DBG_VALUE 0, $noreg, !12, !DIExpression(), debug-location !DILocation(line: 5, column: 1, scope: !9)69 ; Let it miss Line 6: Change "!DILocation(line: 6, ..." to "!DILocation(line: 5, ..."70 $eax = COPY %2, debug-location !DILocation(line: 5, column: 1, scope: !9)71 DBG_VALUE $eax, $noreg, !12, !DIExpression(), debug-location !DILocation(line: 6, column: 1, scope: !9)72 RET 0, $eax, debug-location !DILocation(line: 7, column: 1, scope: !9)73 74 ;CHECK: WARNING: Instruction with empty DebugLoc in function foo --%1:gr32 = COPY $edi75 ;CHECK-NEXT: WARNING: Missing line 276 ;CHECK-NEXT: WARNING: Missing line 677 ;CHECK-NEXT: WARNING: Missing variable 278 ;CHECK-NEXT: Machine IR debug info check: FAIL79 80...81