brintos

brintos / llvm-project-archived public Read only

0
0
Text · 12.9 KiB · 28fc044 Raw
286 lines · plain
1# RUN: llc %s -o - -run-pass=removeredundantdebugvalues | FileCheck --implicit-check-not=DBG_VALUE %s2# RUN: llc %s -o - -passes=remove-redundant-debug-values | FileCheck --implicit-check-not=DBG_VALUE %s3 4## This checks that the RemoveRedundantDebugValues removes redundant5## DBG_VALUEs. The MIR was hand-written, and foo{[2-6]}() are just6## copies of foo(), with an extra instruction that modifies the $edi register7## and extra (artificial) DBG_VALUE and DBG_VALUE_LIST instructions.8 9# CHECK-LABEL: foo10# CHECK-LABEL: bb.0.entry:11# CHECK:      DBG_VALUE $edi12# CHECK-NOT:  DBG_VALUE $edi13# CHECK:      frame-setup PUSH64r14# CHECK:      MOV32mr $rip, 1, $noreg15# CHECK-NOT:  DBG_VALUE $edi16 17# CHECK-LABEL: foo618# CHECK-LABEL: bb.0.entry:19# CHECK:      DBG_VALUE 020# CHECK:      DBG_VALUE 121# CHECK:      frame-setup PUSH64r22 23# CHECK-LABEL: foo224# CHECK-LABEL: bb.0.entry:25# CHECK:  DBG_VALUE $edi26# CHECK:  MOV32mr $rip, 1, $noreg27# CHECK:  DBG_VALUE $edi28 29# CHECK-LABEL: foo330# CHECK-LABEL: bb.0.entry:31# CHECK:  DBG_VALUE $edi, {{.*}}, !DIExpression(DW_OP_LLVM_fragment, 0, 32)32# CHECK:  DBG_VALUE $esi, {{.*}}, !DIExpression()33# CHECK:  DBG_VALUE $edi, {{.*}}, !DIExpression(DW_OP_LLVM_fragment, 0, 32)34 35# CHECK-LABEL: foo436# CHECK-LABEL: bb.0.entry:37# CHECK:  DBG_VALUE $edi, {{.*}}, !DIExpression(DW_OP_LLVM_fragment, 0, 32)38# CHECK:  DBG_VALUE_LIST !{{.*}}39# CHECK:  DBG_VALUE $edi, {{.*}}, !DIExpression(DW_OP_LLVM_fragment, 0, 32)40 41# CHECK-LABEL: foo542# CHECK-LABEL: bb.0.entry:43# CHECK:  DBG_VALUE $edi, {{.*}}, !DIExpression(DW_OP_LLVM_fragment, 0, 32)44# CHECK:  DBG_VALUE 0, {{.*}}, !DIExpression()45# CHECK:  DBG_VALUE $edi, {{.*}}, !DIExpression(DW_OP_LLVM_fragment, 0, 32)46 47--- |48  ; ModuleID = 'test.ll'49  source_filename = "test.c"50  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"51  target triple = "x86_64-unknown-linux-gnu"52  53  @side_effect = external dso_local local_unnamed_addr global i32, align 454  @value = external dso_local local_unnamed_addr global i32, align 455  56  ; Function Attrs: nounwind uwtable57  define dso_local i32 @foo(i32 %param) local_unnamed_addr !dbg !8 {58  entry:59    call void @llvm.dbg.value(metadata i32 %param, metadata !13, metadata !DIExpression()), !dbg !1460    store i32 %param, ptr @side_effect, align 4, !dbg !1561    %0 = load i32, ptr @value, align 4, !dbg !2062    call void @llvm.dbg.value(metadata i32 %0, metadata !13, metadata !DIExpression()), !dbg !1463    tail call void @bar(i32 %0), !dbg !2164    ret i32 0, !dbg !2265  }66 67  define dso_local i32 @foo6(i32 %param) local_unnamed_addr !dbg !34 {68  entry:69    store i32 %param, ptr @side_effect, align 4, !dbg !3570    %0 = load i32, ptr @value, align 4, !dbg !3571    tail call void @bar(i32 %0), !dbg !3572    ret i32 0, !dbg !3573  }74 75  ; Function Attrs: nounwind uwtable76  define dso_local i32 @foo2(i32 %param) local_unnamed_addr !dbg !26 {77  entry:78    store i32 %param, ptr @side_effect, align 4, !dbg !2779    %0 = load i32, ptr @value, align 4, !dbg !2780    tail call void @bar(i32 %0), !dbg !2781    ret i32 0, !dbg !2782  }83 84  ; Function Attrs: nounwind uwtable85  define dso_local i32 @foo3(i32 %param) local_unnamed_addr !dbg !28 {86  entry:87    store i32 %param, ptr @side_effect, align 4, !dbg !2988    %0 = load i32, ptr @value, align 4, !dbg !2989    tail call void @bar(i32 %0), !dbg !2990    ret i32 0, !dbg !2991  }92 93  ; Function Attrs: nounwind uwtable94  define dso_local i32 @foo4(i32 %param) local_unnamed_addr !dbg !30 {95  entry:96    store i32 %param, ptr @side_effect, align 4, !dbg !3197    %0 = load i32, ptr @value, align 4, !dbg !3198    tail call void @bar(i32 %0), !dbg !3199    ret i32 0, !dbg !31100  }101 102  ; Function Attrs: nounwind uwtable103  define dso_local i32 @foo5(i32 %param) local_unnamed_addr !dbg !32 {104  entry:105    store i32 %param, ptr @side_effect, align 4, !dbg !33106    %0 = load i32, ptr @value, align 4, !dbg !33107    tail call void @bar(i32 %0), !dbg !33108    ret i32 0, !dbg !33109  }110 111  declare !dbg !23 dso_local void @bar(i32) local_unnamed_addr112  113  ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn114  declare void @llvm.dbg.value(metadata, metadata, metadata)115  116  !llvm.dbg.cu = !{!0}117  !llvm.module.flags = !{!3, !4, !5, !6}118  !llvm.ident = !{!7}119  120  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 13.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)121  !1 = !DIFile(filename: "test.c", directory: "/dir")122  !2 = !{}123  !3 = !{i32 7, !"Dwarf Version", i32 4}124  !4 = !{i32 2, !"Debug Info Version", i32 3}125  !5 = !{i32 1, !"wchar_size", i32 4}126  !6 = !{i32 7, !"uwtable", i32 1}127  !7 = !{!"clang version 13.0.0"}128  !8 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 4, type: !9, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12)129  !9 = !DISubroutineType(types: !10)130  !10 = !{!11, !11}131  !11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)132  !12 = !{!13}133  !13 = !DILocalVariable(name: "param", arg: 1, scope: !8, file: !1, line: 4, type: !11)134  !14 = !DILocation(line: 0, scope: !8)135  !15 = !DILocation(line: 5, column: 17, scope: !8)136  !20 = !DILocation(line: 6, column: 13, scope: !8)137  !21 = !DILocation(line: 7, column: 5, scope: !8)138  !22 = !DILocation(line: 8, column: 5, scope: !8)139  !23 = !DISubprogram(name: "bar", scope: !1, file: !1, line: 1, type: !24, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)140  !24 = !DISubroutineType(types: !25)141  !25 = !{null, !11}142  !26 = distinct !DISubprogram(name: "foo2", scope: !1, file: !1, line: 4, type: !9, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)143  !27 = !DILocation(line: 0, scope: !26)144  !28 = distinct !DISubprogram(name: "foo3", scope: !1, file: !1, line: 4, type: !9, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)145  !29 = !DILocation(line: 0, scope: !28)146  !30 = distinct !DISubprogram(name: "foo4", scope: !1, file: !1, line: 4, type: !9, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)147  !31 = !DILocation(line: 0, scope: !30)148  !32 = distinct !DISubprogram(name: "foo5", scope: !1, file: !1, line: 4, type: !9, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)149  !33 = !DILocation(line: 0, scope: !32)150  !34 = distinct !DISubprogram(name: "foo6", scope: !1, file: !1, line: 4, type: !9, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)151  !35 = !DILocation(line: 0, scope: !34)152 153...154---155name:            foo156alignment:       16157liveins:158  - { reg: '$edi', virtual-reg: '' }159body:             |160  bb.0.entry:161    liveins: $edi, $esi162  163    DBG_VALUE $edi, $noreg, !13, !DIExpression(), debug-location !14164    DBG_VALUE $edi, $noreg, !13, !DIExpression(), debug-location !14165    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp166    CFI_INSTRUCTION def_cfa_offset 16167    MOV32mr $rip, 1, $noreg, @side_effect, $noreg, killed renamable $esi, debug-location !15 :: (store 4 into @side_effect)168    DBG_VALUE $edi, $noreg, !13, !DIExpression(), debug-location !14169    CALL64pcrel32 @bar, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit-def $rsp, implicit-def $ssp, debug-location !21170    $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, debug-location !22171    $rcx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !22172    CFI_INSTRUCTION def_cfa_offset 8, debug-location !22173    RET64 killed $eax, debug-location !22174 175...176---177name:            foo2178alignment:       16179liveins:180  - { reg: '$edi', virtual-reg: '' }181body:             |182  bb.0.entry:183    liveins: $edi, $esi184  185    DBG_VALUE $edi, $noreg, !13, !DIExpression(), debug-location !14186    DBG_VALUE $edi, $noreg, !13, !DIExpression(), debug-location !14187    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp188    CFI_INSTRUCTION def_cfa_offset 16189    MOV32mr $rip, 1, $noreg, @side_effect, $noreg, killed renamable $esi, debug-location !15 :: (store 4 into @side_effect)190    renamable $edi = MOV32rm $rip, 1, $noreg, @value, $noreg, debug-location !20 :: (dereferenceable load 4 from @value)191    DBG_VALUE $edi, $noreg, !13, !DIExpression(), debug-location !14192    CALL64pcrel32 @bar, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit-def $rsp, implicit-def $ssp, debug-location !21193    $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, debug-location !22194    $rcx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !22195    CFI_INSTRUCTION def_cfa_offset 8, debug-location !22196    RET64 killed $eax, debug-location !22197 198...199---200name:            foo3201alignment:       16202liveins:203  - { reg: '$edi', virtual-reg: '' }204body:             |205  bb.0.entry:206    liveins: $edi, $esi207  208    DBG_VALUE $edi, $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !14209    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp210    CFI_INSTRUCTION def_cfa_offset 16211    MOV32mr $rip, 1, $noreg, @side_effect, $noreg, killed renamable $esi, debug-location !15 :: (store 4 into @side_effect)212    renamable $esi = MOV32rm $rip, 1, $noreg, @value, $noreg, debug-location !20 :: (dereferenceable load 4 from @value)213    DBG_VALUE $esi, $noreg, !13, !DIExpression(), debug-location !14214    $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, debug-location !22215    DBG_VALUE $edi, $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !14216    $rcx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !22217    CFI_INSTRUCTION def_cfa_offset 8, debug-location !22218    RET64 killed $eax, debug-location !22219 220...221---222name:            foo4223alignment:       16224liveins:225  - { reg: '$edi', virtual-reg: '' }226body:             |227  bb.0.entry:228    liveins: $edi, $esi229  230    DBG_VALUE $edi, $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !14231    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp232    CFI_INSTRUCTION def_cfa_offset 16233    MOV32mr $rip, 1, $noreg, @side_effect, $noreg, killed renamable $esi, debug-location !15 :: (store 4 into @side_effect)234    renamable $esi = MOV32rm $rip, 1, $noreg, @value, $noreg, debug-location !20 :: (dereferenceable load 4 from @value)235    DBG_VALUE_LIST !13, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), $edi, $esi, debug-location !14236    $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, debug-location !22237    DBG_VALUE $edi, $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !14238    $rcx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !22239    CFI_INSTRUCTION def_cfa_offset 8, debug-location !22240    RET64 killed $eax, debug-location !22241 242...243---244name:            foo5245alignment:       16246liveins:247  - { reg: '$edi', virtual-reg: '' }248body:             |249  bb.0.entry:250    liveins: $edi, $esi251  252    DBG_VALUE $edi, $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !14253    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp254    CFI_INSTRUCTION def_cfa_offset 16255    MOV32mr $rip, 1, $noreg, @side_effect, $noreg, killed renamable $esi, debug-location !15 :: (store 4 into @side_effect)256    renamable $esi = MOV32rm $rip, 1, $noreg, @value, $noreg, debug-location !20 :: (dereferenceable load 4 from @value)257    DBG_VALUE 0, $noreg, !13, !DIExpression(), debug-location !14258    $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, debug-location !22259    DBG_VALUE $edi, $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !14260    $rcx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !22261    CFI_INSTRUCTION def_cfa_offset 8, debug-location !22262    RET64 killed $eax, debug-location !22263 264...265---266name:            foo6267alignment:       16268liveins:269  - { reg: '$edi', virtual-reg: '' }270body:             |271  bb.0.entry:272    liveins: $edi, $esi273 274    DBG_VALUE 0, $noreg, !13, !DIExpression(), debug-location !14275    DBG_VALUE 1, $noreg, !13, !DIExpression(), debug-location !14276    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp277    CFI_INSTRUCTION def_cfa_offset 16278    MOV32mr $rip, 1, $noreg, @side_effect, $noreg, killed renamable $esi, debug-location !15 :: (store 4 into @side_effect)279    renamable $esi = MOV32rm $rip, 1, $noreg, @value, $noreg, debug-location !20 :: (dereferenceable load 4 from @value)280    $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, debug-location !22281    $rcx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !22282    CFI_INSTRUCTION def_cfa_offset 8, debug-location !22283    RET64 killed $eax, debug-location !22284 285...286