121 lines · plain
1; Test to make sure that lazily loaded debug location scope metadata is2; handled properly. Note that we need to have the DILexicalScope !343; referenced from multiple function's debug locs for this to be in the4; lazily loaded module level metadata block.5 6; RUN: opt -module-hash -module-summary %s -o %t1.bc7; RUN: opt -module-hash -module-summary %p/Inputs/pr35472.ll -o %t2.bc8; RUN: llvm-lto -thinlto-action=run %t1.bc %t2.bc -exported-symbol=_Z5Alphav9; RUN: llvm-nm %t1.bc.thinlto.o | FileCheck %s -check-prefix=ThinLTOa10; RUN: llvm-nm %t2.bc.thinlto.o | FileCheck %s -check-prefix=ThinLTOb11 12; ThinLTOa-DAG: T _Z5Bravov13; ThinLTOa-DAG: W _ZN4EchoD2Ev14; ThinLTOb-DAG: T _Z5Alphav15 16target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"17target triple = "x86_64-unknown-linux-gnu"18 19%struct.Delta = type { %struct.Charlie }20%struct.Charlie = type { i32 }21%struct.Echo = type { %struct.Charlie }22 23$_ZN4EchoD2Ev = comdat any24$_ZN5DeltaD2Ev = comdat any25 26define void @_Z5Bravov() !dbg !7 {27 %Hotel = alloca %struct.Delta, align 428 %India = alloca %struct.Echo, align 429 call void @llvm.dbg.declare(metadata ptr %Hotel, metadata !10, metadata !DIExpression()), !dbg !2230 call void @_ZN4EchoD2Ev(ptr %India), !dbg !2831 ret void, !dbg !2832}33 34declare void @llvm.dbg.declare(metadata, metadata, metadata)35 36define linkonce_odr void @_ZN4EchoD2Ev(ptr %this) unnamed_addr comdat align 2 {37 %this.addr.i = alloca ptr, align 838 call void @llvm.dbg.declare(metadata ptr %this.addr.i, metadata !29, metadata !DIExpression()), !dbg !3239 %this1.i = load ptr, ptr %this.addr.i, align 840 ret void41}42 43define linkonce_odr void @_ZN5DeltaD2Ev(ptr %this) unnamed_addr comdat align 2 !dbg !36 {44 %this.addr.i = alloca ptr, align 845 call void @llvm.dbg.declare(metadata ptr %this.addr.i, metadata !29, metadata !DIExpression()), !dbg !4146 %this1.i = load ptr, ptr %this.addr.i, align 847 ret void48}49 50!llvm.module.flags = !{!3, !4, !5}51 52!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 6.0.0 (trunk 321056)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)53!1 = !DIFile(filename: "a.cpp", directory: "/home/sunil/185335/302")54!2 = !{}55!3 = !{i32 2, !"Dwarf Version", i32 4}56!4 = !{i32 2, !"Debug Info Version", i32 3}57!5 = !{i32 1, !"wchar_size", i32 4}58!7 = distinct !DISubprogram(name: "Bravo", linkageName: "_Z5Bravov", scope: !1, file: !1, line: 17, type: !8, isLocal: false, isDefinition: true, scopeLine: 17, flags: DIFlagPrototyped, isOptimized: false, unit: !0)59!8 = !DISubroutineType(types: !9)60!9 = !{null}61!10 = !DILocalVariable(name: "Hotel", scope: !7, file: !1, line: 18, type: !11)62!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Delta", file: !1, line: 6, size: 32, elements: !12, identifier: "_ZTS5Delta")63!12 = !{!13}64!13 = !DIDerivedType(tag: DW_TAG_member, name: "Foxtrot", scope: !11, file: !1, line: 7, baseType: !14, size: 32)65!14 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Charlie", file: !1, line: 1, size: 32, elements: !15, identifier: "_ZTS7Charlie")66!15 = !{!16, !18}67!16 = !DIDerivedType(tag: DW_TAG_member, name: "Golf", scope: !14, file: !1, line: 3, baseType: !17, size: 32)68!17 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)69!18 = !DISubprogram(name: "~Charlie", scope: !14, file: !1, line: 2, type: !19, isLocal: false, isDefinition: false, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false)70!19 = !DISubroutineType(types: !20)71!20 = !{null, !21}72!21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !14, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)73!22 = !DILocation(line: 18, column: 11, scope: !7)74!24 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Echo", file: !1, line: 10, size: 32, elements: !25, identifier: "_ZTS4Echo")75!25 = !{!26}76!26 = !DIDerivedType(tag: DW_TAG_member, name: "Foxtrot", scope: !24, file: !1, line: 11, baseType: !14, size: 32)77!28 = !DILocation(line: 20, column: 1, scope: !7)78!29 = !DILocalVariable(name: "this", arg: 1, scope: !30, type: !31, flags: DIFlagArtificial | DIFlagObjectPointer)79!30 = distinct !DISubprogram(name: "~Charlie", linkageName: "_ZN7CharlieD2Ev", scope: !14, file: !1, line: 2, type: !19, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, declaration: !18)80!31 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !14, size: 64)81!32 = !DILocation(line: 0, scope: !30)82!33 = !DILocation(line: 2, column: 53, scope: !34)83!34 = distinct !DILexicalBlock(scope: !30, file: !1, line: 2, column: 51)84!36 = distinct !DISubprogram(name: "~Delta", linkageName: "_ZN5DeltaD2Ev", scope: !11, file: !1, line: 6, type: !37, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, unit: !0, declaration: !40)85!37 = !DISubroutineType(types: !38)86!38 = !{null, !39}87!39 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)88!40 = !DISubprogram(name: "~Delta", scope: !11, type: !37, isLocal: false, isDefinition: false, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false)89!41 = !DILocation(line: 0, scope: !30, inlinedAt: !42)90!42 = distinct !DILocation(line: 6, column: 8, scope: !43)91!43 = distinct !DILexicalBlock(scope: !36, file: !1, line: 6, column: 8)92!48 = !DILocation(line: 2, column: 53, scope: !34, inlinedAt: !42)93 94;----------------------------------------------------------------------------------------------95; Compiled from following two source files with 'clang++ -S --std=c++11 -O0 -g -flto=thin' 96; struct Charlie {97; __attribute__((__always_inline__)) ~Charlie() { Golf = 0; }98; int Golf;99; };100; 101; struct Delta {102; Charlie Foxtrot;103; };104; 105; struct Echo {106; Charlie Foxtrot;107; __attribute__((nodebug)) ~Echo() = default;108; };109; 110; extern void Bravo();111; 112; void Bravo() {113; Delta Hotel;114; Echo India;115; }116; -----------------------------117; extern void Bravo();118; extern void Alpha();119; void Alpha() { Bravo(); }120 121