80 lines · plain
1; RUN: opt < %s -passes=deadargelim \2; RUN: -verify-each-debuginfo-preserve \3; RUN: -debugify-level=locations -S 2>&1 | FileCheck %s4 5; RUN: opt < %s -passes=deadargelim \6; RUN: -verify-each-debuginfo-preserve \7; RUN: -debugify-level=location+variables -S 2>&1 | FileCheck %s --check-prefix=CHECK-DROP8 9; RUN: opt < %s -passes=deadargelim \10; RUN: -verify-each-debuginfo-preserve \11; RUN: -debugify-func-limit=0 -S 2>&1 | FileCheck %s12 13; RUN: opt < %s -passes=deadargelim \14; RUN: -verify-each-debuginfo-preserve \15; RUN: -debugify-func-limit=2 -S 2>&1 | FileCheck %s --check-prefix=CHECK-DROP16 17; CHECK-NOT: drops dbg.value()/dbg.declare()18; CHECK-DROP: drops dbg.value()/dbg.declare()19 20target triple = "x86_64-unknown-linux-gnu"21 22define dso_local i32 @fn2(i32 %l, i32 %k) !dbg !7 {23entry:24 tail call void @llvm.dbg.value(metadata i32 %l, metadata !12, metadata !DIExpression()), !dbg !1525 tail call void @llvm.dbg.value(metadata i32 %k, metadata !13, metadata !DIExpression()), !dbg !1526 %call = call i32 (...) @fn3(), !dbg !1627 tail call void @llvm.dbg.value(metadata i32 %call, metadata !14, metadata !DIExpression()), !dbg !1528 ret i32 %call, !dbg !1729}30 31declare !dbg !18 dso_local i32 @fn3(...)32 33define dso_local i32 @fn(i32 %x, i32 %y) !dbg !22 {34entry:35 tail call void @llvm.dbg.value(metadata i32 %x, metadata !24, metadata !DIExpression()), !dbg !2736 tail call void @llvm.dbg.value(metadata i32 %y, metadata !25, metadata !DIExpression()), !dbg !2737 %call = call i32 @fn2(i32 %x, i32 %y), !dbg !2738 tail call void @llvm.dbg.value(metadata i32 %call, metadata !26, metadata !DIExpression()), !dbg !2739 %add = add nsw i32 %call, %x, !dbg !2740 %add1 = add nsw i32 %add, %y, !dbg !2741 ret i32 %add1, !dbg !2742}43 44declare void @llvm.dbg.value(metadata, metadata, metadata)45 46!llvm.dbg.cu = !{!0}47!llvm.module.flags = !{!2, !3, !4, !5}48!llvm.ident = !{!6}49 50!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 14.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)51!1 = !DIFile(filename: "test.c", directory: "/dir")52!2 = !{i32 7, !"Dwarf Version", i32 4}53!3 = !{i32 2, !"Debug Info Version", i32 3}54!4 = !{i32 1, !"wchar_size", i32 4}55!5 = !{i32 7, !"uwtable", i32 1}56!6 = !{!"clang version 14.0.0"}57!7 = distinct !DISubprogram(name: "fn2", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0,58 retainedNodes: !11)59!8 = !DISubroutineType(types: !9)60!9 = !{!10, !10, !10}61!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)62!11 = !{!12, !13, !14}63!12 = !DILocalVariable(name: "l", arg: 1, scope: !7, file: !1, line: 3, type: !10)64!13 = !DILocalVariable(name: "k", arg: 2, scope: !7, file: !1, line: 3, type: !10)65!14 = !DILocalVariable(name: "s", scope: !7, file: !1, line: 4, type: !10)66!15 = !DILocation(line: 0, scope: !7)67!16 = !DILocation(line: 4, column: 11, scope: !7)68!17 = !DILocation(line: 5, column: 3, scope: !7)69!18 = !DISubprogram(name: "fn3", scope: !1, file: !1, line: 1, type: !19, spFlags: DISPFlagOptimized, retainedNodes: !21)70!19 = !DISubroutineType(types: !20)71!20 = !{!10}72!21 = !{}73!22 = distinct !DISubprogram(name: "fn", scope: !1, file: !1, line: 8, type: !8, scopeLine: 8, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0,74 retainedNodes: !23)75!23 = !{!24, !25, !26}76!24 = !DILocalVariable(name: "x", arg: 1, scope: !22, file: !1, line: 8, type: !10)77!25 = !DILocalVariable(name: "y", arg: 2, scope: !22, file: !1, line: 8, type: !10)78!26 = !DILocalVariable(name: "local", scope: !22, file: !1, line: 9, type: !10)79!27 = !DILocation(line: 0, scope: !22)80