Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s | FileCheck %s
      2 ; RUN: llc < %s -filetype=obj | llvm-dwarfdump -v - --debug-info | FileCheck %s --check-prefix=DWARF
      3 
      4 ; This should use the frame index side table for allocas, not DBG_VALUE
      5 ; instructions. For SDAG ISel, this test would see an SDNode materializing the
      6 ; argument to escape_foo and we'd get DBG_VALUE MachineInstr.
      7 
      8 ; CHECK-LABEL: use_dbg_declare:
      9 ; CHECK-NOT: #DEBUG_VALUE
     10 
     11 ; DWARF: DW_TAG_variable
     12 ; DWARF-NEXT:              DW_AT_location [DW_FORM_exprloc]      (DW_OP_fbreg +0)
     13 ; DWARF-NEXT:              DW_AT_name [DW_FORM_strp]     ( {{.*}} = "o")
     14 
     15 
     16 ; ModuleID = 't.c'
     17 source_filename = "t.c"
     18 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
     19 target triple = "x86_64--linux"
     20 
     21 %struct.Foo = type { i32 }
     22 
     23 ; Function Attrs: noinline nounwind uwtable
     24 define void @use_dbg_declare() #0 !dbg !7 {
     25 entry:
     26   %o = alloca %struct.Foo, align 4
     27   call void @llvm.dbg.declare(metadata %struct.Foo* %o, metadata !10, metadata !15), !dbg !16
     28   call void @escape_foo(%struct.Foo* %o), !dbg !17
     29   ret void, !dbg !18
     30 }
     31 
     32 ; Function Attrs: nounwind readnone speculatable
     33 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
     34 
     35 declare void @escape_foo(%struct.Foo*)
     36 
     37 attributes #0 = { noinline nounwind uwtable }
     38 attributes #1 = { nounwind readnone speculatable }
     39 
     40 !llvm.dbg.cu = !{!0}
     41 !llvm.module.flags = !{!3, !4, !5}
     42 !llvm.ident = !{!6}
     43 
     44 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
     45 !1 = !DIFile(filename: "t.c", directory: "C:\5Csrc\5Cllvm-project\5Cbuild")
     46 !2 = !{}
     47 !3 = !{i32 2, !"Dwarf Version", i32 4}
     48 !4 = !{i32 2, !"Debug Info Version", i32 3}
     49 !5 = !{i32 1, !"wchar_size", i32 4}
     50 !6 = !{!"clang version 6.0.0 "}
     51 !7 = distinct !DISubprogram(name: "use_dbg_declare", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
     52 !8 = !DISubroutineType(types: !9)
     53 !9 = !{null}
     54 !10 = !DILocalVariable(name: "o", scope: !7, file: !1, line: 4, type: !11)
     55 !11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", file: !1, line: 1, size: 32, elements: !12)
     56 !12 = !{!13}
     57 !13 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !11, file: !1, line: 1, baseType: !14, size: 32)
     58 !14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
     59 !15 = !DIExpression()
     60 !16 = !DILocation(line: 4, column: 14, scope: !7)
     61 !17 = !DILocation(line: 5, column: 3, scope: !7)
     62 !18 = !DILocation(line: 6, column: 1, scope: !7)
     63