brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.2 KiB · d53434b Raw
240 lines · plain
1--- |2  ; RUN: llc -run-pass=livedebugvalues -o - %s | FileCheck %s3  ; Created from:4  ; void sink(int a);5  ; void __attribute((always_inline)) f(int a) { sink(a); }6  ; void foo(int i) {7  ;   f(i);8  ;   if (i)9  ;     f(i);10  ;   f(i);11  ; }12  ;13  ; This test verifies that LiveDebugValues doesn't propagate DBG_VALUEs into14  ; basic blocks that are beyond the scope of the source variable.15  ;16  ; CHECK: ![[F_SP:[0-9]+]] = distinct !DISubprogram(name: "f", {{.*}})17  ; CHECK: ![[A_VAR:[0-9]+]] = !DILocalVariable(name: "a",{{.*}})18  ; CHECK: ![[I_VAR:[0-9]+]] = !DILocalVariable(name: "i",{{.*}})19  ; CHECK: ![[I_LOC:[0-9]+]] = !DILocation(line: 4, column: 14, scope: !{{[0-9]+}})20  ; CHECK: ![[INLCS1:[0-9]+]] = !DILocation(line: 3, column: 41, scope: ![[F_SP]], inlinedAt: ![[CS1:[0-9]+]])21  ; CHECK: ![[CS1]] = distinct !DILocation(line: 5, column: 3, scope: !{{[0-9]+}})22  ; CHECK: ![[INLCS2:[0-9]+]] = !DILocation(line: 3, column: 41, scope: ![[F_SP]], inlinedAt: ![[CS2:[0-9]+]])23  ; CHECK: ![[CS2]] = distinct !DILocation(line: 7, column: 5, scope: !{{[0-9]+}})24  ; CHECK: ![[INLCS3:[0-9]+]] = !DILocation(line: 3, column: 41, scope: ![[F_SP]], inlinedAt: ![[CS3:[0-9]+]])25  ; CHECK: ![[CS3]] = distinct !DILocation(line: 8, column: 3, scope: !{{[0-9]+}})26  ;27  ; CHECK:  bb.1.if.then:28  ; CHECK:      DBG_VALUE $ebx, $noreg, ![[I_VAR]], !DIExpression(), debug-location ![[I_LOC]]29  ; CHECK-NOT:  DBG_VALUE $ebx, $noreg, ![[A_VAR]], !DIExpression(), debug-location30  ; CHECK:      DBG_VALUE $ebx, $noreg, ![[A_VAR]], !DIExpression(), debug-location ![[INLCS2]]31  ; CHECK: bb.2.if.end:32  ; CHECK:     DBG_VALUE $ebx, $noreg, ![[I_VAR]], !DIExpression(), debug-location ![[I_LOC]]33  ; CHECK-NOT: DBG_VALUE $ebx, $noreg, ![[A_VAR]], !DIExpression(), debug-location34  ; CHECK:     DBG_VALUE $ebx, $noreg, ![[A_VAR]], !DIExpression(), debug-location ![[INLCS3]]35  ;36  ; ModuleID = 'livedebugvalues-limit.ll'37  source_filename = "livedebugvalues-limit.c"38  target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"39  target triple = "x86_64-apple-macosx"40  41  ; Function Attrs: alwaysinline nounwind ssp uwtable42  define void @f(i32 %a) local_unnamed_addr #0 !dbg !7 {43  entry:44    tail call void @llvm.dbg.value(metadata i32 %a, i64 0, metadata !12, metadata !13), !dbg !1445    tail call void @sink(i32 %a) #4, !dbg !1546    ret void, !dbg !1647  }48  49  declare void @sink(i32) local_unnamed_addr50  51  ; Function Attrs: nounwind ssp uwtable52  define void @foo(i32 %i) local_unnamed_addr #2 !dbg !17 {53  entry:54    tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !19, metadata !13), !dbg !2055    tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !12, metadata !13) #4, !dbg !2156    tail call void @sink(i32 %i) #4, !dbg !2357    %tobool = icmp eq i32 %i, 0, !dbg !2458    br i1 %tobool, label %if.end, label %if.then, !dbg !2659  60  if.then:                                          ; preds = %entry61    tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !12, metadata !13) #4, !dbg !2762    tail call void @sink(i32 %i) #4, !dbg !2963    br label %if.end, !dbg !3064  65  if.end:                                           ; preds = %if.then, %entry66    tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !12, metadata !13) #4, !dbg !3167    tail call void @sink(i32 %i) #4, !dbg !3368    ret void, !dbg !3469  }70  71  ; Function Attrs: nounwind readnone72  declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #373  74  ; Function Attrs: nounwind75  declare void @llvm.stackprotector(ptr, ptr) #476  77  attributes #0 = { alwaysinline nounwind ssp uwtable }78  attributes #2 = { nounwind ssp uwtable }79  attributes #3 = { nounwind readnone }80  attributes #4 = { nounwind }81  82  !llvm.dbg.cu = !{!0}83  !llvm.module.flags = !{!3, !4, !5}84  !llvm.ident = !{!6}85  86  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.0 (trunk 281923) (llvm/trunk 281916)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)87  !1 = !DIFile(filename: "livedebugvalues-limit.c", directory: "/Volumes/Fusion/Data/llvm")88  !2 = !{}89  !3 = !{i32 2, !"Dwarf Version", i32 4}90  !4 = !{i32 2, !"Debug Info Version", i32 3}91  !5 = !{i32 1, !"PIC Level", i32 2}92  !6 = !{!"clang version 4.0.0 (trunk 281923) (llvm/trunk 281916)"}93  !7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !11)94  !8 = !DISubroutineType(types: !9)95  !9 = !{null, !10}96  !10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)97  !11 = !{!12}98  !12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 3, type: !10)99  !13 = !DIExpression()100  !14 = !DILocation(line: 3, column: 41, scope: !7)101  !15 = !DILocation(line: 3, column: 46, scope: !7)102  !16 = !DILocation(line: 3, column: 55, scope: !7)103  !17 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 4, type: !8, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !18)104  !18 = !{!19}105  !19 = !DILocalVariable(name: "i", arg: 1, scope: !17, file: !1, line: 4, type: !10)106  !20 = !DILocation(line: 4, column: 14, scope: !17)107  !21 = !DILocation(line: 3, column: 41, scope: !7, inlinedAt: !22)108  !22 = distinct !DILocation(line: 5, column: 3, scope: !17)109  !23 = !DILocation(line: 3, column: 46, scope: !7, inlinedAt: !22)110  !24 = !DILocation(line: 6, column: 7, scope: !25)111  !25 = distinct !DILexicalBlock(scope: !17, file: !1, line: 6, column: 7)112  !26 = !DILocation(line: 6, column: 7, scope: !17)113  !27 = !DILocation(line: 3, column: 41, scope: !7, inlinedAt: !28)114  !28 = distinct !DILocation(line: 7, column: 5, scope: !25)115  !29 = !DILocation(line: 3, column: 46, scope: !7, inlinedAt: !28)116  !30 = !DILocation(line: 7, column: 5, scope: !25)117  !31 = !DILocation(line: 3, column: 41, scope: !7, inlinedAt: !32)118  !32 = distinct !DILocation(line: 8, column: 3, scope: !17)119  !33 = !DILocation(line: 3, column: 46, scope: !7, inlinedAt: !32)120  !34 = !DILocation(line: 9, column: 1, scope: !17)121 122...123---124name:            f125alignment:       16126exposesReturnsTwice: false127legalized:       false128regBankSelected: false129selected:        false130tracksRegLiveness: true131liveins:         132  - { reg: '$edi' }133calleeSavedRegisters: [ '$bh', '$bl', '$bp', '$bpl', '$bx', '$ebp', '$ebx', 134                        '$rbp', '$rbx', '$r12', '$r13', '$r14', '$r15', 135                        '$r12b', '$r13b', '$r14b', '$r15b', '$r12d', '$r13d', 136                        '$r14d', '$r15d', '$r12w', '$r13w', '$r14w', '$r15w' ]137frameInfo:       138  isFrameAddressTaken: false139  isReturnAddressTaken: false140  hasStackMap:     false141  hasPatchPoint:   false142  stackSize:       8143  offsetAdjustment: 0144  maxAlignment:    0145  adjustsStack:    false146  hasCalls:        false147  maxCallFrameSize: 0148  hasOpaqueSPAdjustment: false149  hasVAStart:      false150  hasMustTailInVarArgFunc: false151fixedStack:      152  - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16 }153body:             |154  bb.0.entry:155    liveins: $edi, $rbp156  157    frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp158    CFI_INSTRUCTION def_cfa_offset 16159    CFI_INSTRUCTION offset $rbp, -16160    $rbp = frame-setup MOV64rr $rsp161    CFI_INSTRUCTION def_cfa_register $rbp162    DBG_VALUE $edi, _, !12, !13, debug-location !14163    $rbp = POP64r implicit-def $rsp, implicit $rsp, debug-location !15164    TAILJMPd64 @sink, csr_64, implicit $rsp, implicit $rsp, implicit $edi, debug-location !15165 166...167---168name:            foo169alignment:       16170exposesReturnsTwice: false171legalized:       false172regBankSelected: false173selected:        false174tracksRegLiveness: true175liveins:         176  - { reg: '$edi' }177calleeSavedRegisters: [ '$bh', '$bl', '$bp', '$bpl', '$bx', '$ebp', '$ebx', 178                        '$rbp', '$rbx', '$r12', '$r13', '$r14', '$r15', 179                        '$r12b', '$r13b', '$r14b', '$r15b', '$r12d', '$r13d', 180                        '$r14d', '$r15d', '$r12w', '$r13w', '$r14w', '$r15w' ]181frameInfo:       182  isFrameAddressTaken: false183  isReturnAddressTaken: false184  hasStackMap:     false185  hasPatchPoint:   false186  stackSize:       24187  offsetAdjustment: -8188  maxAlignment:    0189  adjustsStack:    true190  hasCalls:        true191  maxCallFrameSize: 0192  hasOpaqueSPAdjustment: false193  hasVAStart:      false194  hasMustTailInVarArgFunc: false195fixedStack:      196  - { id: 0, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$rbx' }197  - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 16 }198body:             |199  bb.0.entry:200    successors: %bb.2.if.end, %bb.1.if.then201    liveins: $edi, $rbx, $rbp202  203    frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp204    CFI_INSTRUCTION def_cfa_offset 16205    CFI_INSTRUCTION offset $rbp, -16206    $rbp = frame-setup MOV64rr $rsp207    CFI_INSTRUCTION def_cfa_register $rbp208    frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp209    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp210    CFI_INSTRUCTION offset $rbx, -24211    DBG_VALUE $edi, _, !19, !13, debug-location !20212    $ebx = MOV32rr $edi213    DBG_VALUE $ebx, _, !12, !13, debug-location !21214    DBG_VALUE $ebx, _, !19, !13, debug-location !20215    CALL64pcrel32 @sink, csr_64, implicit $rsp, implicit $edi, implicit-def $rsp, debug-location !23216    TEST32rr $ebx, $ebx, implicit-def $eflags, debug-location !24217    JCC_1 %bb.2.if.end, 4, implicit $eflags218  219  bb.1.if.then:220    successors: %bb.2.if.end221    liveins: $ebx, $rbp222  223    DBG_VALUE $ebx, _, !19, !13, debug-location !20224    DBG_VALUE $ebx, _, !12, !13, debug-location !27225    $edi = MOV32rr $ebx, debug-location !29226    CALL64pcrel32 @sink, csr_64, implicit $rsp, implicit $edi, implicit-def $rsp, debug-location !29227  228  bb.2.if.end:229    liveins: $ebx, $rbp230  231    DBG_VALUE $ebx, _, !19, !13, debug-location !20232    $edi = MOV32rr killed $ebx, debug-location !33233    $rsp = ADD64ri8 $rsp, 8, implicit-def dead $eflags, debug-location !33234    DBG_VALUE $ebx, _, !12, !13, debug-location !31235    $rbx = POP64r implicit-def $rsp, implicit $rsp, debug-location !33236    $rbp = POP64r implicit-def $rsp, implicit $rsp, debug-location !33237    TAILJMPd64 @sink, csr_64, implicit $rsp, implicit $rsp, implicit $edi, debug-location !33238 239...240