brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.3 KiB · 0ac7deb Raw
101 lines · plain
1; RUN: opt -passes=adce -S < %s | FileCheck %s2; Test that debug info intrinsics in dead scopes get eliminated by -adce.3 4; Generated with 'clang -g -S -emit-llvm | opt -passes=mem2reg -inline' at r2628995; (before -passes=adce  was augmented) and then hand-reduced.  This was the input:6;7;;void sink(void);8;;9;;void variable_in_unused_subscope(void) {10;;  { int i = 0; }11;;  sink();12;;}13;;14;;void variable_in_parent_scope(void) {15;;  int i = 0;16;;  { sink(); }17;;}18;;19;;static int empty_function_with_unused_variable(void) {20;;  { int i = 0; }21;;  return 0;22;;}23;;24;;void calls_empty_function_with_unused_variable_in_unused_subscope(void) {25;;  { empty_function_with_unused_variable(); }26;;  sink();27;;}28 29declare void @llvm.dbg.value(metadata, metadata, metadata)30 31declare void @sink()32 33; CHECK-LABEL: define void @variable_in_unused_subscope(34define void @variable_in_unused_subscope() !dbg !4 {35; CHECK-NEXT: entry:36; CHECK-NEXT:   call void @sink37; CHECK-NEXT:   ret void38entry:39  call void @llvm.dbg.value(metadata i32 0, metadata !15, metadata !17), !dbg !1840  call void @sink(), !dbg !1941  ret void, !dbg !2042}43 44; CHECK-LABEL: define void @variable_in_parent_scope(45define void @variable_in_parent_scope() !dbg !7 {46; CHECK-NEXT: entry:47; CHECK-NEXT:   #dbg_value48; CHECK-NEXT:   call void @sink49; CHECK-NEXT:   ret void50entry:51  call void @llvm.dbg.value(metadata i32 0, metadata !21, metadata !17), !dbg !2252  call void @sink(), !dbg !2353  ret void, !dbg !2554}55 56; CHECK-LABEL: define void @calls_empty_function_with_unused_variable_in_unused_subscope(57define void @calls_empty_function_with_unused_variable_in_unused_subscope() !dbg !8 {58; CHECK-NEXT: entry:59; CHECK-NEXT:   call void @sink60; CHECK-NEXT:   ret void61entry:62  call void @llvm.dbg.value(metadata i32 0, metadata !26, metadata !17), !dbg !2863  call void @sink(), !dbg !3164  ret void, !dbg !3265}66 67!llvm.dbg.cu = !{!0}68!llvm.module.flags = !{!14}69 70!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)71!1 = !DIFile(filename: "t.c", directory: "/path/to/test/Transforms/ADCE")72!2 = !{}73!4 = distinct !DISubprogram(name: "variable_in_unused_subscope", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)74!5 = !DISubroutineType(types: !6)75!6 = !{null}76!7 = distinct !DISubprogram(name: "variable_in_parent_scope", scope: !1, file: !1, line: 8, type: !5, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)77!8 = distinct !DISubprogram(name: "calls_empty_function_with_unused_variable_in_unused_subscope", scope: !1, file: !1, line: 18, type: !5, isLocal: false, isDefinition: true, scopeLine: 18, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)78!10 = distinct !DISubprogram(name: "empty_function_with_unused_variable", scope: !1, file: !1, line: 13, type: !11, isLocal: true, isDefinition: true, scopeLine: 13, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)79!11 = !DISubroutineType(types: !12)80!12 = !{!13}81!13 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)82!14 = !{i32 2, !"Debug Info Version", i32 3}83!15 = !DILocalVariable(name: "i", scope: !16, file: !1, line: 4, type: !13)84!16 = distinct !DILexicalBlock(scope: !4, file: !1, line: 4, column: 3)85!17 = !DIExpression()86!18 = !DILocation(line: 4, column: 9, scope: !16)87!19 = !DILocation(line: 5, column: 3, scope: !4)88!20 = !DILocation(line: 6, column: 1, scope: !4)89!21 = !DILocalVariable(name: "i", scope: !7, file: !1, line: 9, type: !13)90!22 = !DILocation(line: 9, column: 7, scope: !7)91!23 = !DILocation(line: 10, column: 5, scope: !24)92!24 = distinct !DILexicalBlock(scope: !7, file: !1, line: 10, column: 3)93!25 = !DILocation(line: 11, column: 1, scope: !7)94!26 = !DILocalVariable(name: "i", scope: !27, file: !1, line: 14, type: !13)95!27 = distinct !DILexicalBlock(scope: !10, file: !1, line: 14, column: 3)96!28 = !DILocation(line: 14, column: 9, scope: !27, inlinedAt: !29)97!29 = distinct !DILocation(line: 19, column: 5, scope: !30)98!30 = distinct !DILexicalBlock(scope: !8, file: !1, line: 19, column: 3)99!31 = !DILocation(line: 20, column: 3, scope: !8)100!32 = !DILocation(line: 21, column: 1, scope: !8)101