brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.1 KiB · 5254fad Raw
121 lines · plain
1;2; RUN: llc -mtriple=x86_64-unknown-linux-gnu -O0 -filetype=obj %s -o - | llvm-dwarfdump -v -debug-info - | FileCheck %s3 4; Test case derived from compiling the following source with clang -g:5;6; namespace pr14763 {7; struct foo {8;   foo(const foo&);9; };10;11; foo func(foo f) {12;   return f; // reference 'f' for now because otherwise we hit another bug13; }14;15; void sink(ptr);16;17; void func2(bool b, foo g) {18;   if (b)19;     sink(&g); // reference 'f' for now because otherwise we hit another bug20; }21; }22 23; CHECK: debug_info contents24; The parameter is accessed indirectly (with a zero offset) from the second25; register parameter. RDI is consumed by 'sret'.26; CHECK: DW_TAG_subprogram27; CHECK: DW_AT_name{{.*}} = "func"28; CHECK: DW_TAG_formal_parameter29; CHECK: DW_AT_location {{.*}}30; CHECK-NEXT: DW_OP_breg4 RSI+0, DW_OP_deref31; CHECK-NOT: DW_TAG32; CHECK: DW_AT_name{{.*}} = "f"33 34; CHECK: DW_TAG_subprogram35; CHECK: DW_AT_name{{.*}} = "func2"36; CHECK: DW_TAG_formal_parameter37; CHECK: DW_AT_location{{.*}}(DW_OP_fbreg +23)38; CHECK: DW_TAG_formal_parameter39; CHECK: DW_AT_location{{.*}}(40; CHECK-NEXT: {{.*}}: DW_OP_breg7 RSP+8, DW_OP_deref, DW_OP_deref41; CHECK-NEXT: {{.*}}: DW_OP_breg4 RSI+0, DW_OP_deref42; CHECK-NEXT: {{.*}}: DW_OP_breg7 RSP+8, DW_OP_deref, DW_OP_deref)43; CHECK-NOT: DW_TAG44; CHECK: DW_AT_name{{.*}} = "g"45 46%"struct.pr14763::foo" = type { i8 }47 48; Function Attrs: uwtable49define void @_ZN7pr147634funcENS_3fooE(ptr noalias sret(%"struct.pr14763::foo") %agg.result, ptr %f) #0 !dbg !4 {50entry:51  call void @llvm.dbg.declare(metadata ptr %f, metadata !22, metadata !DIExpression(DW_OP_deref)), !dbg !2452  call void @_ZN7pr147633fooC1ERKS0_(ptr %agg.result, ptr %f), !dbg !2553  ret void, !dbg !2554}55 56; Function Attrs: nounwind readnone57declare void @llvm.dbg.declare(metadata, metadata, metadata) #158 59declare void @_ZN7pr147633fooC1ERKS0_(ptr, ptr) #260 61; Function Attrs: uwtable62define void @_ZN7pr147635func2EbNS_3fooE(i1 zeroext %b, ptr %g) #0 !dbg !17 {63entry:64  %b.addr = alloca i8, align 165  %frombool = zext i1 %b to i866  store i8 %frombool, ptr %b.addr, align 167  call void @llvm.dbg.declare(metadata ptr %b.addr, metadata !26, metadata !DIExpression()), !dbg !2768  call void @llvm.dbg.declare(metadata ptr %g, metadata !28, metadata !DIExpression(DW_OP_deref)), !dbg !2769  %0 = load i8, ptr %b.addr, align 1, !dbg !2970  %tobool = trunc i8 %0 to i1, !dbg !2971  br i1 %tobool, label %if.then, label %if.end, !dbg !2972 73if.then:                                          ; preds = %entry74  call void @_ZN7pr147634sinkEPv(ptr %g), !dbg !3175  br label %if.end, !dbg !3176 77if.end:                                           ; preds = %if.then, %entry78  ret void, !dbg !3279}80 81declare void @_ZN7pr147634sinkEPv(ptr)82 83attributes #0 = { uwtable }84attributes #1 = { nounwind readnone }85 86!llvm.dbg.cu = !{!0}87!llvm.module.flags = !{!21, !33}88 89!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)90!1 = !DIFile(filename: "pass.cpp", directory: "/tmp")91!2 = !{}92!4 = distinct !DISubprogram(name: "func", linkageName: "_ZN7pr147634funcENS_3fooE", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !1, scope: !5, type: !6, retainedNodes: !2)93!5 = !DINamespace(name: "pr14763", scope: null)94!6 = !DISubroutineType(types: !7)95!7 = !{!8, !8}96!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 2, size: 8, align: 8, file: !1, scope: !5, elements: !9)97!9 = !{!10}98!10 = !DISubprogram(name: "foo", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !8, type: !11)99!11 = !DISubroutineType(types: !12)100!12 = !{null, !13, !14}101!13 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8)102!14 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !15)103!15 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !8)104!17 = distinct !DISubprogram(name: "func2", linkageName: "_ZN7pr147635func2EbNS_3fooE", line: 12, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 12, file: !1, scope: !5, type: !18, retainedNodes: !2)105!18 = !DISubroutineType(types: !19)106!19 = !{null, !20, !8}107!20 = !DIBasicType(tag: DW_TAG_base_type, name: "bool", size: 8, align: 8, encoding: DW_ATE_boolean)108!21 = !{i32 2, !"Dwarf Version", i32 3}109!22 = !DILocalVariable(name: "f", line: 6, arg: 1, scope: !4, file: !23, type: !8)110!23 = !DIFile(filename: "pass.cpp", directory: "/tmp")111!24 = !DILocation(line: 6, scope: !4)112!25 = !DILocation(line: 7, scope: !4)113!26 = !DILocalVariable(name: "b", line: 12, arg: 1, scope: !17, file: !23, type: !20)114!27 = !DILocation(line: 12, scope: !17)115!28 = !DILocalVariable(name: "g", line: 12, arg: 2, scope: !17, file: !23, type: !8)116!29 = !DILocation(line: 13, scope: !30)117!30 = distinct !DILexicalBlock(line: 13, column: 0, file: !1, scope: !17)118!31 = !DILocation(line: 14, scope: !30)119!32 = !DILocation(line: 15, scope: !17)120!33 = !{i32 1, !"Debug Info Version", i32 3}121