1 # RUN: llc -mtriple=armv4t-unknown-unknown -start-after=livedebugvalues -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
3 # This reproducer is based on the following C code:
5 # struct S0 { int f1; int f2; int f3; };
9 # void fn1(struct S0 p1) {
10 # a = p1.f1 >= fn2(p1.f2);
13 # and was generated using the following commands:
14 # $ clang -O1 -g --target=armv4t -S -emit-llvm
15 # $ llc -O1 -stop-after=livedebugvalues
18 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
19 target triple = "armv4t-unknown-unknown"
21 ; Function Attrs: nounwind
22 define arm_aapcscc i32 @fn1([3 x i32] %p1.coerce) !dbg !7 {
24 %p1.coerce.fca.0.extract = extractvalue [3 x i32] %p1.coerce, 0
25 call void @llvm.dbg.value(metadata i32 %p1.coerce.fca.0.extract, metadata !17, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), !dbg !18
26 %p1.coerce.fca.1.extract = extractvalue [3 x i32] %p1.coerce, 1
27 call void @llvm.dbg.value(metadata i32 %p1.coerce.fca.1.extract, metadata !17, metadata !DIExpression(DW_OP_LLVM_fragment, 32, 32)), !dbg !18
28 call void @llvm.dbg.value(metadata i32 undef, metadata !17, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 32)), !dbg !18
29 %call = tail call arm_aapcscc i32 bitcast (i32 (...)* @fn2 to i32 (i32)*)(i32 %p1.coerce.fca.1.extract), !dbg !19
30 %cmp = icmp sge i32 %p1.coerce.fca.0.extract, %call, !dbg !19
31 %conv = zext i1 %cmp to i32, !dbg !19
32 ret i32 %conv, !dbg !19
35 declare arm_aapcscc i32 @fn2(...)
37 ; Function Attrs: nounwind readnone speculatable
38 declare void @llvm.dbg.value(metadata, metadata, metadata) #0
40 attributes #0 = { nounwind readnone speculatable }
43 !llvm.module.flags = !{!3, !4, !5}
46 !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)
47 !1 = !DIFile(filename: "test.c", directory: "/")
49 !3 = !{i32 2, !"Dwarf Version", i32 4}
50 !4 = !{i32 2, !"Debug Info Version", i32 3}
51 !5 = !{i32 1, !"min_enum_size", i32 4}
52 !6 = !{!"clang version 9.0.0"}
53 !7 = distinct !DISubprogram(name: "fn1", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !16)
54 !8 = !DISubroutineType(types: !9)
56 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
57 !11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S0", file: !1, line: 1, size: 96, elements: !12)
58 !12 = !{!13, !14, !15}
59 !13 = !DIDerivedType(tag: DW_TAG_member, name: "f1", scope: !11, file: !1, line: 1, baseType: !10, size: 32)
60 !14 = !DIDerivedType(tag: DW_TAG_member, name: "f2", scope: !11, file: !1, line: 1, baseType: !10, size: 32, offset: 32)
61 !15 = !DIDerivedType(tag: DW_TAG_member, name: "f3", scope: !11, file: !1, line: 1, baseType: !10, size: 32, offset: 64)
63 !17 = !DILocalVariable(name: "p1", arg: 1, scope: !7, file: !1, line: 3, type: !11)
64 !18 = !DILocation(line: 3, scope: !7)
65 !19 = !DILocation(line: 4, scope: !7)
70 tracksRegLiveness: false
73 $sp = frame-setup STMDB_UPD $sp, 14, $noreg, killed $r4, killed $lr
74 $r4 = MOVr $r0, 14, $noreg, $noreg
75 DBG_VALUE $r1, $noreg, !17, !DIExpression(DW_OP_LLVM_fragment, 32, 32), debug-location !18
76 DBG_VALUE $noreg, $noreg, !17, !DIExpression(DW_OP_LLVM_fragment, 64, 32), debug-location !18
77 DBG_VALUE $r4, $noreg, !17, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !18
78 $r0 = MOVr killed $r1, 14, $noreg, $noreg, debug-location !19
79 BL @fn2, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit $r0, implicit-def $sp, implicit-def $r0, debug-location !19
80 renamable $r1 = MOVi 0, 14, $noreg, $noreg
81 CMPrr killed renamable $r4, killed renamable $r0, 14, $noreg, implicit-def $cpsr, debug-location !19
82 $r1 = MOVi 1, 10, killed $cpsr, $noreg, implicit killed renamable $r1, debug-location !19
83 $r0 = MOVr killed $r1, 14, $noreg, $noreg, debug-location !19
84 $sp = LDMIA_UPD $sp, 14, $noreg, def $r4, def $lr, debug-location !19
85 BX_RET 14, $noreg, implicit $r0, debug-location !19
89 # Verify that the addresses in the location list for the parameter are
90 # monotonically increasing, and that the undef debug value fragment does not
91 # terminate the non-overlapping fragment that is described by $r1.
93 # CHECK: DW_AT_location (0x00000000
94 # CHECK-NEXT: [0x00000008, 0x00000010): DW_OP_reg4 R4, DW_OP_piece 0x4, DW_OP_reg1 R1, DW_OP_piece 0x4
95 # CHECK-NEXT: [0x00000010, 0x00000024): DW_OP_reg4 R4, DW_OP_piece 0x4)
96 # CHECK-NEXT: DW_AT_name ("p1")