brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · 084bfdf Raw
73 lines · plain
1; RUN: llvm-link %s %S/Inputs/replaced-function-matches-first-subprogram.ll -S | FileCheck %s2 3; Generated from C++ source:4;5; // repro/t.h6; template <class T> struct Class {7;   int foo() { return 0; }8; };9; // repro/d1/t1.cpp10; #include "t.h"11; int foo() { return Class<int>().foo(); }12; // repro/d2/t2.cpp13; #include "t.h"14; template struct Class<int>;15 16%struct.Class = type { i8 }17 18; CHECK: define i32 @_Z3foov(){{.*}} !dbg ![[SP1:[0-9]+]]19define i32 @_Z3foov() !dbg !4 {20entry:21  %tmp = alloca %struct.Class, align 122  %call = call i32 @_ZN5ClassIiE3fooEv(ptr %tmp), !dbg !1423  ret i32 %call, !dbg !1424}25 26; CHECK: define weak_odr i32 @_ZN5ClassIiE3fooEv(ptr %this){{.*}} !dbg ![[SP2:[0-9]+]] {27; CHECK-NOT: }28; CHECK: !dbg ![[LOC:[0-9]+]]29define linkonce_odr i32 @_ZN5ClassIiE3fooEv(ptr %this) align 2 !dbg !7 {30entry:31  %this.addr = alloca ptr, align 832  store ptr %this, ptr %this.addr, align 833  %this1 = load ptr, ptr %this.addr34  ret i32 0, !dbg !1535}36 37; CHECK: !llvm.dbg.cu = !{![[CU1:[0-9]+]], ![[CU2:[0-9]+]]}38!llvm.dbg.cu = !{!0}39!llvm.module.flags = !{!10, !11, !12}40!llvm.ident = !{!13}41 42; Extract out the list of subprograms from each compile unit.43; CHECK: ![[CU1:[0-9]+]] = distinct !DICompileUnit(44; CHECK: ![[CU2:[0-9]+]] = distinct !DICompileUnit(45!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 (trunk 224193) (llvm/trunk 224197)", isOptimized: false, emissionKind: LineTablesOnly, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)46!1 = !DIFile(filename: "t1.cpp", directory: "/Users/dexonsmith/data/llvm/staging/test/Linker/repro/d1")47!2 = !{}48!4 = distinct !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 2, file: !1, scope: !5, type: !6, retainedNodes: !2)49!5 = !DIFile(filename: "t1.cpp", directory: "/Users/dexonsmith/data/llvm/staging/test/Linker/repro/d1")50!6 = !DISubroutineType(types: !2)51 52; Extract out the file from the replaced subprogram.53; CHECK-DAG: ![[SP2:.*]] = distinct !DISubprogram({{.*}} file: ![[FILE:[0-9]+]],{{.*}}, unit: ![[CU2]]54 55; We can't use CHECK-NOT/CHECK-SAME with a CHECK-DAG, so rely on field order to56; prove that there's no function: here.57; CHECK-DAG: ![[SP2r:.*]] = {{.*}}!DISubprogram({{.*}} unit: ![[CU1]], retainedNodes:58!7 = distinct !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 2, file: !8, scope: !9, type: !6, retainedNodes: !2)59 60; The new subprogram should be pointing at the new directory.61; CHECK-DAG: ![[FILE]] = !DIFile(filename: "../t.h", directory: "/Users/dexonsmith/data/llvm/staging/test/Linker/repro/d2")62!8 = !DIFile(filename: "../t.h", directory: "/Users/dexonsmith/data/llvm/staging/test/Linker/repro/d1")63!9 = !DIFile(filename: "../t.h", directory: "/Users/dexonsmith/data/llvm/staging/test/Linker/repro/d1")64!10 = !{i32 2, !"Dwarf Version", i32 2}65!11 = !{i32 2, !"Debug Info Version", i32 3}66!12 = !{i32 1, !"PIC Level", i32 2}67!13 = !{!"clang version 3.6.0 (trunk 224193) (llvm/trunk 224197)"}68!14 = !DILocation(line: 2, column: 20, scope: !4)69 70; The same subprogram should be pointed to by inside the !dbg reference.71; CHECK: ![[LOC]] = !DILocation(line: 2, column: 15, scope: ![[SP2]])72!15 = !DILocation(line: 2, column: 15, scope: !7)73