brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.8 KiB · c2a2b9e Raw
184 lines · plain
1# RUN: llc -run-pass=livedebugvalues -o - %s | FileCheck %s2# RUN: llc -force-instr-ref-livedebugvalues=1 -run-pass=livedebugvalues -o - %s | FileCheck %s3#4# The test case was artificially adjusted, in order to make proper diamond basic5# block structure relevant to the debug entry values propagation.6#7# CHECK: ![[ARG_B:.*]] = !DILocalVariable(name: "b"8# CHECK: ![[ARG_C:.*]] = !DILocalVariable(name: "c"9# CHECK: ![[ARG_Q:.*]] = !DILocalVariable(name: "q"10# CHECK: bb.0.entry11# CHECK: DBG_VALUE $esi, $noreg, ![[ARG_B]], !DIExpression()12# CHECK: bb.1.if.then13# CHECK: DBG_VALUE $esi, $noreg, ![[ARG_B]], !DIExpression()14# CHECK: $ebx = MOV32rr $esi15# CHECK-NEXT: DBG_VALUE $ebx, $noreg, ![[ARG_B]], !DIExpression()16# CHECK-NEXT: $esi = MOV32ri 517# CHECK-NEXT: $ebx = MOV32ri 118# CHECK-NEXT: DBG_VALUE $esi, $noreg, ![[ARG_B]], !DIExpression(DW_OP_LLVM_entry_value, 1)19# CHECK: bb.2.if.else20# CHECK: DBG_VALUE $esi, $noreg, ![[ARG_B]], !DIExpression()21# CHECK: $ebx = MOV32rr $esi22# CHECK-NEXT: DBG_VALUE $ebx, $noreg, ![[ARG_B]], !DIExpression()23# CHECK-NEXT: $esi = MOV32ri 124# CHECK-NEXT: $ebx = MOV32ri 225# CHECK-NEXT: DBG_VALUE $esi, $noreg, ![[ARG_B]], !DIExpression(DW_OP_LLVM_entry_value, 1)26# CHECK: bb.3.if.end27# CHECK-DAG: DBG_VALUE $edx, $noreg, ![[ARG_Q]], !DIExpression()28# CHECK-DAG: DBG_VALUE $ebp, $noreg, ![[ARG_C]], !DIExpression()29# CHECK-DAG: DBG_VALUE $esi, $noreg, ![[ARG_B]], !DIExpression(DW_OP_LLVM_entry_value, 1)30--- |31  ; ModuleID = 'test.c'32  source_filename = "test.c"33  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"34  target triple = "x86_64-unknown-linux-gnu"35 36  ; Function Attrs: noinline nounwind uwtable37  define dso_local i32 @fn2(i32 %a, i32 %b, i32 %c) local_unnamed_addr !dbg !12 {38  entry:39    call void @llvm.dbg.value(metadata i32 %a, metadata !16, metadata !DIExpression()), !dbg !2040    call void @llvm.dbg.value(metadata i32 %b, metadata !17, metadata !DIExpression()), !dbg !2041    call void @llvm.dbg.value(metadata i32 %c, metadata !18, metadata !DIExpression()), !dbg !2042    %add = add nsw i32 %a, 2, !dbg !2143    call void @llvm.dbg.value(metadata i32 %add, metadata !19, metadata !DIExpression()), !dbg !2044    tail call void @fn1(i32 5, i32 6, i32 %add) #3, !dbg !2245    %cmp = icmp slt i32 %b, 17, !dbg !2346    br i1 %cmp, label %if.then, label %if.else, !dbg !2547 48  if.then:                                          ; preds = %entry49    %add1 = add nsw i32 %b, 7, !dbg !2650    call void @llvm.dbg.value(metadata i32 %add1, metadata !17, metadata !DIExpression()), !dbg !2051    tail call void @fn1(i32 5, i32 %add1, i32 %c) #3, !dbg !2852    br label %if.end, !dbg !2953 54  if.else:                                          ; preds = %entry55    %add2 = add nuw nsw i32 %b, 1, !dbg !3056    call void @llvm.dbg.value(metadata i32 %add2, metadata !17, metadata !DIExpression()), !dbg !2057    tail call void @fn1(i32 1, i32 %add2, i32 %c) #3, !dbg !3258    br label %if.end59 60  if.end:                                           ; preds = %if.else, %if.then61    %b.addr.0 = phi i32 [ %add1, %if.then ], [ %add2, %if.else ], !dbg !3362    call void @llvm.dbg.value(metadata i32 %b.addr.0, metadata !17, metadata !DIExpression()), !dbg !2063    ret i32 %b.addr.0, !dbg !3464  }65 66  declare !dbg !4 dso_local void @fn1(i32, i32, i32) local_unnamed_addr67 68  ; Function Attrs: nounwind readnone speculatable willreturn69  declare void @llvm.dbg.value(metadata, metadata, metadata)70 71  !llvm.dbg.cu = !{!0}72  !llvm.module.flags = !{!8, !9, !10}73  !llvm.ident = !{!11}74 75  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)76  !1 = !DIFile(filename: "test.c", directory: "/dir")77  !2 = !{}78  !3 = !{!4}79  !4 = !DISubprogram(name: "fn1", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)80  !5 = !DISubroutineType(types: !6)81  !6 = !{null, !7, !7, !7}82  !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)83  !8 = !{i32 2, !"Dwarf Version", i32 4}84  !9 = !{i32 2, !"Debug Info Version", i32 3}85  !10 = !{i32 1, !"wchar_size", i32 4}86  !11 = !{!"clang version 10.0.0"}87  !12 = distinct !DISubprogram(name: "fn2", scope: !1, file: !1, line: 5, type: !13, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)88  !13 = !DISubroutineType(types: !14)89  !14 = !{!7, !7, !7, !7}90  !15 = !{!16, !17, !18, !19}91  !16 = !DILocalVariable(name: "a", arg: 1, scope: !12, file: !1, line: 5, type: !7)92  !17 = !DILocalVariable(name: "b", arg: 2, scope: !12, file: !1, line: 5, type: !7)93  !18 = !DILocalVariable(name: "c", arg: 3, scope: !12, file: !1, line: 5, type: !7)94  !19 = !DILocalVariable(name: "q", scope: !12, file: !1, line: 7, type: !7)95  !20 = !DILocation(line: 0, scope: !12)96  !21 = !DILocation(line: 7, column: 15, scope: !12)97  !22 = !DILocation(line: 9, column: 5, scope: !12)98  !23 = !DILocation(line: 11, column: 11, scope: !24)99  !24 = distinct !DILexicalBlock(scope: !12, file: !1, line: 11, column: 9)100  !25 = !DILocation(line: 11, column: 9, scope: !12)101  !26 = !DILocation(line: 12, column: 13, scope: !27)102  !27 = distinct !DILexicalBlock(scope: !24, file: !1, line: 11, column: 17)103  !28 = !DILocation(line: 13, column: 8, scope: !27)104  !29 = !DILocation(line: 14, column: 5, scope: !27)105  !30 = !DILocation(line: 15, column: 13, scope: !31)106  !31 = distinct !DILexicalBlock(scope: !24, file: !1, line: 14, column: 12)107  !32 = !DILocation(line: 16, column: 7, scope: !31)108  !33 = !DILocation(line: 0, scope: !24)109  !34 = !DILocation(line: 19, column: 5, scope: !12)110 111...112---113name:            fn2114alignment:       16115fixedStack:116  - { id: 0, type: spill-slot, offset: -24, size: 8, alignment: 8, stack-id: default,117      callee-saved-register: '$rbx', callee-saved-restored: true, debug-info-variable: '',118      debug-info-expression: '', debug-info-location: '' }119  - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,120      callee-saved-register: '$rbp', callee-saved-restored: true, debug-info-variable: '',121      debug-info-expression: '', debug-info-location: '' }122body:             |123  bb.0.entry:124    successors: %bb.1(0x40000000), %bb.2(0x40000000)125    liveins: $edi, $edx, $esi, $rbp, $rbx126 127    DBG_VALUE $edi, $noreg, !16, !DIExpression(), debug-location !20128    DBG_VALUE $esi, $noreg, !17, !DIExpression(), debug-location !20129    DBG_VALUE $edx, $noreg, !18, !DIExpression(), debug-location !20130    frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp131    CFI_INSTRUCTION def_cfa_offset 16132    frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp133    CFI_INSTRUCTION def_cfa_offset 24134    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp135    CFI_INSTRUCTION def_cfa_offset 32136    CFI_INSTRUCTION offset $rbx, -24137    CFI_INSTRUCTION offset $rbp, -16138    $ebp = MOV32rr $edx139    DBG_VALUE $ebp, $noreg, !18, !DIExpression(), debug-location !20140    renamable $edi = KILL $edi, implicit-def $rdi141    DBG_VALUE $edi, $noreg, !16, !DIExpression(), debug-location !20142    renamable $edx = LEA64_32r killed renamable $rdi, 1, $noreg, 2, $noreg, debug-location !21143    DBG_VALUE $edx, $noreg, !19, !DIExpression(), debug-location !20144    $edi = MOV32ri 5, debug-location !22145    CMP32ri8 renamable $ebp, 16, implicit-def $eflags, debug-location !23146    JCC_1 %bb.2, 15, implicit killed $eflags, debug-location !25147 148  bb.1.if.then:149    successors: %bb.3(0x80000000)150    liveins: $ebp, $ebx, $esi151 152    $ebx = MOV32rr $esi153    DBG_VALUE $ebx, $noreg, !17, !DIExpression(), debug-location !20154    $esi = MOV32ri 5, debug-location !28155    $ebx = MOV32ri 1156    JMP_1 %bb.3157 158  bb.2.if.else:159    successors: %bb.3(0x80000000)160    liveins: $ebp, $ebx, $esi161 162    $ebx = MOV32rr $esi163    DBG_VALUE $ebx, $noreg, !17, !DIExpression(), debug-location !20164    $esi = MOV32ri 1, debug-location !32165    $ebx = MOV32ri 2166 167  bb.3.if.end:168    liveins: $ebx, $edi, $ebp169 170    $esi = MOV32rr $ebx, debug-location !33171    $edx = MOV32rr killed $ebp, debug-location !33172    CALL64pcrel32 @fn1, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi, implicit $edx, implicit-def $rsp, implicit-def $ssp, debug-location !33173    DBG_VALUE $ebx, $noreg, !17, !DIExpression(), debug-location !20174    $eax = MOV32rr killed $ebx, debug-location !34175    $rsp = frame-destroy ADD64ri8 $rsp, 8, implicit-def dead $eflags, debug-location !34176    CFI_INSTRUCTION def_cfa_offset 24, debug-location !34177    $rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !34178    CFI_INSTRUCTION def_cfa_offset 16, debug-location !34179    $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !34180    CFI_INSTRUCTION def_cfa_offset 8, debug-location !34181    RET64 killed $eax, debug-location !34182 183...184