reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
# RUN: llc -mtriple=armv4t-unknown-unknown -start-after=livedebugvalues -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s

# This reproducer is based on the following C code:
#
# struct S0 { int f1; int f2; int f3; };
#
# int a;
#
# void fn1(struct S0 p1) {
#   a = p1.f1 >= fn2(p1.f2);
# }
#
# and was generated using the following commands:
# $ clang -O1 -g --target=armv4t -S -emit-llvm
# $ llc -O1 -stop-after=livedebugvalues

--- |
  target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
  target triple = "armv4t-unknown-unknown"

  ; Function Attrs: nounwind
  define arm_aapcscc i32 @fn1([3 x i32] %p1.coerce) !dbg !7 {
  entry:
    %p1.coerce.fca.0.extract = extractvalue [3 x i32] %p1.coerce, 0
    call void @llvm.dbg.value(metadata i32 %p1.coerce.fca.0.extract, metadata !17, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !18
    %p1.coerce.fca.1.extract = extractvalue [3 x i32] %p1.coerce, 1
    call void @llvm.dbg.value(metadata i32 %p1.coerce.fca.1.extract, metadata !17, metadata !DIExpression(DW_OP_LLVM_fragment, 32, 32)), !dbg !18
    call void @llvm.dbg.value(metadata i32 undef, metadata !17, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 32)), !dbg !18
    %call = tail call arm_aapcscc i32 bitcast (i32 (...)* @fn2 to i32 (i32)*)(i32 %p1.coerce.fca.1.extract), !dbg !19
    %cmp = icmp sge i32 %p1.coerce.fca.0.extract, %call, !dbg !19
    %conv = zext i1 %cmp to i32, !dbg !19
    ret i32 %conv, !dbg !19
  }

  declare arm_aapcscc i32 @fn2(...)

  ; Function Attrs: nounwind readnone speculatable
  declare void @llvm.dbg.value(metadata, metadata, metadata) #0

  attributes #0 = { nounwind readnone speculatable }

  !llvm.dbg.cu = !{!0}
  !llvm.module.flags = !{!3, !4, !5}
  !llvm.ident = !{!6}

  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 9.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
  !1 = !DIFile(filename: "test.c", directory: "/")
  !2 = !{}
  !3 = !{i32 2, !"Dwarf Version", i32 4}
  !4 = !{i32 2, !"Debug Info Version", i32 3}
  !5 = !{i32 1, !"min_enum_size", i32 4}
  !6 = !{!"clang version 9.0.0"}
  !7 = distinct !DISubprogram(name: "fn1", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !16)
  !8 = !DISubroutineType(types: !9)
  !9 = !{!10, !11}
  !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  !11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S0", file: !1, line: 1, size: 96, elements: !12)
  !12 = !{!13, !14, !15}
  !13 = !DIDerivedType(tag: DW_TAG_member, name: "f1", scope: !11, file: !1, line: 1, baseType: !10, size: 32)
  !14 = !DIDerivedType(tag: DW_TAG_member, name: "f2", scope: !11, file: !1, line: 1, baseType: !10, size: 32, offset: 32)
  !15 = !DIDerivedType(tag: DW_TAG_member, name: "f3", scope: !11, file: !1, line: 1, baseType: !10, size: 32, offset: 64)
  !16 = !{!17}
  !17 = !DILocalVariable(name: "p1", arg: 1, scope: !7, file: !1, line: 3, type: !11)
  !18 = !DILocation(line: 3, scope: !7)
  !19 = !DILocation(line: 4, scope: !7)

...
---
name:            fn1
tracksRegLiveness: false
body:             |
  bb.0.entry:
    $sp = frame-setup STMDB_UPD $sp, 14, $noreg, killed $r4, killed $lr
    $r4 = MOVr $r0, 14, $noreg, $noreg
    DBG_VALUE $r1, $noreg, !17, !DIExpression(DW_OP_LLVM_fragment, 32, 32), debug-location !18
    DBG_VALUE $noreg, $noreg, !17, !DIExpression(DW_OP_LLVM_fragment, 64, 32), debug-location !18
    DBG_VALUE $r4, $noreg, !17, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !18
    $r0 = MOVr killed $r1, 14, $noreg, $noreg, debug-location !19
    BL @fn2, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit $r0, implicit-def $sp, implicit-def $r0, debug-location !19
    renamable $r1 = MOVi 0, 14, $noreg, $noreg
    CMPrr killed renamable $r4, killed renamable $r0, 14, $noreg, implicit-def $cpsr, debug-location !19
    $r1 = MOVi 1, 10, killed $cpsr, $noreg, implicit killed renamable $r1, debug-location !19
    $r0 = MOVr killed $r1, 14, $noreg, $noreg, debug-location !19
    $sp = LDMIA_UPD $sp, 14, $noreg, def $r4, def $lr, debug-location !19
    BX_RET 14, $noreg, implicit $r0, debug-location !19

...

# Verify that the addresses in the location list for the parameter are
# monotonically increasing, and that the undef debug value fragment does not
# terminate the non-overlapping fragment that is described by $r1.

# CHECK: DW_AT_location (0x00000000
# CHECK-NEXT: [0x00000008, 0x00000010): DW_OP_reg4 R4, DW_OP_piece 0x4, DW_OP_reg1 R1, DW_OP_piece 0x4
# CHECK-NEXT: [0x00000010, 0x00000024): DW_OP_reg4 R4, DW_OP_piece 0x4)
# CHECK-NEXT: DW_AT_name ("p1")