brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.0 KiB · 3922d46 Raw
140 lines · plain
1; FIXME: Missing DwarfAccelNamesSection on AIX2; XFAIL: target={{.*}}-aix{{.*}}3; RUN: %llc_dwarf -O0 -filetype=obj -dwarf-linkage-names=All < %s | llvm-dwarfdump -v -debug-info - | FileCheck -implicit-check-not=DW_TAG %s4; RUN: %llc_dwarf -accel-tables=Apple -dwarf-linkage-names=All -O0 -filetype=obj < %s | llvm-dwarfdump -v - | FileCheck --check-prefix=CHECK-ACCEL --check-prefix=CHECK %s5 6; Build from source:7; $ clang++ a.cpp b.cpp -g -c -emit-llvm8; $ llvm-link a.bc b.bc -o ab.bc9; $ opt -inline ab.bc -o ab-opt.bc10; $ cat a.cpp11; extern int i;12; int func(int);13; int main() {14;   return func(i);15; }16; $ cat b.cpp17; int __attribute__((always_inline)) func(int x) {18;   return x * 2;19; }20 21; Ensure that func inlined into main is described and references the abstract22; definition in b.cpp's CU.23 24; CHECK: DW_TAG_compile_unit25; CHECK:   DW_AT_name {{.*}}"a.cpp"26; CHECK:   DW_TAG_subprogram27; CHECK:     DW_AT_type [DW_FORM_ref_addr] (0x00000000[[INT:[a-f0-9]+]]28; CHECK:     0x[[INLINED:[0-9a-f]*]]:{{.*}}DW_TAG_inlined_subroutine29; CHECK:       DW_AT_abstract_origin {{.*}}[[ABS_FUNC:........]] "_Z4funci"30; CHECK:       DW_TAG_formal_parameter31; CHECK:         DW_AT_abstract_origin {{.*}}[[ABS_VAR:........]] "x"32 33; Check the abstract definition is in the 'b.cpp' CU and doesn't contain any34; concrete information (address range or variable location)35; CHECK: DW_TAG_compile_unit36; CHECK:   DW_AT_name {{.*}}"b.cpp"37; CHECK: 0x[[ABS_FUNC]]: DW_TAG_subprogram38; CHECK-NOT: DW_AT_low_pc39; CHECK: 0x[[ABS_VAR]]: DW_TAG_formal_parameter40; CHECK-NOT: DW_AT_location41; CHECK: DW_AT_type [DW_FORM_ref4] {{.*}} {0x[[INT]]}42; CHECK-NOT: DW_AT_location43 44; CHECK: 0x[[INT]]: DW_TAG_base_type45; CHECK:   DW_AT_name {{.*}}"int"46 47; Check the concrete out of line definition references the abstract and48; provides the address range and variable location49; CHECK: 0x[[FUNC:[0-9a-f]*]]{{.*}}DW_TAG_subprogram50; CHECK:   DW_AT_low_pc51; CHECK:   DW_AT_abstract_origin {{.*}} {0x[[ABS_FUNC]]} "_Z4funci"52; CHECK:   DW_TAG_formal_parameter53; CHECK:     DW_AT_location54; CHECK:     DW_AT_abstract_origin {{.*}} {0x[[ABS_VAR]]} "x"55 56; Check that both the inline and the non out of line version of func are57; correctly referenced in the accelerator table. Before r221837, the one58; in the second compilation unit had a wrong offset59; CHECK-ACCEL: .apple_names contents:60; CHECK-ACCEL: String{{.*}}"func"61; CHECK-ACCEL-NOT: String62; CHECK-ACCEL: Atom[0]{{.*}}[[INLINED]]63; CHECK-ACCEL-NOT: String64; CHECK-ACCEL: Atom[0]{{.*}}[[FUNC]]65 66@i = external global i3267 68; Function Attrs: uwtable69define i32 @main() #0 !dbg !4 {70entry:71  %x.addr.i = alloca i32, align 472  %retval = alloca i32, align 473  store i32 0, ptr %retval74  %0 = load i32, ptr @i, align 4, !dbg !1975  call void @llvm.lifetime.start(i64 4, ptr %x.addr.i)76  store i32 %0, ptr %x.addr.i, align 477  call void @llvm.dbg.declare(metadata ptr %x.addr.i, metadata !120, metadata !DIExpression()), !dbg !2178  %1 = load i32, ptr %x.addr.i, align 4, !dbg !2279  %mul.i = mul nsw i32 %1, 2, !dbg !2280  call void @llvm.lifetime.end(i64 4, ptr %x.addr.i), !dbg !2281  ret i32 %mul.i, !dbg !1982}83 84; Function Attrs: alwaysinline nounwind uwtable85define i32 @_Z4funci(i32 %x) #1 !dbg !12 {86entry:87  %x.addr = alloca i32, align 488  store i32 %x, ptr %x.addr, align 489  call void @llvm.dbg.declare(metadata ptr %x.addr, metadata !20, metadata !DIExpression()), !dbg !2390  %0 = load i32, ptr %x.addr, align 4, !dbg !2491  %mul = mul nsw i32 %0, 2, !dbg !2492  ret i32 %mul, !dbg !2493}94 95; Function Attrs: nounwind readnone96declare void @llvm.dbg.declare(metadata, metadata, metadata) #297 98; Function Attrs: nounwind99declare void @llvm.lifetime.start(i64, ptr nocapture) #3100 101; Function Attrs: nounwind102declare void @llvm.lifetime.end(i64, ptr nocapture) #3103 104attributes #0 = { uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" }105attributes #1 = { alwaysinline nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" }106attributes #2 = { nounwind readnone }107attributes #3 = { nounwind }108 109!llvm.dbg.cu = !{!0, !9}110!llvm.module.flags = !{!16, !17}111!llvm.ident = !{!18, !18}112 113!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)114!1 = !DIFile(filename: "a.cpp", directory: "/tmp/dbginfo")115!2 = !{}116!4 = distinct !DISubprogram(name: "main", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !1, scope: !5, type: !6, retainedNodes: !2)117!5 = !DIFile(filename: "a.cpp", directory: "/tmp/dbginfo")118!6 = !DISubroutineType(types: !7)119!7 = !{!8}120!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)121!9 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !10, enums: !2, retainedTypes: !2, globals: !2, imports: !2)122!10 = !DIFile(filename: "b.cpp", directory: "/tmp/dbginfo")123!12 = distinct !DISubprogram(name: "func", linkageName: "_Z4funci", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !9, scopeLine: 1, file: !10, scope: !13, type: !14, retainedNodes: !2)124!13 = !DIFile(filename: "b.cpp", directory: "/tmp/dbginfo")125!14 = !DISubroutineType(types: !15)126!15 = !{!8, !8}127!16 = !{i32 2, !"Dwarf Version", i32 4}128!17 = !{i32 2, !"Debug Info Version", i32 3}129!18 = !{!"clang version 3.5.0 "}130!19 = !DILocation(line: 4, scope: !4)131!20 = !DILocalVariable(name: "x", line: 1, arg: 1, scope: !12, file: !13, type: !8)132 133!120 = !DILocalVariable(name: "x", line: 1, arg: 1, scope: !12, file: !13, type: !8)134 135!21 = !DILocation(line: 1, scope: !12, inlinedAt: !19)136!22 = !DILocation(line: 2, scope: !12, inlinedAt: !19)137!23 = !DILocation(line: 1, scope: !12)138!24 = !DILocation(line: 2, scope: !12)139 140