diff options
Diffstat (limited to 'test/Linker')
106 files changed, 1119 insertions, 493 deletions
diff --git a/test/Linker/2003-01-30-LinkerRename.ll b/test/Linker/2003-01-30-LinkerRename.ll index 1e25d3eef0c6..1844e936baf2 100644 --- a/test/Linker/2003-01-30-LinkerRename.ll +++ b/test/Linker/2003-01-30-LinkerRename.ll @@ -2,9 +2,9 @@ ; RUN: llvm-as %s -o %t.2.bc ; RUN: llvm-link %t.1.bc %t.2.bc -S | FileCheck %s -; CHECK: @bar = global i32 ()* @foo2 +; CHECK: @bar = global i32 ()* @foo.2 -; CHECK: define internal i32 @foo2() { +; CHECK: define internal i32 @foo.2() { ; CHECK-NEXT: ret i32 7 ; CHECK-NEXT: } diff --git a/test/Linker/2003-04-23-LinkOnceLost.ll b/test/Linker/2003-04-23-LinkOnceLost.ll index e4528906e024..e2b600c877c0 100644 --- a/test/Linker/2003-04-23-LinkOnceLost.ll +++ b/test/Linker/2003-04-23-LinkOnceLost.ll @@ -1,11 +1,10 @@ -; This fails because the linker renames the non-opaque type not the opaque -; one... - -; RUN: echo " define linkonce void @foo() { ret void } " | \ -; RUN: llvm-as -o %t.2.bc -; RUN: llvm-as %s -o %t.1.bc -; RUN: llvm-link %t.1.bc %t.2.bc -S | FileCheck %s +; RUN: echo " define linkonce void @foo() { ret void } " > %t.ll +; RUN: llvm-link %s %t.ll -S | FileCheck %s ; CHECK: linkonce{{.*}}foo declare void @foo() +define void @use_foo() { + call void @foo() + ret void +} diff --git a/test/Linker/2003-05-31-LinkerRename.ll b/test/Linker/2003-05-31-LinkerRename.ll index 0261fe3a9208..f511be1bf22f 100644 --- a/test/Linker/2003-05-31-LinkerRename.ll +++ b/test/Linker/2003-05-31-LinkerRename.ll @@ -1,20 +1,18 @@ -; RUN: llvm-as %S/Inputs/2003-05-31-LinkerRename.ll -o %t.1.bc -; RUN: llvm-as %s -o %t.2.bc -; RUN: llvm-link %t.1.bc %t.2.bc -S | FileCheck %s +; RUN: llvm-link %S/Inputs/2003-05-31-LinkerRename.ll %s -S | FileCheck %s -; CHECK: @bar = global i32 ()* @foo2 +; CHECK: @bar = global i32 ()* @foo.2 -; CHECK: define internal i32 @foo2() { +; CHECK: define internal i32 @foo.2() { ; CHECK-NEXT: ret i32 7 ; CHECK-NEXT: } -; CHECK: declare i32 @foo() - ; CHECK: define i32 @test() { ; CHECK-NEXT: %X = call i32 @foo() ; CHECK-NEXT: ret i32 %X ; CHECK-NEXT: } +; CHECK: declare i32 @foo() + declare i32 @foo() define i32 @test() { diff --git a/test/Linker/2008-03-05-AliasReference.ll b/test/Linker/2008-03-05-AliasReference.ll index 078479424b02..1423049c8172 100644 --- a/test/Linker/2008-03-05-AliasReference.ll +++ b/test/Linker/2008-03-05-AliasReference.ll @@ -8,7 +8,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 target triple = "x86_64-unknown-linux-gnu" @foo = weak global i32 0 ; <i32*> [#uses=1] -@bar = weak alias i32* @foo ; <i32*> [#uses=1] +@bar = weak alias i32, i32* @foo ; <i32*> [#uses=1] define i32 @baz() nounwind { entry: diff --git a/test/Linker/2008-07-06-AliasFnDecl.ll b/test/Linker/2008-07-06-AliasFnDecl.ll index 8e8c8454d941..555899a31acb 100644 --- a/test/Linker/2008-07-06-AliasFnDecl.ll +++ b/test/Linker/2008-07-06-AliasFnDecl.ll @@ -3,7 +3,7 @@ ; RUN: llvm-as %p/2008-07-06-AliasFnDecl2.ll -o %t2.bc ; RUN: llvm-link %t1.bc %t2.bc -o %t3.bc -@b = alias void ()* @a +@b = alias void (), void ()* @a define void @a() nounwind { entry: diff --git a/test/Linker/2008-07-06-AliasWeakDest.ll b/test/Linker/2008-07-06-AliasWeakDest.ll index e631175444c0..8db492363aa4 100644 --- a/test/Linker/2008-07-06-AliasWeakDest.ll +++ b/test/Linker/2008-07-06-AliasWeakDest.ll @@ -7,9 +7,9 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" target triple = "i386-pc-linux-gnu" -@sched_clock = alias i64 ()* @native_sched_clock +@sched_clock = alias i64 (), i64 ()* @native_sched_clock -@foo = alias i32* @realfoo +@foo = alias i32, i32* @realfoo @realfoo = global i32 0 define i64 @native_sched_clock() nounwind { diff --git a/test/Linker/2009-09-03-mdnode.ll b/test/Linker/2009-09-03-mdnode.ll index ec444d316b78..77c6b2d93faa 100644 --- a/test/Linker/2009-09-03-mdnode.ll +++ b/test/Linker/2009-09-03-mdnode.ll @@ -26,6 +26,6 @@ declare void @llvm.dbg.stoppoint(i32, i32, metadata) nounwind readnone declare void @llvm.dbg.region.end(metadata) nounwind readnone -!0 = !DISubprogram(name: "main", linkageName: "main", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scope: !1) -!1 = !DICompileUnit(language: DW_LANG_C99, producer: "ellcc 0.1.0", isOptimized: true, emissionKind: 0, file: !2) +!0 = distinct !DISubprogram(name: "main", linkageName: "main", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scope: !1) +!1 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "ellcc 0.1.0", isOptimized: true, emissionKind: 0, file: !2) !2 = !DIFile(filename: "a.c", directory: "/home/rich/ellcc/test/source") diff --git a/test/Linker/2009-09-03-mdnode2.ll b/test/Linker/2009-09-03-mdnode2.ll index d9d52680b7b0..69b8d6595eb3 100644 --- a/test/Linker/2009-09-03-mdnode2.ll +++ b/test/Linker/2009-09-03-mdnode2.ll @@ -21,6 +21,6 @@ declare void @llvm.dbg.stoppoint(i32, i32, metadata) nounwind readnone declare void @llvm.dbg.region.end(metadata) nounwind readnone -!0 = !DISubprogram(name: "f", linkageName: "f", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scope: !1) -!1 = !DICompileUnit(language: DW_LANG_C99, producer: "ellcc 0.1.0", isOptimized: true, emissionKind: 0, file: !2) +!0 = distinct !DISubprogram(name: "f", linkageName: "f", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scope: !1) +!1 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "ellcc 0.1.0", isOptimized: true, emissionKind: 0, file: !2) !2 = !DIFile(filename: "b.c", directory: "/home/rich/ellcc/test/source") diff --git a/test/Linker/2011-08-04-DebugLoc.ll b/test/Linker/2011-08-04-DebugLoc.ll index 710ddf7774ff..71e89a5072e5 100644 --- a/test/Linker/2011-08-04-DebugLoc.ll +++ b/test/Linker/2011-08-04-DebugLoc.ll @@ -9,7 +9,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target triple = "x86_64-apple-macosx10.7.0" -define i32 @foo() nounwind ssp { +define i32 @foo() nounwind ssp !dbg !1 { ret i32 42, !dbg !6 } @@ -17,8 +17,8 @@ define i32 @foo() nounwind ssp { !llvm.module.flags = !{!11} !llvm.dbg.sp = !{!1} -!0 = !DICompileUnit(language: DW_LANG_C99, producer: "Apple clang version 3.0 (tags/Apple/clang-209.11) (based on LLVM 3.0svn)", isOptimized: true, emissionKind: 0, file: !8, enums: !9, retainedTypes: !9, subprograms: !10) -!1 = !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !8, scope: !2, type: !3, function: i32 ()* @foo) +!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "Apple clang version 3.0 (tags/Apple/clang-209.11) (based on LLVM 3.0svn)", isOptimized: true, emissionKind: 0, file: !8, enums: !9, retainedTypes: !9, subprograms: !10) +!1 = distinct !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !8, scope: !2, type: !3) !2 = !DIFile(filename: "a.c", directory: "/private/tmp") !3 = !DISubroutineType(types: !4) !4 = !{!5} diff --git a/test/Linker/2011-08-04-DebugLoc2.ll b/test/Linker/2011-08-04-DebugLoc2.ll index bc524dae91de..c5f77ac69cda 100644 --- a/test/Linker/2011-08-04-DebugLoc2.ll +++ b/test/Linker/2011-08-04-DebugLoc2.ll @@ -6,7 +6,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target triple = "x86_64-apple-macosx10.7.0" -define i32 @bar() nounwind ssp { +define i32 @bar() nounwind ssp !dbg !1 { ret i32 21, !dbg !6 } @@ -14,8 +14,8 @@ define i32 @bar() nounwind ssp { !llvm.module.flags = !{!11} !llvm.dbg.sp = !{!1} -!0 = !DICompileUnit(language: DW_LANG_C99, producer: "Apple clang version 3.0 (tags/Apple/clang-209.11) (based on LLVM 3.0svn)", isOptimized: true, emissionKind: 0, file: !8, enums: !9, retainedTypes: !9, subprograms: !10) -!1 = !DISubprogram(name: "bar", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !8, scope: !2, type: !3, function: i32 ()* @bar) +!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "Apple clang version 3.0 (tags/Apple/clang-209.11) (based on LLVM 3.0svn)", isOptimized: true, emissionKind: 0, file: !8, enums: !9, retainedTypes: !9, subprograms: !10) +!1 = distinct !DISubprogram(name: "bar", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !8, scope: !2, type: !3) !2 = !DIFile(filename: "b.c", directory: "/private/tmp") !3 = !DISubroutineType(types: !4) !4 = !{!5} diff --git a/test/Linker/2011-08-04-Metadata.ll b/test/Linker/2011-08-04-Metadata.ll index fc1af754abd4..a685142ab715 100644 --- a/test/Linker/2011-08-04-Metadata.ll +++ b/test/Linker/2011-08-04-Metadata.ll @@ -13,7 +13,7 @@ target triple = "x86_64-apple-macosx10.7.0" @x = internal global i32 0, align 4 -define void @foo() nounwind uwtable ssp { +define void @foo() nounwind uwtable ssp !dbg !1 { entry: store i32 1, i32* @x, align 4, !dbg !7 ret void, !dbg !7 @@ -24,8 +24,8 @@ entry: !llvm.dbg.sp = !{!1} !llvm.dbg.gv = !{!5} -!0 = !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 ()", isOptimized: true, emissionKind: 0, file: !9, enums: !{}, retainedTypes: !{}, subprograms: !10) -!1 = !DISubprogram(name: "foo", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !9, scope: !2, type: !3, function: void ()* @foo) +!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 ()", isOptimized: true, emissionKind: 0, file: !9, enums: !{}, retainedTypes: !{}, subprograms: !10) +!1 = distinct !DISubprogram(name: "foo", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !9, scope: !2, type: !3) !2 = !DIFile(filename: "/tmp/one.c", directory: "/Volumes/Lalgate/Slate/D") !3 = !DISubroutineType(types: !4) !4 = !{null} diff --git a/test/Linker/2011-08-04-Metadata2.ll b/test/Linker/2011-08-04-Metadata2.ll index 5eb231b2e364..07baebff4f4e 100644 --- a/test/Linker/2011-08-04-Metadata2.ll +++ b/test/Linker/2011-08-04-Metadata2.ll @@ -8,7 +8,7 @@ target triple = "x86_64-apple-macosx10.7.0" @x = internal global i32 0, align 4 -define void @bar() nounwind uwtable ssp { +define void @bar() nounwind uwtable ssp !dbg !1 { entry: store i32 1, i32* @x, align 4, !dbg !7 ret void, !dbg !7 @@ -19,8 +19,8 @@ entry: !llvm.dbg.sp = !{!1} !llvm.dbg.gv = !{!5} -!0 = !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 ()", isOptimized: true, emissionKind: 0, file: !9, enums: !{}, retainedTypes: !{}, subprograms: !10) -!1 = !DISubprogram(name: "bar", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !9, scope: !2, type: !3, function: void ()* @bar) +!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 ()", isOptimized: true, emissionKind: 0, file: !9, enums: !{}, retainedTypes: !{}, subprograms: !10) +!1 = distinct !DISubprogram(name: "bar", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !9, scope: !2, type: !3) !2 = !DIFile(filename: "/tmp/two.c", directory: "/Volumes/Lalgate/Slate/D") !3 = !DISubroutineType(types: !4) !4 = !{null} diff --git a/test/Linker/2011-08-18-unique-class-type.ll b/test/Linker/2011-08-18-unique-class-type.ll index 1692a90bf7e6..e466bceb0cd3 100644 --- a/test/Linker/2011-08-18-unique-class-type.ll +++ b/test/Linker/2011-08-18-unique-class-type.ll @@ -8,7 +8,7 @@ target triple = "x86_64-apple-macosx10.7.0" %"class.N1::A" = type { i8 } -define void @_Z3fooN2N11AE() nounwind uwtable ssp { +define void @_Z3fooN2N11AE() nounwind uwtable ssp !dbg !5 { entry: %mya = alloca %"class.N1::A", align 1 call void @llvm.dbg.declare(metadata %"class.N1::A"* %mya, metadata !9, metadata !DIExpression()), !dbg !13 @@ -20,15 +20,15 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!18} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.0 (trunk 137954)", isOptimized: true, emissionKind: 0, file: !16, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.0 (trunk 137954)", isOptimized: true, emissionKind: 0, file: !16, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2) !1 = !{!2} !2 = !{} !3 = !{!5} -!5 = !DISubprogram(name: "foo", linkageName: "_Z3fooN2N11AE", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !16, scope: !6, type: !7, function: void ()* @_Z3fooN2N11AE) +!5 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooN2N11AE", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !16, scope: !6, type: !7) !6 = !DIFile(filename: "n1.c", directory: "/private/tmp") !7 = !DISubroutineType(types: !8) !8 = !{null} -!9 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "mya", line: 4, arg: 1, scope: !5, file: !6, type: !10) +!9 = !DILocalVariable(name: "mya", line: 4, arg: 1, scope: !5, file: !6, type: !10) !10 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 3, size: 8, align: 8, file: !17, scope: !11, elements: !2) !11 = !DINamespace(name: "N1", line: 2, file: !17, scope: null) !12 = !DIFile(filename: "./n.h", directory: "/private/tmp") diff --git a/test/Linker/2011-08-18-unique-class-type2.ll b/test/Linker/2011-08-18-unique-class-type2.ll index 1befb4deacc9..8821dd37fadf 100644 --- a/test/Linker/2011-08-18-unique-class-type2.ll +++ b/test/Linker/2011-08-18-unique-class-type2.ll @@ -6,7 +6,7 @@ target triple = "x86_64-apple-macosx10.7.0" %"class.N1::A" = type { i8 } -define void @_Z3barN2N11AE() nounwind uwtable ssp { +define void @_Z3barN2N11AE() nounwind uwtable ssp !dbg !5 { entry: %youra = alloca %"class.N1::A", align 1 call void @llvm.dbg.declare(metadata %"class.N1::A"* %youra, metadata !9, metadata !DIExpression()), !dbg !13 @@ -18,15 +18,15 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!18} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.0 (trunk 137954)", isOptimized: true, emissionKind: 0, file: !16, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.0 (trunk 137954)", isOptimized: true, emissionKind: 0, file: !16, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2) !1 = !{!2} !2 = !{} !3 = !{!5} -!5 = !DISubprogram(name: "bar", linkageName: "_Z3barN2N11AE", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scope: !6, type: !7, function: void ()* @_Z3barN2N11AE) +!5 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barN2N11AE", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scope: !6, type: !7) !6 = !DIFile(filename: "n2.c", directory: "/private/tmp") !7 = !DISubroutineType(types: !8) !8 = !{null} -!9 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "youra", line: 4, arg: 1, scope: !5, file: !6, type: !10) +!9 = !DILocalVariable(name: "youra", line: 4, arg: 1, scope: !5, file: !6, type: !10) !10 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 3, size: 8, align: 8, file: !17, scope: !11, elements: !2) !11 = !DINamespace(name: "N1", line: 2, file: !17, scope: null) !12 = !DIFile(filename: "./n.h", directory: "/private/tmp") diff --git a/test/Linker/2011-08-18-unique-debug-type.ll b/test/Linker/2011-08-18-unique-debug-type.ll index b1da9354f8ce..11a1c4ecb731 100644 --- a/test/Linker/2011-08-18-unique-debug-type.ll +++ b/test/Linker/2011-08-18-unique-debug-type.ll @@ -4,7 +4,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target triple = "x86_64-apple-macosx10.7.0" -define i32 @foo() nounwind uwtable ssp { +define i32 @foo() nounwind uwtable ssp !dbg !5 { entry: ret i32 1, !dbg !10 } @@ -12,11 +12,11 @@ entry: !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!13} -!0 = !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk 137954)", isOptimized: true, emissionKind: 0, file: !12, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk 137954)", isOptimized: true, emissionKind: 0, file: !12, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2) !1 = !{!2} !2 = !{} !3 = !{!5} -!5 = !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !12, scope: !6, type: !7, function: i32 ()* @foo) +!5 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !12, scope: !6, type: !7) !6 = !DIFile(filename: "one.c", directory: "/private/tmp") !7 = !DISubroutineType(types: !8) !8 = !{!9} diff --git a/test/Linker/2011-08-18-unique-debug-type2.ll b/test/Linker/2011-08-18-unique-debug-type2.ll index 40958dabf880..5b68ba0bf295 100644 --- a/test/Linker/2011-08-18-unique-debug-type2.ll +++ b/test/Linker/2011-08-18-unique-debug-type2.ll @@ -4,7 +4,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target triple = "x86_64-apple-macosx10.7.0" -define i32 @bar() nounwind uwtable ssp { +define i32 @bar() nounwind uwtable ssp !dbg !5 { entry: ret i32 2, !dbg !10 } @@ -12,11 +12,11 @@ entry: !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!13} -!0 = !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk 137954)", isOptimized: true, emissionKind: 0, file: !12, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk 137954)", isOptimized: true, emissionKind: 0, file: !12, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2) !1 = !{!2} !2 = !{} !3 = !{!5} -!5 = !DISubprogram(name: "bar", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !12, scope: !6, type: !7, function: i32 ()* @bar) +!5 = distinct !DISubprogram(name: "bar", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, file: !12, scope: !6, type: !7) !6 = !DIFile(filename: "two.c", directory: "/private/tmp") !7 = !DISubroutineType(types: !8) !8 = !{!9} diff --git a/test/Linker/ConstantGlobals.ll b/test/Linker/ConstantGlobals.ll index 49f86a51bd7f..58c0d711a07e 100644 --- a/test/Linker/ConstantGlobals.ll +++ b/test/Linker/ConstantGlobals.ll @@ -6,3 +6,7 @@ ; CHECK-DAG: @Y = external global [1 x i32] @Y = external global [1 x i32] + +define [1 x i32]* @use-Y() { + ret [1 x i32] *@Y +} diff --git a/test/Linker/DbgDeclare.ll b/test/Linker/DbgDeclare.ll index a6ffa915c071..23c00a32dbc0 100644 --- a/test/Linker/DbgDeclare.ll +++ b/test/Linker/DbgDeclare.ll @@ -14,7 +14,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.9.0" -define i32 @main(i32 %argc, i8** %argv) uwtable ssp { +define i32 @main(i32 %argc, i8** %argv) uwtable ssp !dbg !5 { entry: %retval = alloca i32, align 4 %argc.addr = alloca i32, align 4 @@ -37,10 +37,10 @@ declare void @test(i32, i8**) !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!21} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.3 (trunk 173515)", isOptimized: true, emissionKind: 0, file: !20, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.3 (trunk 173515)", isOptimized: true, emissionKind: 0, file: !20, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2) !2 = !{} !3 = !{!5} -!5 = !DISubprogram(name: "main", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !20, scope: null, type: !7, function: i32 (i32, i8**)* @main, variables: !2) +!5 = distinct !DISubprogram(name: "main", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !20, scope: null, type: !7, variables: !2) !6 = !DIFile(filename: "main.cpp", directory: "/private/tmp") !7 = !DISubroutineType(types: !8) !8 = !{!9, !9, !10} @@ -49,9 +49,9 @@ declare void @test(i32, i8**) !11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !12) !12 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !13) !13 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) -!14 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "argc", line: 3, arg: 1, scope: !5, file: !6, type: !9) +!14 = !DILocalVariable(name: "argc", line: 3, arg: 1, scope: !5, file: !6, type: !9) !15 = !DILocation(line: 3, scope: !5) -!16 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "argv", line: 3, arg: 2, scope: !5, file: !6, type: !10) +!16 = !DILocalVariable(name: "argv", line: 3, arg: 2, scope: !5, file: !6, type: !10) !17 = !DILocation(line: 5, scope: !18) !18 = distinct !DILexicalBlock(line: 4, column: 0, file: !20, scope: !5) !19 = !DILocation(line: 6, scope: !18) diff --git a/test/Linker/DbgDeclare2.ll b/test/Linker/DbgDeclare2.ll index b716833ecc66..2335f126d8e4 100644 --- a/test/Linker/DbgDeclare2.ll +++ b/test/Linker/DbgDeclare2.ll @@ -5,7 +5,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.9.0" -define void @test(i32 %argc, i8** %argv) uwtable ssp { +define void @test(i32 %argc, i8** %argv) uwtable ssp !dbg !5 { entry: %argc.addr = alloca i32, align 4 %argv.addr = alloca i8**, align 8 @@ -50,10 +50,10 @@ declare i32 @puts(i8*) !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!27} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.3 (trunk 173515)", isOptimized: true, emissionKind: 0, file: !25, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.3 (trunk 173515)", isOptimized: true, emissionKind: 0, file: !25, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2) !2 = !{} !3 = !{!5} -!5 = !DISubprogram(name: "print_args", linkageName: "test", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 5, file: !26, scope: null, type: !7, function: void (i32, i8**)* @test, variables: !2) +!5 = distinct !DISubprogram(name: "print_args", linkageName: "test", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 5, file: !26, scope: null, type: !7, variables: !2) !6 = !DIFile(filename: "test.cpp", directory: "/private/tmp") !7 = !DISubroutineType(types: !8) !8 = !{null, !9, !10} @@ -62,10 +62,10 @@ declare i32 @puts(i8*) !11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !12) !12 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !13) !13 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) -!14 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "argc", line: 4, arg: 1, scope: !5, file: !6, type: !9) +!14 = !DILocalVariable(name: "argc", line: 4, arg: 1, scope: !5, file: !6, type: !9) !15 = !DILocation(line: 4, scope: !5) -!16 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "argv", line: 4, arg: 2, scope: !5, file: !6, type: !10) -!17 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "i", line: 6, scope: !18, file: !6, type: !9) +!16 = !DILocalVariable(name: "argv", line: 4, arg: 2, scope: !5, file: !6, type: !10) +!17 = !DILocalVariable(name: "i", line: 6, scope: !18, file: !6, type: !9) !18 = distinct !DILexicalBlock(line: 6, column: 0, file: !26, scope: !19) !19 = distinct !DILexicalBlock(line: 5, column: 0, file: !26, scope: !5) !20 = !DILocation(line: 6, scope: !18) diff --git a/test/Linker/Inputs/PR8300.b.ll b/test/Linker/Inputs/PR8300.b.ll index 9e538f5d286a..ce17f5f0dbe1 100644 --- a/test/Linker/Inputs/PR8300.b.ll +++ b/test/Linker/Inputs/PR8300.b.ll @@ -1,7 +1,7 @@ %foo = type { [8 x i8] } %bar = type { [9 x i8] } -@zed = alias bitcast (void (%bar*)* @xyz to void (%foo*)*) +@zed = alias void (%foo*), bitcast (void (%bar*)* @xyz to void (%foo*)*) define void @xyz(%bar* %this) { entry: diff --git a/test/Linker/Inputs/alias.ll b/test/Linker/Inputs/alias.ll index f379476e7654..d4a734f58251 100644 --- a/test/Linker/Inputs/alias.ll +++ b/test/Linker/Inputs/alias.ll @@ -1,3 +1,3 @@ @zed = global i32 42 -@foo = alias i32* @zed -@foo2 = alias bitcast (i32* @zed to i16*) +@foo = alias i32, i32* @zed +@foo2 = alias i16, bitcast (i32* @zed to i16*) diff --git a/test/Linker/Inputs/available_externally_over_decl.ll b/test/Linker/Inputs/available_externally_over_decl.ll new file mode 100644 index 000000000000..6bd0a939957b --- /dev/null +++ b/test/Linker/Inputs/available_externally_over_decl.ll @@ -0,0 +1,10 @@ +@h = global void ()* @f +@h2 = global void ()* @g + +define available_externally void @f() { + ret void +} + +define available_externally void @g() { + ret void +} diff --git a/test/Linker/Inputs/comdat11.ll b/test/Linker/Inputs/comdat11.ll new file mode 100644 index 000000000000..5b7f74cf0b24 --- /dev/null +++ b/test/Linker/Inputs/comdat11.ll @@ -0,0 +1,9 @@ +$foo = comdat any +@foo = global i8 1, comdat +define void @zed() { + call void @bar() + ret void +} +define void @bar() comdat($foo) { + ret void +} diff --git a/test/Linker/Inputs/comdat13.ll b/test/Linker/Inputs/comdat13.ll new file mode 100644 index 000000000000..85515210ed7e --- /dev/null +++ b/test/Linker/Inputs/comdat13.ll @@ -0,0 +1,9 @@ +$foo = comdat any +@foo = internal global i8 1, comdat +define i8* @zed() { + call void @bax() + ret i8* @foo +} +define internal void @bax() comdat($foo) { + ret void +} diff --git a/test/Linker/Inputs/comdat14.ll b/test/Linker/Inputs/comdat14.ll new file mode 100644 index 000000000000..5e79fbcdacc1 --- /dev/null +++ b/test/Linker/Inputs/comdat14.ll @@ -0,0 +1,12 @@ +$c = comdat any + +@v2 = weak dllexport global i32 0, comdat ($c) +define i32* @f2() { + ret i32* @v2 +} + +@v3 = weak alias i32, i32* @v2 +define i32* @f3() { + ret i32* @v3 +} + diff --git a/test/Linker/Inputs/comdat15.ll b/test/Linker/Inputs/comdat15.ll new file mode 100644 index 000000000000..5d2d41bba6aa --- /dev/null +++ b/test/Linker/Inputs/comdat15.ll @@ -0,0 +1,6 @@ +$a1 = comdat any +@baz = private global i32 42, comdat($a1) +@a1 = internal alias i32, i32* @baz +define i32* @abc() { + ret i32* @a1 +} diff --git a/test/Linker/Inputs/comdat5.ll b/test/Linker/Inputs/comdat5.ll index 19739eb1b5da..236faaee0ae0 100644 --- a/test/Linker/Inputs/comdat5.ll +++ b/test/Linker/Inputs/comdat5.ll @@ -4,6 +4,6 @@ $foo = comdat largest @zed = external constant i8 @some_name = private unnamed_addr constant [2 x i8*] [i8* @zed, i8* bitcast (void ()* @bar to i8*)], comdat($foo) -@foo = alias getelementptr([2 x i8*], [2 x i8*]* @some_name, i32 0, i32 1) +@foo = alias i8*, getelementptr([2 x i8*], [2 x i8*]* @some_name, i32 0, i32 1) declare void @bar() unnamed_addr diff --git a/test/Linker/Inputs/comdat8.ll b/test/Linker/Inputs/comdat8.ll index a2833b05cf13..fbf099cb9aef 100644 --- a/test/Linker/Inputs/comdat8.ll +++ b/test/Linker/Inputs/comdat8.ll @@ -1,4 +1,4 @@ $c1 = comdat largest @some_name = private unnamed_addr constant i32 42, comdat($c1) -@c1 = alias i32* @some_name +@c1 = alias i32, i32* @some_name diff --git a/test/Linker/Inputs/ctors2.ll b/test/Linker/Inputs/ctors2.ll new file mode 100644 index 000000000000..e2fe5ff429c0 --- /dev/null +++ b/test/Linker/Inputs/ctors2.ll @@ -0,0 +1,6 @@ +$foo = comdat any +@foo = global i8 1, comdat +@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @bar, i8* @foo }] +define void @bar() comdat($foo) { + ret void +} diff --git a/test/Linker/Inputs/ctors3.ll b/test/Linker/Inputs/ctors3.ll new file mode 100644 index 000000000000..449ccbd90faf --- /dev/null +++ b/test/Linker/Inputs/ctors3.ll @@ -0,0 +1,7 @@ +$foo = comdat any +%t = type { i8 } +@foo = global %t zeroinitializer, comdat +@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @bar, i8* getelementptr (%t, %t* @foo, i32 0, i32 0) }] +define internal void @bar() comdat($foo) { + ret void +} diff --git a/test/Linker/Inputs/funcimport.ll b/test/Linker/Inputs/funcimport.ll new file mode 100644 index 000000000000..25cfcfc2a657 --- /dev/null +++ b/test/Linker/Inputs/funcimport.ll @@ -0,0 +1,28 @@ +define i32 @main() #0 { +entry: + call void (...) @weakalias() + call void (...) @analias() + %call = call i32 (...) @referencestatics() + %call1 = call i32 (...) @referenceglobals() + %call2 = call i32 (...) @referencecommon() + call void (...) @setfuncptr() + call void (...) @callfuncptr() + call void (...) @callweakfunc() + ret i32 0 +} + +declare void @weakalias(...) #1 + +declare void @analias(...) #1 + +declare i32 @referencestatics(...) #1 + +declare i32 @referenceglobals(...) #1 + +declare i32 @referencecommon(...) #1 + +declare void @setfuncptr(...) #1 + +declare void @callfuncptr(...) #1 + +declare void @callweakfunc(...) #1 diff --git a/test/Linker/Inputs/funcimport_appending_global.ll b/test/Linker/Inputs/funcimport_appending_global.ll new file mode 100644 index 000000000000..413b890b02ad --- /dev/null +++ b/test/Linker/Inputs/funcimport_appending_global.ll @@ -0,0 +1,6 @@ +@v = weak global i8 1 +@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @foo, i8* @v}] + +define void @foo() { + ret void +} diff --git a/test/Linker/Inputs/internalize-lazy.ll b/test/Linker/Inputs/internalize-lazy.ll new file mode 100644 index 000000000000..43f9a7ab7455 --- /dev/null +++ b/test/Linker/Inputs/internalize-lazy.ll @@ -0,0 +1,8 @@ +define linkonce_odr void @g() { + ret void +} + +define void @f() { + call void @g() + ret void +} diff --git a/test/Linker/Inputs/linkage.c.ll b/test/Linker/Inputs/linkage.c.ll new file mode 100644 index 000000000000..6aedf5ab111b --- /dev/null +++ b/test/Linker/Inputs/linkage.c.ll @@ -0,0 +1,4 @@ +@X = global i32 5 +@U = global i32 6 +define i32 @foo() { ret i32 7 } +define i32 @unused() { ret i32 8 } diff --git a/test/Linker/Inputs/mdlocation.ll b/test/Linker/Inputs/mdlocation.ll index 22473db46097..9c2f65d0a59a 100644 --- a/test/Linker/Inputs/mdlocation.ll +++ b/test/Linker/Inputs/mdlocation.ll @@ -1,13 +1,9 @@ -!named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9} +!named = !{!0, !1, !2, !3, !4, !5} -!0 = !DISubprogram() ; Use this as a scope. +!0 = distinct !DISubprogram() ; Use this as a scope. !1 = !DILocation(line: 3, column: 7, scope: !0) !2 = !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !1) !3 = !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !2) -!4 = distinct !DISubprogram() ; Test actual remapping. -!5 = !DILocation(line: 3, column: 7, scope: !4) -!6 = !DILocation(line: 3, column: 7, scope: !4, inlinedAt: !5) -!7 = !DILocation(line: 3, column: 7, scope: !4, inlinedAt: !6) ; Test distinct nodes. -!8 = distinct !DILocation(line: 3, column: 7, scope: !0) -!9 = distinct !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !8) +!4 = distinct !DILocation(line: 3, column: 7, scope: !0) +!5 = distinct !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !4) diff --git a/test/Linker/Inputs/only-needed-debug-metadata.ll b/test/Linker/Inputs/only-needed-debug-metadata.ll new file mode 100644 index 000000000000..ec7f02f4d194 --- /dev/null +++ b/test/Linker/Inputs/only-needed-debug-metadata.ll @@ -0,0 +1,27 @@ +@X = external global i32 + +declare i32 @foo() + +define void @bar() !dbg !4 { + load i32, i32* @X, !dbg !10 + call i32 @foo(), !dbg !11 + ret void, !dbg !12 +} + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!7, !8} +!llvm.ident = !{!9} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 251407) (llvm/trunk 251401)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3) +!1 = !DIFile(filename: "linkused.b.c", directory: ".") +!2 = !{} +!3 = !{!4} +!4 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 5, type: !5, isLocal: false, isDefinition: true, scopeLine: 5, isOptimized: true, variables: !2) +!5 = !DISubroutineType(types: !6) +!6 = !{null} +!7 = !{i32 2, !"Dwarf Version", i32 4} +!8 = !{i32 2, !"Debug Info Version", i32 3} +!9 = !{!"clang version 3.8.0 (trunk 251407) (llvm/trunk 251401)"} +!10 = !DILocation(line: 6, column: 7, scope: !4) +!11 = !DILocation(line: 6, column: 3, scope: !4) +!12 = !DILocation(line: 7, column: 1, scope: !4) diff --git a/test/Linker/Inputs/only-needed-named-metadata.ll b/test/Linker/Inputs/only-needed-named-metadata.ll new file mode 100644 index 000000000000..fa7bc2e3cc87 --- /dev/null +++ b/test/Linker/Inputs/only-needed-named-metadata.ll @@ -0,0 +1,9 @@ +@X = external global i32 + +declare i32 @foo() + +define void @bar() { + load i32, i32* @X + call i32 @foo() + ret void +} diff --git a/test/Linker/Inputs/opaque.ll b/test/Linker/Inputs/opaque.ll index f164abd586d1..a5f27cba418e 100644 --- a/test/Linker/Inputs/opaque.ll +++ b/test/Linker/Inputs/opaque.ll @@ -11,3 +11,11 @@ define void @f1() { getelementptr %A, %A* null, i32 0 ret void } + +define %A* @use_g2() { + ret %A* @g2 +} + +define %B* @use_g3() { + ret %B* @g3 +} diff --git a/test/Linker/Inputs/replaced-function-matches-first-subprogram.ll b/test/Linker/Inputs/replaced-function-matches-first-subprogram.ll index efa8ec9c67b0..a817cf071078 100644 --- a/test/Linker/Inputs/replaced-function-matches-first-subprogram.ll +++ b/test/Linker/Inputs/replaced-function-matches-first-subprogram.ll @@ -1,6 +1,6 @@ %struct.Class = type { i8 } -define weak_odr i32 @_ZN5ClassIiE3fooEv(%struct.Class* %this) align 2 { +define weak_odr i32 @_ZN5ClassIiE3fooEv(%struct.Class* %this) align 2 !dbg !4 { entry: %this.addr = alloca %struct.Class*, align 8 store %struct.Class* %this, %struct.Class** %this.addr, align 8 @@ -12,11 +12,11 @@ entry: !llvm.module.flags = !{!8, !9, !10} !llvm.ident = !{!11} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 (trunk 224193) (llvm/trunk 224197)", isOptimized: false, emissionKind: 2, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 (trunk 224193) (llvm/trunk 224197)", isOptimized: false, emissionKind: 2, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) !1 = !DIFile(filename: "t2.cpp", directory: "/Users/dexonsmith/data/llvm/staging/test/Linker/repro/d2") !2 = !{} !3 = !{!4} -!4 = !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !6, type: !7, function: i32 (%struct.Class*)* @_ZN5ClassIiE3fooEv, variables: !2) +!4 = distinct !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !6, type: !7, variables: !2) !5 = !DIFile(filename: "../t.h", directory: "/Users/dexonsmith/data/llvm/staging/test/Linker/repro/d2") !6 = !DIFile(filename: "../t.h", directory: "/Users/dexonsmith/data/llvm/staging/test/Linker/repro/d2") !7 = !DISubroutineType(types: !2) diff --git a/test/Linker/Inputs/subprogram-linkonce-weak-odr.ll b/test/Linker/Inputs/subprogram-linkonce-weak-odr.ll deleted file mode 100644 index 71c080173a3d..000000000000 --- a/test/Linker/Inputs/subprogram-linkonce-weak-odr.ll +++ /dev/null @@ -1,15 +0,0 @@ -define weak_odr i32 @foo(i32 %a, i32 %b) { -entry: - %sum = add i32 %a, %b, !dbg !DILocation(line: 2, scope: !3) - ret i32 %sum, !dbg !DILocation(line: 3, scope: !3) -} - -!llvm.module.flags = !{!0} -!0 = !{i32 2, !"Debug Info Version", i32 3} - -!llvm.dbg.cu = !{!1} -!1 = !DICompileUnit(language: DW_LANG_C99, file: !2, subprograms: !{!3}, emissionKind: 1) -!2 = !DIFile(filename: "foo.c", directory: "/path/to/dir") -!3 = !DISubprogram(file: !4, scope: !4, line: 1, name: "foo", function: i32 (i32, i32)* @foo, type: !5) -!4 = !DIFile(filename: "foo.h", directory: "/path/to/dir") -!5 = !DISubroutineType(types: !{}) diff --git a/test/Linker/Inputs/subprogram-linkonce-weak.ll b/test/Linker/Inputs/subprogram-linkonce-weak.ll index f5399e244a9c..5e6627d90c97 100644 --- a/test/Linker/Inputs/subprogram-linkonce-weak.ll +++ b/test/Linker/Inputs/subprogram-linkonce-weak.ll @@ -1,4 +1,4 @@ -define weak i32 @foo(i32 %a, i32 %b) { +define weak i32 @foo(i32 %a, i32 %b) !dbg !3 { entry: %sum = call i32 @fastadd(i32 %a, i32 %b), !dbg !DILocation(line: 52, scope: !3) ret i32 %sum, !dbg !DILocation(line: 53, scope: !3) @@ -10,7 +10,7 @@ declare i32 @fastadd(i32, i32) !0 = !{i32 2, !"Debug Info Version", i32 3} !llvm.dbg.cu = !{!1} -!1 = !DICompileUnit(language: DW_LANG_C99, file: !2, subprograms: !{!3}, emissionKind: 1) +!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, subprograms: !{!3}, emissionKind: 1) !2 = !DIFile(filename: "foo.c", directory: "/path/to/dir") -!3 = !DISubprogram(file: !2, scope: !2, line: 51, name: "foo", function: i32 (i32, i32)* @foo, type: !4) +!3 = distinct !DISubprogram(file: !2, scope: !2, line: 51, name: "foo", type: !4) !4 = !DISubroutineType(types: !{}) diff --git a/test/Linker/Inputs/testlink.ll b/test/Linker/Inputs/testlink.ll index 263d9e77d1ab..22a66399be09 100644 --- a/test/Linker/Inputs/testlink.ll +++ b/test/Linker/Inputs/testlink.ll @@ -53,4 +53,6 @@ define internal void @testIntern() { ret void } -declare void @VecSizeCrash1(%VecSize) +define void @VecSizeCrash1(%VecSize) { + ret void +} diff --git a/test/Linker/Inputs/thinlto_funcimport_debug.ll b/test/Linker/Inputs/thinlto_funcimport_debug.ll new file mode 100644 index 000000000000..846a5ea001d5 --- /dev/null +++ b/test/Linker/Inputs/thinlto_funcimport_debug.ll @@ -0,0 +1,38 @@ +; ModuleID = 'dbg_main.o' +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; Function Attrs: nounwind uwtable +define i32 @main() #0 !dbg !4 { +entry: + %call = tail call i32 @func1(i32 10) #2, !dbg !11 + %call1 = tail call i32 @func2(i32 10) #2, !dbg !12 + ret i32 0, !dbg !13 +} + +declare i32 @func1(i32) #1 + +declare i32 @func2(i32) #1 + +attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #2 = { nounwind } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!8, !9} +!llvm.ident = !{!10} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 251407) (llvm/trunk 251401)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3) +!1 = !DIFile(filename: "dbg_main.c", directory: ".") +!2 = !{} +!3 = !{!4} +!4 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, variables: !2) +!5 = !DISubroutineType(types: !6) +!6 = !{!7} +!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!8 = !{i32 2, !"Dwarf Version", i32 4} +!9 = !{i32 2, !"Debug Info Version", i32 3} +!10 = !{!"clang version 3.8.0 (trunk 251407) (llvm/trunk 251401)"} +!11 = !DILocation(line: 4, column: 3, scope: !4) +!12 = !DILocation(line: 5, column: 3, scope: !4) +!13 = !DILocation(line: 6, column: 1, scope: !4) diff --git a/test/Linker/Inputs/type-unique-alias.ll b/test/Linker/Inputs/type-unique-alias.ll index 3ee162ccfcfe..5a3dc7d37011 100644 --- a/test/Linker/Inputs/type-unique-alias.ll +++ b/test/Linker/Inputs/type-unique-alias.ll @@ -1,4 +1,4 @@ %u = type { i8 } @g2 = global %u zeroinitializer -@a = weak alias %u* @g2 +@a = weak alias %u, %u* @g2 diff --git a/test/Linker/Inputs/type-unique-dst-types2.ll b/test/Linker/Inputs/type-unique-dst-types2.ll index b565c6d73649..7770ea3cca07 100644 --- a/test/Linker/Inputs/type-unique-dst-types2.ll +++ b/test/Linker/Inputs/type-unique-dst-types2.ll @@ -1,3 +1,7 @@ %A.11 = type { %B } %B = type { i8 } @g1 = external global %A.11 + +define %A.11* @use_g1() { + ret %A.11* @g1 +} diff --git a/test/Linker/Inputs/type-unique-dst-types3.ll b/test/Linker/Inputs/type-unique-dst-types3.ll index c5794ad839a2..8a5ac2694791 100644 --- a/test/Linker/Inputs/type-unique-dst-types3.ll +++ b/test/Linker/Inputs/type-unique-dst-types3.ll @@ -1,2 +1,6 @@ %A.11 = type opaque @g2 = external global %A.11 + +define %A.11* @use_g2() { + ret %A.11* @g2 +} diff --git a/test/Linker/Inputs/type-unique-inheritance-a.ll b/test/Linker/Inputs/type-unique-inheritance-a.ll index 75cc7e1c838a..0a1c107580bb 100644 --- a/test/Linker/Inputs/type-unique-inheritance-a.ll +++ b/test/Linker/Inputs/type-unique-inheritance-a.ll @@ -47,7 +47,7 @@ %class.Base = type { i32 } ; Function Attrs: nounwind ssp uwtable -define void @_Z1fi(i32 %a) #0 { +define void @_Z1fi(i32 %a) #0 !dbg !15 { entry: %a.addr = alloca i32, align 4 %t = alloca %class.A, align 4 @@ -66,7 +66,7 @@ attributes #1 = { nounwind readnone } !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!19, !25} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 (http://llvm.org/git/clang.git f54e02f969d02d640103db73efc30c45439fceab) (http://llvm.org/git/llvm.git 284353b55896cb1babfaa7add7c0a363245342d2)", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !14, globals: !2, imports: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 (http://llvm.org/git/clang.git f54e02f969d02d640103db73efc30c45439fceab) (http://llvm.org/git/llvm.git 284353b55896cb1babfaa7add7c0a363245342d2)", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !14, globals: !2, imports: !2) !1 = !DIFile(filename: "foo.cpp", directory: "/Users/mren/c_testing/type_unique_air/inher") !2 = !{} !3 = !{!4, !8} @@ -81,14 +81,14 @@ attributes #1 = { nounwind readnone } !12 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) !13 = !DIDerivedType(tag: DW_TAG_member, name: "x", line: 4, size: 32, align: 32, offset: 32, flags: DIFlagPrivate, file: !5, scope: !"_ZTS1A", baseType: !12) !14 = !{!15} -!15 = !DISubprogram(name: "f", linkageName: "_Z1fi", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 5, file: !1, scope: !16, type: !17, function: void (i32)* @_Z1fi, variables: !2) +!15 = distinct !DISubprogram(name: "f", linkageName: "_Z1fi", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 5, file: !1, scope: !16, type: !17, variables: !2) !16 = !DIFile(filename: "foo.cpp", directory: "/Users/mren/c_testing/type_unique_air/inher") !17 = !DISubroutineType(types: !18) !18 = !{null, !12} !19 = !{i32 2, !"Dwarf Version", i32 2} -!20 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "a", line: 5, arg: 1, scope: !15, file: !16, type: !12) +!20 = !DILocalVariable(name: "a", line: 5, arg: 1, scope: !15, file: !16, type: !12) !21 = !DILocation(line: 5, scope: !15) -!22 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "t", line: 6, scope: !15, file: !16, type: !4) +!22 = !DILocalVariable(name: "t", line: 6, scope: !15, file: !16, type: !4) !23 = !DILocation(line: 6, scope: !15) !24 = !DILocation(line: 7, scope: !15) !25 = !{i32 1, !"Debug Info Version", i32 3} diff --git a/test/Linker/Inputs/type-unique-inheritance-b.ll b/test/Linker/Inputs/type-unique-inheritance-b.ll index dd89b8dd42df..e87b96b9c791 100644 --- a/test/Linker/Inputs/type-unique-inheritance-b.ll +++ b/test/Linker/Inputs/type-unique-inheritance-b.ll @@ -5,7 +5,7 @@ %class.Base = type { i32 } ; Function Attrs: nounwind ssp uwtable -define void @_Z1gi(i32 %a) #0 { +define void @_Z1gi(i32 %a) #0 !dbg !20 { entry: %a.addr = alloca i32, align 4 %t = alloca %class.B, align 8 @@ -19,7 +19,7 @@ entry: declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 ; Function Attrs: ssp uwtable -define i32 @main() #2 { +define i32 @main() #2 !dbg !24 { entry: %retval = alloca i32, align 4 %a = alloca %class.A, align 4 @@ -40,7 +40,7 @@ attributes #3 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!27, !38} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 (http://llvm.org/git/clang.git f54e02f969d02d640103db73efc30c45439fceab) (http://llvm.org/git/llvm.git 284353b55896cb1babfaa7add7c0a363245342d2)", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !19, globals: !2, imports: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 (http://llvm.org/git/clang.git f54e02f969d02d640103db73efc30c45439fceab) (http://llvm.org/git/llvm.git 284353b55896cb1babfaa7add7c0a363245342d2)", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !19, globals: !2, imports: !2) !1 = !DIFile(filename: "bar.cpp", directory: "/Users/mren/c_testing/type_unique_air/inher") !2 = !{} !3 = !{!4, !11, !15} @@ -60,20 +60,20 @@ attributes #3 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n !17 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 4, size: 32, align: 32, flags: DIFlagPrivate, file: !5, scope: !"_ZTS4Base", baseType: !8) !18 = !DIDerivedType(tag: DW_TAG_member, name: "x", line: 4, size: 32, align: 32, offset: 32, flags: DIFlagPrivate, file: !12, scope: !"_ZTS1A", baseType: !8) !19 = !{!20, !24} -!20 = !DISubprogram(name: "g", linkageName: "_Z1gi", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !1, scope: !21, type: !22, function: void (i32)* @_Z1gi, variables: !2) +!20 = distinct !DISubprogram(name: "g", linkageName: "_Z1gi", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !1, scope: !21, type: !22, variables: !2) !21 = !DIFile(filename: "bar.cpp", directory: "/Users/mren/c_testing/type_unique_air/inher") !22 = !DISubroutineType(types: !23) !23 = !{null, !8} -!24 = !DISubprogram(name: "main", line: 9, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 9, file: !1, scope: !21, type: !25, function: i32 ()* @main, variables: !2) +!24 = distinct !DISubprogram(name: "main", line: 9, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 9, file: !1, scope: !21, type: !25, variables: !2) !25 = !DISubroutineType(types: !26) !26 = !{!8} !27 = !{i32 2, !"Dwarf Version", i32 2} -!28 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "a", line: 4, arg: 1, scope: !20, file: !21, type: !8) +!28 = !DILocalVariable(name: "a", line: 4, arg: 1, scope: !20, file: !21, type: !8) !29 = !DILocation(line: 4, scope: !20) -!30 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "t", line: 5, scope: !20, file: !21, type: !4) +!30 = !DILocalVariable(name: "t", line: 5, scope: !20, file: !21, type: !4) !31 = !DILocation(line: 5, scope: !20) !32 = !DILocation(line: 6, scope: !20) -!33 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "a", line: 10, scope: !24, file: !21, type: !11) +!33 = !DILocalVariable(name: "a", line: 10, scope: !24, file: !21, type: !11) !34 = !DILocation(line: 10, scope: !24) !35 = !DILocation(line: 11, scope: !24) !36 = !DILocation(line: 12, scope: !24) diff --git a/test/Linker/Inputs/type-unique-simple2-a.ll b/test/Linker/Inputs/type-unique-simple2-a.ll index c07157bf87b6..2a52e89b6fd3 100644 --- a/test/Linker/Inputs/type-unique-simple2-a.ll +++ b/test/Linker/Inputs/type-unique-simple2-a.ll @@ -44,7 +44,7 @@ %struct.Base = type { i32, %struct.Base* } ; Function Attrs: nounwind ssp uwtable -define void @_Z1fi(i32 %a) #0 { +define void @_Z1fi(i32 %a) #0 !dbg !12 { entry: %a.addr = alloca i32, align 4 %t = alloca %struct.Base, align 8 @@ -63,7 +63,7 @@ attributes #1 = { nounwind readnone } !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!16, !22} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 (http://llvm.org/git/clang.git 8a3f9e46cb988d2c664395b21910091e3730ae82) (http://llvm.org/git/llvm.git 4699e9549358bc77824a59114548eecc3f7c523c)", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !11, globals: !2, imports: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 (http://llvm.org/git/clang.git 8a3f9e46cb988d2c664395b21910091e3730ae82) (http://llvm.org/git/llvm.git 4699e9549358bc77824a59114548eecc3f7c523c)", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !11, globals: !2, imports: !2) !1 = !DIFile(filename: "foo.cpp", directory: ".") !2 = !{} !3 = !{!4} @@ -75,14 +75,14 @@ attributes #1 = { nounwind readnone } !9 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 3, size: 64, align: 64, offset: 64, file: !5, scope: !"_ZTS4Base", baseType: !10) !10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS4Base") !11 = !{!12} -!12 = !DISubprogram(name: "f", linkageName: "_Z1fi", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !13, type: !14, function: void (i32)* @_Z1fi, variables: !2) +!12 = distinct !DISubprogram(name: "f", linkageName: "_Z1fi", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !13, type: !14, variables: !2) !13 = !DIFile(filename: "foo.cpp", directory: ".") !14 = !DISubroutineType(types: !15) !15 = !{null, !8} !16 = !{i32 2, !"Dwarf Version", i32 2} -!17 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "a", line: 3, arg: 1, scope: !12, file: !13, type: !8) +!17 = !DILocalVariable(name: "a", line: 3, arg: 1, scope: !12, file: !13, type: !8) !18 = !DILocation(line: 3, scope: !12) -!19 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "t", line: 4, scope: !12, file: !13, type: !4) +!19 = !DILocalVariable(name: "t", line: 4, scope: !12, file: !13, type: !4) !20 = !DILocation(line: 4, scope: !12) !21 = !DILocation(line: 5, scope: !12) !22 = !{i32 1, !"Debug Info Version", i32 3} diff --git a/test/Linker/Inputs/type-unique-simple2-b.ll b/test/Linker/Inputs/type-unique-simple2-b.ll index 817f88704de5..7e1c6aabd9a5 100644 --- a/test/Linker/Inputs/type-unique-simple2-b.ll +++ b/test/Linker/Inputs/type-unique-simple2-b.ll @@ -3,7 +3,7 @@ %struct.Base = type { i32, %struct.Base* } ; Function Attrs: nounwind ssp uwtable -define void @_Z1gi(i32 %a) #0 { +define void @_Z1gi(i32 %a) #0 !dbg !12 { entry: %a.addr = alloca i32, align 4 %t = alloca %struct.Base, align 8 @@ -17,7 +17,7 @@ entry: declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 ; Function Attrs: ssp uwtable -define i32 @main() #2 { +define i32 @main() #2 !dbg !16 { entry: %retval = alloca i32, align 4 store i32 0, i32* %retval @@ -36,7 +36,7 @@ attributes #3 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!19, !28} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 (http://llvm.org/git/clang.git 8a3f9e46cb988d2c664395b21910091e3730ae82) (http://llvm.org/git/llvm.git 4699e9549358bc77824a59114548eecc3f7c523c)", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !11, globals: !2, imports: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 (http://llvm.org/git/clang.git 8a3f9e46cb988d2c664395b21910091e3730ae82) (http://llvm.org/git/llvm.git 4699e9549358bc77824a59114548eecc3f7c523c)", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !11, globals: !2, imports: !2) !1 = !DIFile(filename: "bar.cpp", directory: ".") !2 = !{} !3 = !{!4} @@ -48,17 +48,17 @@ attributes #3 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n !9 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 3, size: 64, align: 64, offset: 64, file: !5, scope: !"_ZTS4Base", baseType: !10) !10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS4Base") !11 = !{!12, !16} -!12 = !DISubprogram(name: "g", linkageName: "_Z1gi", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !1, scope: !13, type: !14, function: void (i32)* @_Z1gi, variables: !2) +!12 = distinct !DISubprogram(name: "g", linkageName: "_Z1gi", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !1, scope: !13, type: !14, variables: !2) !13 = !DIFile(filename: "bar.cpp", directory: ".") !14 = !DISubroutineType(types: !15) !15 = !{null, !8} -!16 = !DISubprogram(name: "main", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !13, type: !17, function: i32 ()* @main, variables: !2) +!16 = distinct !DISubprogram(name: "main", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !13, type: !17, variables: !2) !17 = !DISubroutineType(types: !18) !18 = !{!8} !19 = !{i32 2, !"Dwarf Version", i32 2} -!20 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "a", line: 4, arg: 1, scope: !12, file: !13, type: !8) +!20 = !DILocalVariable(name: "a", line: 4, arg: 1, scope: !12, file: !13, type: !8) !21 = !DILocation(line: 4, scope: !12) -!22 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "t", line: 5, scope: !12, file: !13, type: !4) +!22 = !DILocalVariable(name: "t", line: 5, scope: !12, file: !13, type: !4) !23 = !DILocation(line: 5, scope: !12) !24 = !DILocation(line: 6, scope: !12) !25 = !DILocation(line: 8, scope: !16) diff --git a/test/Linker/Inputs/visibility.ll b/test/Linker/Inputs/visibility.ll index 2cd112ed37f2..286bee5d783b 100644 --- a/test/Linker/Inputs/visibility.ll +++ b/test/Linker/Inputs/visibility.ll @@ -7,9 +7,9 @@ $c1 = comdat any @v4 = hidden global i32 1, comdat($c1) ; Aliases -@a1 = weak hidden alias i32* @v1 -@a2 = weak protected alias i32* @v2 -@a3 = weak hidden alias i32* @v3 +@a1 = weak hidden alias i32, i32* @v1 +@a2 = weak protected alias i32, i32* @v2 +@a3 = weak hidden alias i32, i32* @v3 ; Functions define weak hidden void @f1() { diff --git a/test/Linker/alias.ll b/test/Linker/alias.ll index bce51ad9836f..ae9da70174e8 100644 --- a/test/Linker/alias.ll +++ b/test/Linker/alias.ll @@ -1,16 +1,37 @@ -; RUN: llvm-link %s %S/Inputs/alias.ll -S -o - | FileCheck %s -; RUN: llvm-link %S/Inputs/alias.ll %s -S -o - | FileCheck %s +; RUN: llvm-link %s %S/Inputs/alias.ll -S -o - | FileCheck --check-prefix=C1 %s +; RUN: llvm-link %S/Inputs/alias.ll %s -S -o - | FileCheck --check-prefix=C2 %s + +; FIXME: +; The C1 direction is incorrect. +; When moving an alias to an existing module and we want to discard the aliasee +; (the C2 case), the IRMover knows to copy the aliasee as internal. +; When moving a replacement to an aliasee to a module that has an alias (C1), +; a replace all uses with blindly changes the alias. +; The C1 case doesn't happen when using a system linker with a plugin because +; the linker does full symbol resolution first. +; Given that this is a problem only with llvm-link and its 1 module at a time +; linking, it should probably learn to changes the aliases in the destination +; before using the IRMover. @foo = weak global i32 0 -; CHECK-DAG: @foo = alias i32* @zed +; C1-DAG: @foo = alias i32, i32* @zed +; C2-DAG: @foo = alias i32, i32* @zed + +@bar = alias i32, i32* @foo +; C1-DAG: @bar = alias i32, i32* @foo -@bar = alias i32* @foo -; CHECK-DAG: @bar = alias i32* @foo +; C2-DAG: @foo.1 = internal global i32 0 +; C2-DAG: @bar = alias i32, i32* @foo.1 @foo2 = weak global i32 0 -; CHECK-DAG: @foo2 = alias bitcast (i32* @zed to i16*) +; C1-DAG: @foo2 = alias i16, bitcast (i32* @zed to i16*) +; C2-DAG: @foo2 = alias i16, bitcast (i32* @zed to i16*) + +@bar2 = alias i32, i32* @foo2 +; C1-DAG: @bar2 = alias i32, bitcast (i16* @foo2 to i32*) -@bar2 = alias i32* @foo2 -; CHECK-DAG: @bar2 = alias bitcast (i16* @foo2 to i32*) +; C2-DAG: @foo2.2 = internal global i32 0 +; C2-DAG: @bar2 = alias i32, i32* @foo2.2 -; CHECK-DAG: @zed = global i32 42 +; C1-DAG: @zed = global i32 42 +; C2-DAG: @zed = global i32 42 diff --git a/test/Linker/available_externally_over_decl.ll b/test/Linker/available_externally_over_decl.ll new file mode 100644 index 000000000000..0104967ef544 --- /dev/null +++ b/test/Linker/available_externally_over_decl.ll @@ -0,0 +1,15 @@ +; RUN: llvm-link -S %s %p/Inputs/available_externally_over_decl.ll | FileCheck %s + +declare void @f() + +define available_externally void @g() { + ret void +} + +define void ()* @main() { + call void @g() + ret void ()* @f +} + +; CHECK-DAG: define available_externally void @g() { +; CHECK-DAG: define available_externally void @f() { diff --git a/test/Linker/comdat11.ll b/test/Linker/comdat11.ll new file mode 100644 index 000000000000..dbade4104fe3 --- /dev/null +++ b/test/Linker/comdat11.ll @@ -0,0 +1,13 @@ +; RUN: llvm-link -S %s %p/Inputs/comdat11.ll -o - | FileCheck %s + +$foo = comdat any +@foo = global i8 0, comdat + +; CHECK: @foo = global i8 0, comdat + +; CHECK: define void @zed() { +; CHECK: call void @bar() +; CHECK: ret void +; CHECK: } + +; CHECK: declare void @bar() diff --git a/test/Linker/comdat12.ll b/test/Linker/comdat12.ll new file mode 100644 index 000000000000..d06e222b63ac --- /dev/null +++ b/test/Linker/comdat12.ll @@ -0,0 +1,8 @@ +; RUN: llvm-link %s -S -o - | FileCheck %s + +$foo = comdat largest +define internal void @foo() comdat($foo) { + ret void +} + +; CHECK-NOT: foo diff --git a/test/Linker/comdat13.ll b/test/Linker/comdat13.ll new file mode 100644 index 000000000000..d1e382a2f278 --- /dev/null +++ b/test/Linker/comdat13.ll @@ -0,0 +1,30 @@ +; RUN: llvm-link -S %s %p/Inputs/comdat13.ll -o - | FileCheck %s + +; In Inputs/comdat13.ll a function not in the $foo comdat (zed) references an +; internal function in the comdat $foo. +; The IR would be ilegal on ELF ("relocation refers to discarded section"), +; but COFF linkers seem to just duplicate the comdat. + +$foo = comdat any +@foo = internal global i8 0, comdat +define i8* @bar() { + ret i8* @foo +} + +; CHECK: $foo = comdat any + +; CHECK: @foo = internal global i8 0, comdat +; CHECK: @foo.1 = internal global i8 1, comdat($foo) + +; CHECK: define i8* @bar() { +; CHECK-NEXT: ret i8* @foo +; CHECK-NEXT: } + +; CHECK: define i8* @zed() { +; CHECK-NEXT: call void @bax() +; CHECK-NEXT: ret i8* @foo.1 +; CHECK-NEXT: } + +; CHECK: define internal void @bax() comdat($foo) { +; CHECK-NEXT: ret void +; CHECK-NEXT: } diff --git a/test/Linker/comdat14.ll b/test/Linker/comdat14.ll new file mode 100644 index 000000000000..793f8573a1f5 --- /dev/null +++ b/test/Linker/comdat14.ll @@ -0,0 +1,9 @@ +; RUN: llvm-link -S %s %p/Inputs/comdat14.ll -o - | FileCheck %s + +$c = comdat any + +@v = global i32 0, comdat ($c) + +; CHECK: @v = global i32 0, comdat($c) +; CHECK: @v2 = extern_weak dllexport global i32 +; CHECK: @v3 = extern_weak global i32 diff --git a/test/Linker/comdat15.ll b/test/Linker/comdat15.ll new file mode 100644 index 000000000000..cf900263105a --- /dev/null +++ b/test/Linker/comdat15.ll @@ -0,0 +1,9 @@ +; RUN: llvm-link -S %s %p/Inputs/comdat15.ll -o - | FileCheck %s + +$a1 = comdat any +@bar = global i32 0, comdat($a1) + +; CHECK: @bar = global i32 0, comdat($a1) +; CHECK: @baz = private global i32 42, comdat($a1) +; CHECK: @a1 = internal alias i32, i32* @baz + diff --git a/test/Linker/comdat6.ll b/test/Linker/comdat6.ll index 15be2fe58036..3dcc9e3b29d7 100644 --- a/test/Linker/comdat6.ll +++ b/test/Linker/comdat6.ll @@ -5,6 +5,6 @@ target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32" $foo = comdat largest @foo = linkonce_odr unnamed_addr constant [1 x i8*] [i8* bitcast (void ()* @bar to i8*)], comdat($foo) -; CHECK: @foo = alias getelementptr inbounds ([2 x i8*], [2 x i8*]* @some_name, i32 0, i32 1) +; CHECK: @foo = alias i8*, getelementptr inbounds ([2 x i8*], [2 x i8*]* @some_name, i32 0, i32 1) declare void @bar() unnamed_addr diff --git a/test/Linker/comdat8.ll b/test/Linker/comdat8.ll index 5ca352a85099..490f8053c550 100644 --- a/test/Linker/comdat8.ll +++ b/test/Linker/comdat8.ll @@ -3,6 +3,6 @@ $c1 = comdat largest @some_name = private unnamed_addr constant i32 42, comdat($c1) -@c1 = alias i8* inttoptr (i32 ptrtoint (i32* @some_name to i32) to i8*) +@c1 = alias i8, inttoptr (i32 ptrtoint (i32* @some_name to i32) to i8*) ; CHECK: COMDAT key involves incomputable alias size. diff --git a/test/Linker/comdat9.ll b/test/Linker/comdat9.ll index f155a6e35626..4f6f2cfb845d 100644 --- a/test/Linker/comdat9.ll +++ b/test/Linker/comdat9.ll @@ -1,19 +1,22 @@ ; RUN: llvm-link %s -S -o - | FileCheck %s $c = comdat any -@a = alias void ()* @f +@a = alias void (), void ()* @f define internal void @f() comdat($c) { ret void } ; CHECK-DAG: $c = comdat any -; CHECK-DAG: @a = alias void ()* @f +; CHECK-DAG: @a = alias void (), void ()* @f ; CHECK-DAG: define internal void @f() comdat($c) $f2 = comdat largest define internal void @f2() comdat($f2) { ret void } +define void @f3() comdat($f2) { + ret void +} ; CHECK-DAG: $f2 = comdat largest ; CHECK-DAG: define internal void @f2() comdat { diff --git a/test/Linker/comdat_group.ll b/test/Linker/comdat_group.ll new file mode 100644 index 000000000000..486a6ffb9b1d --- /dev/null +++ b/test/Linker/comdat_group.ll @@ -0,0 +1,18 @@ +; Ensure complete comdat group is materialized +; RUN: llvm-link %s -S | FileCheck %s +; CHECK: $linkoncecomdat = comdat any +; CHECK: @linkoncecomdat = linkonce global i32 2 +; CHECK: @linkoncecomdat_unref_var = linkonce global i32 2, comdat($linkoncecomdat) +; CHECK: define linkonce void @linkoncecomdat_unref_func() comdat($linkoncecomdat) + +$linkoncecomdat = comdat any +@linkoncecomdat = linkonce global i32 2, comdat($linkoncecomdat) +@linkoncecomdat_unref_var = linkonce global i32 2, comdat($linkoncecomdat) +define linkonce void @linkoncecomdat_unref_func() comdat($linkoncecomdat) { + ret void +} +; Reference one member of comdat so that comdat is generated. +define void @ref_linkoncecomdat() { + load i32, i32* @linkoncecomdat, align 4 + ret void +} diff --git a/test/Linker/constructor-comdat.ll b/test/Linker/constructor-comdat.ll index dfc899208aa3..e62990157a96 100644 --- a/test/Linker/constructor-comdat.ll +++ b/test/Linker/constructor-comdat.ll @@ -4,8 +4,8 @@ $_ZN3fooIiEC5Ev = comdat any ; CHECK: $_ZN3fooIiEC5Ev = comdat any -@_ZN3fooIiEC1Ev = weak_odr alias void ()* @_ZN3fooIiEC2Ev -; CHECK: @_ZN3fooIiEC1Ev = weak_odr alias void ()* @_ZN3fooIiEC2Ev +@_ZN3fooIiEC1Ev = weak_odr alias void (), void ()* @_ZN3fooIiEC2Ev +; CHECK: @_ZN3fooIiEC1Ev = weak_odr alias void (), void ()* @_ZN3fooIiEC2Ev ; CHECK: define weak_odr void @_ZN3fooIiEC2Ev() comdat($_ZN3fooIiEC5Ev) { define weak_odr void @_ZN3fooIiEC2Ev() comdat($_ZN3fooIiEC5Ev) { diff --git a/test/Linker/ctors.ll b/test/Linker/ctors.ll index 67bf45637180..37dba23d4c91 100644 --- a/test/Linker/ctors.ll +++ b/test/Linker/ctors.ll @@ -3,6 +3,9 @@ ; RUN: llvm-link %p/Inputs/ctors.ll %s -S -o - | \ ; RUN: FileCheck --check-prefix=ALL --check-prefix=CHECK2 %s +; Test the bitcode writer too. It used to crash. +; RUN: llvm-link %s %p/Inputs/ctors.ll -o %t.bc + @v = weak global i8 0 ; CHECK1: @v = weak global i8 0 ; CHECK2: @v = weak global i8 1 diff --git a/test/Linker/ctors2.ll b/test/Linker/ctors2.ll new file mode 100644 index 000000000000..9b7a70eb7cd1 --- /dev/null +++ b/test/Linker/ctors2.ll @@ -0,0 +1,7 @@ +; RUN: llvm-link -S %s %p/Inputs/ctors2.ll -o - | FileCheck %s + +$foo = comdat any +@foo = global i8 0, comdat + +; CHECK: @foo = global i8 0, comdat +; CHECK: @llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer diff --git a/test/Linker/ctors3.ll b/test/Linker/ctors3.ll new file mode 100644 index 000000000000..e62b92dca0b4 --- /dev/null +++ b/test/Linker/ctors3.ll @@ -0,0 +1,8 @@ +; RUN: llvm-link -S %s %p/Inputs/ctors3.ll -o - | FileCheck %s + +$foo = comdat any +%t = type { i8 } +@foo = global %t zeroinitializer, comdat + +; CHECK: @foo = global %t zeroinitializer, comdat +; CHECK: @llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer diff --git a/test/Linker/ctors4.ll b/test/Linker/ctors4.ll new file mode 100644 index 000000000000..c4500841f174 --- /dev/null +++ b/test/Linker/ctors4.ll @@ -0,0 +1,14 @@ +; RUN: llvm-link -S %s -o - | FileCheck %s + +define void @f() { + ret void +} + +; We lazy link @v, which causes llvm.global_ctors to have the corresponding +; entry. +@v = linkonce global i8 42 + +@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @f, i8* @v }] + +; CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @f, i8* @v }] + diff --git a/test/Linker/ctors5.ll b/test/Linker/ctors5.ll new file mode 100644 index 000000000000..99124061bb32 --- /dev/null +++ b/test/Linker/ctors5.ll @@ -0,0 +1,8 @@ +; RUN: llvm-link -S %s | FileCheck %s + +@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @f }] +; CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @f, i8* null }] + +define void @f() { + ret void +} diff --git a/test/Linker/debug-info-version-a.ll b/test/Linker/debug-info-version-a.ll index 8cc85b167f71..43f374ff5b00 100644 --- a/test/Linker/debug-info-version-a.ll +++ b/test/Linker/debug-info-version-a.ll @@ -11,6 +11,6 @@ !llvm.dbg.cu = !{!1} !0 = !{i32 2, !"Debug Info Version", i32 3} -!1 = !DICompileUnit(language: DW_LANG_C99, producer: "clang", isOptimized: true, emissionKind: 0, file: !2, enums: !3, retainedTypes: !3, subprograms: !3) +!1 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang", isOptimized: true, emissionKind: 0, file: !2, enums: !3, retainedTypes: !3, subprograms: !3) !2 = !DIFile(filename: "a.c", directory: "") !3 = !{} diff --git a/test/Linker/debug-info-version-b.ll b/test/Linker/debug-info-version-b.ll index b2452f437023..e3ef814e3a5a 100644 --- a/test/Linker/debug-info-version-b.ll +++ b/test/Linker/debug-info-version-b.ll @@ -5,6 +5,6 @@ !llvm.dbg.cu = !{!1} !0 = !{i32 2, !"Debug Info Version", i32 42} -!1 = !DICompileUnit(language: DW_LANG_C99, producer: "clang", isOptimized: false, file: !"I AM UNEXPECTED!") +!1 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang", isOptimized: false, file: !"I AM UNEXPECTED!") !2 = !{!"b.c", !""} !3 = !{} diff --git a/test/Linker/distinct.ll b/test/Linker/distinct.ll index c8e5c89eb095..d88d8ae16d9a 100644 --- a/test/Linker/distinct.ll +++ b/test/Linker/distinct.ll @@ -6,6 +6,8 @@ ; CHECK: @global = linkonce global i32 0 @global = linkonce global i32 0 +; Add an external reference to @global so that it gets linked in. +@alias = alias i32, i32* @global ; CHECK: !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !0, !1, !2, !9, !10, !11, !12, !13, !14} !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8} diff --git a/test/Linker/drop-debug.ll b/test/Linker/drop-debug.ll index 9c1072a75de2..06689872e12c 100644 --- a/test/Linker/drop-debug.ll +++ b/test/Linker/drop-debug.ll @@ -3,4 +3,4 @@ ;; drop-debug.bc was created from "void f(void) {}" with clang 3.5 and ; -gline-tables-only, so it contains old debug info. -; CHECK: warning: ignoring debug info with an invalid version (1) in {{.*}}/Inputs/drop-debug.bc +; CHECK: WARNING: ignoring debug info with an invalid version (1) in {{.*}}/Inputs/drop-debug.bc diff --git a/test/Linker/funcimport.ll b/test/Linker/funcimport.ll new file mode 100644 index 000000000000..38deafd3e3f1 --- /dev/null +++ b/test/Linker/funcimport.ll @@ -0,0 +1,195 @@ +; First ensure that the ThinLTO handling in llvm-link and llvm-lto handles +; bitcode without function summary sections gracefully. +; RUN: llvm-as %s -o %t.bc +; RUN: llvm-as %p/Inputs/funcimport.ll -o %t2.bc +; RUN: llvm-link %t.bc -functionindex=%t.bc -S +; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc + +; Do setup work for all below tests: generate bitcode and combined index +; RUN: llvm-as -function-summary %s -o %t.bc +; RUN: llvm-as -function-summary %p/Inputs/funcimport.ll -o %t2.bc +; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc + +; Ensure statics are promoted/renamed correctly from this file (all but +; constant variable need promotion). +; RUN: llvm-link %t.bc -functionindex=%t3.thinlto.bc -S | FileCheck %s --check-prefix=EXPORTSTATIC +; EXPORTSTATIC-DAG: @staticvar.llvm.1 = hidden global +; EXPORTSTATIC-DAG: @staticconstvar = internal unnamed_addr constant +; EXPORTSTATIC-DAG: @P.llvm.1 = hidden global void ()* null +; EXPORTSTATIC-DAG: define hidden i32 @staticfunc.llvm.1 +; EXPORTSTATIC-DAG: define hidden void @staticfunc2.llvm.1 + +; Ensure that both weak alias to an imported function and strong alias to a +; non-imported function are correctly turned into declarations. +; Also ensures that alias to a linkonce function is turned into a declaration +; and that the associated linkonce function is not in the output, as it is +; lazily linked and never referenced/materialized. +; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=globalfunc1:%t.bc -S | FileCheck %s --check-prefix=IMPORTGLOB1 +; IMPORTGLOB1-DAG: define available_externally void @globalfunc1 +; IMPORTGLOB1-DAG: declare void @weakalias +; IMPORTGLOB1-DAG: declare void @analias +; IMPORTGLOB1-NOT: @linkoncealias +; IMPORTGLOB1-NOT: @linkoncefunc +; IMPORTGLOB1-NOT: declare void @globalfunc2 + +; Ensure that weak alias to a non-imported function is correctly +; turned into a declaration, but that strong alias to an imported function +; is imported as alias. +; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=globalfunc2:%t.bc -S | FileCheck %s --check-prefix=IMPORTGLOB2 +; IMPORTGLOB2-DAG: declare void @analias +; IMPORTGLOB2-DAG: define available_externally void @globalfunc2 +; IMPORTGLOB2-DAG: declare void @weakalias +; IMPORTGLOB2-NOT: declare void @globalfunc1 + +; Ensure that strong alias imported in second pass of importing ends up +; as an alias. +; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=globalfunc1:%t.bc -import=globalfunc2:%t.bc -S | FileCheck %s --check-prefix=IMPORTGLOB3 +; IMPORTGLOB3-DAG: declare void @analias +; IMPORTGLOB3-DAG: define available_externally void @globalfunc1 +; IMPORTGLOB3-DAG: define available_externally void @globalfunc2 +; IMPORTGLOB3-DAG: declare void @weakalias + +; Ensure that strong alias imported in first pass of importing ends up +; as an alias, and that seeing the alias definition during a second inlining +; pass is handled correctly. +; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=globalfunc2:%t.bc -import=globalfunc1:%t.bc -S | FileCheck %s --check-prefix=IMPORTGLOB4 +; IMPORTGLOB4-DAG: declare void @analias +; IMPORTGLOB4-DAG: define available_externally void @globalfunc2 +; IMPORTGLOB4-DAG: define available_externally void @globalfunc1 +; IMPORTGLOB4-DAG: declare void @weakalias + +; An alias to an imported function is imported as alias if the function is not +; available_externally. +; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=linkoncefunc:%t.bc -S | FileCheck %s --check-prefix=IMPORTGLOB5 +; IMPORTGLOB5-DAG: linkoncealias = alias void (...), bitcast (void ()* @linkoncefunc to void (...)*) +; IMPORTGLOB5-DAG: define linkonce_odr void @linkoncefunc() + +; Ensure that imported static variable and function references are correctly +; promoted and renamed (including static constant variable). +; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=referencestatics:%t.bc -S | FileCheck %s --check-prefix=IMPORTSTATIC +; IMPORTSTATIC-DAG: @staticvar.llvm.1 = available_externally hidden global +; IMPORTSTATIC-DAG: @staticconstvar.llvm.1 = internal unnamed_addr constant +; IMPORTSTATIC-DAG: define available_externally i32 @referencestatics +; IMPORTSTATIC-DAG: %call = call i32 @staticfunc.llvm.1 +; IMPORTSTATIC-DAG: %0 = load i32, i32* @staticvar.llvm.1 +; IMPORTSTATIC-DAG: declare hidden i32 @staticfunc.llvm.1 + +; Ensure that imported global (external) function and variable references +; are handled correctly (including referenced variable imported as +; available_externally definition) +; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=referenceglobals:%t.bc -S | FileCheck %s --check-prefix=IMPORTGLOBALS +; IMPORTGLOBALS-DAG: @globalvar = available_externally global +; IMPORTGLOBALS-DAG: declare void @globalfunc1() +; IMPORTGLOBALS-DAG: define available_externally i32 @referenceglobals + +; Ensure that common variable correctly imported as common defition. +; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=referencecommon:%t.bc -S | FileCheck %s --check-prefix=IMPORTCOMMON +; IMPORTCOMMON-DAG: @commonvar = common global +; IMPORTCOMMON-DAG: define available_externally i32 @referencecommon + +; Ensure that imported static function pointer correctly promoted and renamed. +; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=callfuncptr:%t.bc -S | FileCheck %s --check-prefix=IMPORTFUNCPTR +; IMPORTFUNCPTR-DAG: @P.llvm.1 = available_externally hidden global void ()* null +; IMPORTFUNCPTR-DAG: define available_externally void @callfuncptr +; IMPORTFUNCPTR-DAG: %0 = load void ()*, void ()** @P.llvm.1 + +; Ensure that imported weak function reference/definition handled properly. +; Imported weak_any definition should be skipped with warning, and imported +; reference should turned into an external_weak declaration. +; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=callweakfunc:%t.bc -import=weakfunc:%t.bc -S 2>&1 | FileCheck %s --check-prefix=IMPORTWEAKFUNC +; IMPORTWEAKFUNC-DAG: Ignoring import request for weak-any function weakfunc +; IMPORTWEAKFUNC-DAG: declare extern_weak void @weakfunc +; IMPORTWEAKFUNC-DAG: define available_externally void @callweakfunc +; IMPORTWEAKFUNC-NOT: @weakvar = extern_weak global i32, align 4 + +@globalvar = global i32 1, align 4 +@staticvar = internal global i32 1, align 4 +@staticconstvar = internal unnamed_addr constant [2 x i32] [i32 10, i32 20], align 4 +@commonvar = common global i32 0, align 4 +@P = internal global void ()* null, align 8 + +@weakalias = weak alias void (...), bitcast (void ()* @globalfunc1 to void (...)*) +@analias = alias void (...), bitcast (void ()* @globalfunc2 to void (...)*) +@linkoncealias = alias void (...), bitcast (void ()* @linkoncefunc to void (...)*) + +define void @globalfunc1() #0 { +entry: + ret void +} + +define void @globalfunc2() #0 { +entry: + ret void +} + +define linkonce_odr void @linkoncefunc() #0 { +entry: + ret void +} + +define i32 @referencestatics(i32 %i) #0 { +entry: + %i.addr = alloca i32, align 4 + store i32 %i, i32* %i.addr, align 4 + %call = call i32 @staticfunc() + %0 = load i32, i32* @staticvar, align 4 + %add = add nsw i32 %call, %0 + %1 = load i32, i32* %i.addr, align 4 + %idxprom = sext i32 %1 to i64 + %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* @staticconstvar, i64 0, i64 %idxprom + %2 = load i32, i32* %arrayidx, align 4 + %add1 = add nsw i32 %add, %2 + ret i32 %add1 +} + +define i32 @referenceglobals(i32 %i) #0 { +entry: + %i.addr = alloca i32, align 4 + store i32 %i, i32* %i.addr, align 4 + call void @globalfunc1() + %0 = load i32, i32* @globalvar, align 4 + ret i32 %0 +} + +define i32 @referencecommon(i32 %i) #0 { +entry: + %i.addr = alloca i32, align 4 + store i32 %i, i32* %i.addr, align 4 + %0 = load i32, i32* @commonvar, align 4 + ret i32 %0 +} + +define void @setfuncptr() #0 { +entry: + store void ()* @staticfunc2, void ()** @P, align 8 + ret void +} + +define void @callfuncptr() #0 { +entry: + %0 = load void ()*, void ()** @P, align 8 + call void %0() + ret void +} + +@weakvar = weak global i32 1, align 4 +define weak void @weakfunc() #0 { +entry: + ret void +} + +define void @callweakfunc() #0 { +entry: + call void @weakfunc() + ret void +} + +define internal i32 @staticfunc() #0 { +entry: + ret i32 1 +} + +define internal void @staticfunc2() #0 { +entry: + ret void +} diff --git a/test/Linker/funcimport_appending_global.ll b/test/Linker/funcimport_appending_global.ll new file mode 100644 index 000000000000..190d31ee8c7f --- /dev/null +++ b/test/Linker/funcimport_appending_global.ll @@ -0,0 +1,20 @@ +; RUN: llvm-as -function-summary %s -o %t.bc +; RUN: llvm-as -function-summary %p/Inputs/funcimport_appending_global.ll -o %t2.bc +; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc + +; Do the import now +; RUN: llvm-link %t.bc -functionindex=%t3.thinlto.bc -import=foo:%t2.bc -S | FileCheck %s + +; Ensure that global constructor (appending linkage) is not imported +; CHECK-NOT: @llvm.global_ctors = {{.*}}@foo + +declare void @f() +@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @f, i8* null}] + +define i32 @main() { +entry: + call void @foo() + ret i32 0 +} + +declare void @foo() diff --git a/test/Linker/global_ctors.ll b/test/Linker/global_ctors.ll index 49df81a00759..cc28471df59d 100644 --- a/test/Linker/global_ctors.ll +++ b/test/Linker/global_ctors.ll @@ -1,6 +1,5 @@ -; RUN: llvm-as %s -o %t.new.bc -; RUN: llvm-link %t.new.bc %S/Inputs/old_global_ctors.3.4.bc | llvm-dis | FileCheck %s -; RUN: llvm-link %S/Inputs/old_global_ctors.3.4.bc %t.new.bc | llvm-dis | FileCheck %s +; RUN: llvm-link -S %s %S/Inputs/old_global_ctors.3.4.bc | FileCheck %s +; RUN: llvm-link -S %S/Inputs/old_global_ctors.3.4.bc %s | FileCheck %s ; old_global_ctors.3.4.bc contains the following LLVM IL, assembled into ; bitcode by llvm-as from 3.4. It uses a two element @llvm.global_ctors array. diff --git a/test/Linker/internalize-lazy.ll b/test/Linker/internalize-lazy.ll new file mode 100644 index 000000000000..480335927b51 --- /dev/null +++ b/test/Linker/internalize-lazy.ll @@ -0,0 +1,4 @@ +; RUN: llvm-link -S -internalize %s %p/Inputs/internalize-lazy.ll | FileCheck %s + +; CHECK: define internal void @f +; CHECK: define internal void @g diff --git a/test/Linker/link-flags.ll b/test/Linker/link-flags.ll new file mode 100644 index 000000000000..c901b699575a --- /dev/null +++ b/test/Linker/link-flags.ll @@ -0,0 +1,19 @@ +; RUN: llvm-link -S %S/Inputs/linkage.b.ll %S/Inputs/linkage.c.ll | FileCheck %s -check-prefix=B -check-prefix=C -check-prefix=CU +; RUN: llvm-link -S -only-needed %S/Inputs/linkage.b.ll %S/Inputs/linkage.c.ll | FileCheck %s -check-prefix=B -check-prefix=C -check-prefix=CN +; RUN: llvm-link -S -internalize %S/Inputs/linkage.b.ll %S/Inputs/linkage.c.ll | FileCheck %s -check-prefix=B -check-prefix=CI +; RUN: llvm-link -S -internalize -only-needed %S/Inputs/linkage.b.ll %S/Inputs/linkage.c.ll | FileCheck %s -check-prefix=B -check-prefix=CN + +C-LABEL: @X = global i32 5 +CI-LABEL: @X = internal global i32 5 +CU-LABEL:@U = global i32 6 +CI-LABEL:@U = internal global i32 6 +CN-NOT:@U + +B-LABEL: define void @bar() { + +C-LABEL: define i32 @foo() +CI-LABEL: define internal i32 @foo() + +CU-LABEL:define i32 @unused() { +CI-LABEL:define internal i32 @unused() { +CN-NOT:@unused() diff --git a/test/Linker/mdlocation.ll b/test/Linker/mdlocation.ll index 9acc6701599b..b42058bac60e 100644 --- a/test/Linker/mdlocation.ll +++ b/test/Linker/mdlocation.ll @@ -2,33 +2,25 @@ ; Test that DILocations are remapped properly. -; CHECK: !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !0, !1, !2, !3, !10, !11, !12, !13, !14, !15} -!named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9} +; CHECK: !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10, !11} +!named = !{!0, !1, !2, !3, !4, !5} -; CHECK: !0 = !DISubprogram( +; CHECK: !0 = distinct !DISubprogram( ; CHECK-NEXT: !1 = !DILocation(line: 3, column: 7, scope: !0) ; CHECK-NEXT: !2 = !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !1) ; CHECK-NEXT: !3 = !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !2) -; CHECK-NEXT: !4 = distinct !DISubprogram( -; CHECK-NEXT: !5 = !DILocation(line: 3, column: 7, scope: !4) -; CHECK-NEXT: !6 = !DILocation(line: 3, column: 7, scope: !4, inlinedAt: !5) -; CHECK-NEXT: !7 = !DILocation(line: 3, column: 7, scope: !4, inlinedAt: !6) -; CHECK-NEXT: !8 = distinct !DILocation(line: 3, column: 7, scope: !0) -; CHECK-NEXT: !9 = distinct !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !8) -; CHECK-NEXT: !10 = distinct !DISubprogram( -; CHECK-NEXT: !11 = !DILocation(line: 3, column: 7, scope: !10) -; CHECK-NEXT: !12 = !DILocation(line: 3, column: 7, scope: !10, inlinedAt: !11) -; CHECK-NEXT: !13 = !DILocation(line: 3, column: 7, scope: !10, inlinedAt: !12) -; CHECK-NEXT: !14 = distinct !DILocation(line: 3, column: 7, scope: !0) -; CHECK-NEXT: !15 = distinct !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !14) -!0 = !DISubprogram() ; Use this as a scope. +; CHECK-NEXT: !4 = distinct !DILocation(line: 3, column: 7, scope: !0) +; CHECK-NEXT: !5 = distinct !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !4) +; CHECK-NEXT: !6 = distinct !DISubprogram( +; CHECK-NEXT: !7 = !DILocation(line: 3, column: 7, scope: !6) +; CHECK-NEXT: !8 = !DILocation(line: 3, column: 7, scope: !6, inlinedAt: !7) +; CHECK-NEXT: !9 = !DILocation(line: 3, column: 7, scope: !6, inlinedAt: !8) +; CHECK-NEXT: !10 = distinct !DILocation(line: 3, column: 7, scope: !6) +; CHECK-NEXT: !11 = distinct !DILocation(line: 3, column: 7, scope: !6, inlinedAt: !10) +!0 = distinct !DISubprogram() ; Use this as a scope. !1 = !DILocation(line: 3, column: 7, scope: !0) !2 = !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !1) !3 = !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !2) -!4 = distinct !DISubprogram() ; Test actual remapping. -!5 = !DILocation(line: 3, column: 7, scope: !4) -!6 = !DILocation(line: 3, column: 7, scope: !4, inlinedAt: !5) -!7 = !DILocation(line: 3, column: 7, scope: !4, inlinedAt: !6) ; Test distinct nodes. -!8 = distinct !DILocation(line: 3, column: 7, scope: !0) -!9 = distinct !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !8) +!4 = distinct !DILocation(line: 3, column: 7, scope: !0) +!5 = distinct !DILocation(line: 3, column: 7, scope: !0, inlinedAt: !4) diff --git a/test/Linker/only-needed-debug-metadata.ll b/test/Linker/only-needed-debug-metadata.ll new file mode 100644 index 000000000000..f327fe03bf48 --- /dev/null +++ b/test/Linker/only-needed-debug-metadata.ll @@ -0,0 +1,49 @@ +; RUN: llvm-as %s -o %t.bc +; RUN: llvm-as %p/Inputs/only-needed-debug-metadata.ll -o %t2.bc + +; Without -only-needed, we need to link in both DISubprogram. +; RUN: llvm-link -S %t2.bc %t.bc | FileCheck %s +; CHECK: distinct !DISubprogram(name: "foo" +; CHECK: distinct !DISubprogram(name: "unused" + +; With -only-needed, we only need to link in foo's DISubprogram. +; RUN: llvm-link -S -only-needed %t2.bc %t.bc | FileCheck %s -check-prefix=ONLYNEEDED +; ONLYNEEDED: distinct !DISubprogram(name: "foo" +; ONLYNEEDED-NOT: distinct !DISubprogram(name: "unused" + +@X = global i32 5 +@U = global i32 6 +@U_linkonce = linkonce_odr hidden global i32 6 +define i32 @foo() !dbg !4 { + ret i32 7, !dbg !20 +} +define i32 @unused() !dbg !10 { + ret i32 8, !dbg !21 +} + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!16, !17} +!llvm.ident = !{!18} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 251407) (llvm/trunk 251401)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3, globals: !13) +!1 = !DIFile(filename: "linkused2.c", directory: "/usr/local/google/home/tejohnson/llvm/tmp") +!2 = !{} +!3 = !{!4, !10} +!4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, variables: !8) +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!8 = !{!9} +!9 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !1, line: 4, type: !7) +!10 = distinct !DISubprogram(name: "unused", scope: !1, file: !1, line: 8, type: !11, isLocal: false, isDefinition: true, scopeLine: 8, isOptimized: true, variables: !2) +!11 = !DISubroutineType(types: !12) +!12 = !{!7} +!13 = !{!14, !15} +!14 = !DIGlobalVariable(name: "X", scope: !0, file: !1, line: 1, type: !7, isLocal: false, isDefinition: true, variable: i32* @X) +!15 = !DIGlobalVariable(name: "U", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, variable: i32* @U) +!16 = !{i32 2, !"Dwarf Version", i32 4} +!17 = !{i32 2, !"Debug Info Version", i32 3} +!18 = !{!"clang version 3.8.0 (trunk 251407) (llvm/trunk 251401)"} +!19 = !DIExpression() +!20 = !DILocation(line: 4, column: 13, scope: !4) +!21 = !DILocation(line: 9, column: 3, scope: !10) diff --git a/test/Linker/only-needed-named-metadata.ll b/test/Linker/only-needed-named-metadata.ll new file mode 100644 index 000000000000..d14b525fa023 --- /dev/null +++ b/test/Linker/only-needed-named-metadata.ll @@ -0,0 +1,65 @@ +; Without -only-needed we should lazy link linkonce globals, and the +; metadata reference should not cause them to be linked. +; RUN: llvm-link -S %S/Inputs/only-needed-named-metadata.ll %S/only-needed-named-metadata.ll | FileCheck %s +; CHECK-NOT:@U_linkonce +; CHECK-NOT:@unused_linkonce() + +; With -only-needed the metadata references should not cause any of the +; otherwise unreferenced globals to be linked. This also ensures that the +; metadata references don't provoke the module linker to create declarations, +; which are illegal for aliases and globals in comdats. +; Note that doing -only-needed with the comdat shown below leads to a only +; part of the comdat group being linked, which is not technically correct. +; RUN: llvm-link -S -only-needed %S/Inputs/only-needed-named-metadata.ll %S/only-needed-named-metadata.ll | FileCheck %s -check-prefix=ONLYNEEDED +; RUN: llvm-link -S -internalize -only-needed %S/Inputs/only-needed-named-metadata.ll %S/only-needed-named-metadata.ll | FileCheck %s -check-prefix=ONLYNEEDED +; ONLYNEEDED-NOT:@U +; ONLYNEEDED-NOT:@U_linkonce +; ONLYNEEDED-NOT:@unused() +; ONLYNEEDED-NOT:@unused_linkonce() +; ONLYNEEDED-NOT:@linkoncealias +; ONLYNEEDED-NOT:@linkoncefunc2() +; ONLYNEEDED-NOT:@weakalias +; ONLYNEEDED-NOT:@globalfunc1() +; ONLYNEEDED-NOT:@analias +; ONLYNEEDED-NOT:@globalfunc2() + +; Test -only-needed link with the modules preserved instead of freeing to +; catch any cross-module references to metadata, which the bitcode writer +; will assert on. +; RUN: llvm-link -preserve-modules -o %t3.bc -only-needed %S/Inputs/only-needed-named-metadata.ll %S/only-needed-named-metadata.ll + +@X = global i32 5 +@U = global i32 6 +@U_linkonce = linkonce_odr hidden global i32 6 +define i32 @foo() { ret i32 7 } +define i32 @unused() { ret i32 8 } +define linkonce_odr hidden i32 @unused_linkonce() { ret i32 8 } +@linkoncealias = alias void (...), bitcast (void ()* @linkoncefunc2 to void (...)*) + +@weakalias = weak alias void (...), bitcast (void ()* @globalfunc1 to void (...)*) +@analias = alias void (...), bitcast (void ()* @globalfunc2 to void (...)*) + +define void @globalfunc1() #0 { +entry: + ret void +} + +define void @globalfunc2() #0 { +entry: + ret void +} + +$linkoncefunc2 = comdat any +define linkonce_odr void @linkoncefunc2() #0 comdat { +entry: + ret void +} + +!llvm.named = !{!0, !1, !2, !3, !4, !5, !6} +!0 = !{i32 ()* @unused} +!1 = !{i32* @U} +!2 = !{i32 ()* @unused_linkonce} +!3 = !{i32* @U_linkonce} +!4 = !{void (...)* @weakalias} +!5 = !{void (...)* @analias} +!6 = !{void (...)* @linkoncealias} diff --git a/test/Linker/opaque.ll b/test/Linker/opaque.ll index 4f3f398f8f1b..6fd1ae90d4f4 100644 --- a/test/Linker/opaque.ll +++ b/test/Linker/opaque.ll @@ -19,3 +19,7 @@ %C = type { %A } @g1 = external global %B + +define %B* @use_g1() { + ret %B* @g1 +} diff --git a/test/Linker/override-with-internal-linkage.ll b/test/Linker/override-with-internal-linkage.ll index d3a794799322..59bd214c204f 100644 --- a/test/Linker/override-with-internal-linkage.ll +++ b/test/Linker/override-with-internal-linkage.ll @@ -3,14 +3,14 @@ ; CHECK-LABEL: define i32 @main( ; CHECK-NEXT: entry: -; CHECK-NEXT: call i32 @foo2( +; CHECK-NEXT: call i32 @foo.2( define i32 @main(i32 %argc, i8** %argv) { entry: %a = call i32 @foo(i32 2) ret i32 %a } -; CHECK-LABEL: define internal i32 @foo2( +; CHECK-LABEL: define internal i32 @foo.2( ; CHECK-NEXT: entry: ; CHECK-NEXT: %add = add nsw i32 %i, %i ; CHECK-NEXT: ret i32 %add diff --git a/test/Linker/pr21494.ll b/test/Linker/pr21494.ll index 8a17233b0eb6..40b57cad3cf5 100644 --- a/test/Linker/pr21494.ll +++ b/test/Linker/pr21494.ll @@ -6,10 +6,10 @@ @g2 = linkonce_odr global i8 0 ; CHECK-NOT: @g2 -@a1 = private alias i8* @g1 +@a1 = private alias i8, i8* @g1 ; CHECK-NOT: @a1 -@a2 = linkonce_odr alias i8* @g2 +@a2 = linkonce_odr alias i8, i8* @g2 ; CHECK-NOT: @a2 define private void @f1() { diff --git a/test/Linker/prologuedata.ll b/test/Linker/prologuedata.ll index 70204fdaacdd..3015d50867e9 100644 --- a/test/Linker/prologuedata.ll +++ b/test/Linker/prologuedata.ll @@ -1,21 +1,21 @@ ; RUN: llvm-link %s -S -o - | FileCheck %s @g1 = global void()* @f2 -; CHECK: @g1 = global void ()* @f2 +; CHECK-DAG: @g1 = global void ()* @f2 @p1 = global i8 42 -; CHECK: @p1 = global i8 42 +; CHECK-DAG: @p1 = global i8 42 @p2 = internal global i8 43 -; CHECK: @p2 = internal global i8 43 +; CHECK-DAG: @p2 = internal global i8 43 define void @f1() prologue i8* @p1 { ret void } -; CHECK: define void @f1() prologue i8* @p1 { +; CHECK-DAG: define void @f1() prologue i8* @p1 { define internal void @f2() prologue i8* @p2 { ret void } -; CHECK: define internal void @f2() prologue i8* @p2 { +; CHECK-DAG: define internal void @f2() prologue i8* @p2 { diff --git a/test/Linker/replaced-function-matches-first-subprogram.ll b/test/Linker/replaced-function-matches-first-subprogram.ll index fc7e653786e6..30b8be992bb5 100644 --- a/test/Linker/replaced-function-matches-first-subprogram.ll +++ b/test/Linker/replaced-function-matches-first-subprogram.ll @@ -15,17 +15,18 @@ %struct.Class = type { i8 } -define i32 @_Z3foov() { +; CHECK: define i32 @_Z3foov(){{.*}} !dbg ![[SP1:[0-9]+]] +define i32 @_Z3foov() !dbg !4 { entry: %tmp = alloca %struct.Class, align 1 %call = call i32 @_ZN5ClassIiE3fooEv(%struct.Class* %tmp), !dbg !14 ret i32 %call, !dbg !14 } -; CHECK: define weak_odr i32 @_ZN5ClassIiE3fooEv(%struct.Class* %this){{.*}}{ +; CHECK: define weak_odr i32 @_ZN5ClassIiE3fooEv(%struct.Class* %this){{.*}} !dbg ![[SP2:[0-9]+]] { ; CHECK-NOT: } ; CHECK: !dbg ![[LOC:[0-9]+]] -define linkonce_odr i32 @_ZN5ClassIiE3fooEv(%struct.Class* %this) align 2 { +define linkonce_odr i32 @_ZN5ClassIiE3fooEv(%struct.Class* %this) align 2 !dbg !7 { entry: %this.addr = alloca %struct.Class*, align 8 store %struct.Class* %this, %struct.Class** %this.addr, align 8 @@ -39,30 +40,28 @@ entry: !llvm.ident = !{!13} ; Extract out the list of subprograms from each compile unit. -; CHECK-DAG: ![[CU1]] = !DICompileUnit({{.*}} subprograms: ![[SPs1:[0-9]+]] -; CHECK-DAG: ![[CU2]] = !DICompileUnit({{.*}} subprograms: ![[SPs2:[0-9]+]] -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 (trunk 224193) (llvm/trunk 224197)", isOptimized: false, emissionKind: 2, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) +; CHECK-DAG: ![[CU1]] = distinct !DICompileUnit({{.*}} subprograms: ![[SPs1:[0-9]+]] +; CHECK-DAG: ![[CU2]] = distinct !DICompileUnit({{.*}} subprograms: ![[SPs2:[0-9]+]] +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 (trunk 224193) (llvm/trunk 224197)", isOptimized: false, emissionKind: 2, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) !1 = !DIFile(filename: "t1.cpp", directory: "/Users/dexonsmith/data/llvm/staging/test/Linker/repro/d1") !2 = !{} ; Extract out each compile unit's single subprogram. The replaced subprogram's ; function should drop to null in the first compile unit. -; CHECK-DAG: ![[SPs1]] = !{![[SP1:[0-9]+]], ![[SP2r:[0-9]+]]} -; CHECK-DAG: ![[SPs2]] = !{![[SP2:[0-9]+]]} +; CHECK-DAG: ![[SPs1]] = !{![[SP1]], ![[SP2r:[0-9]+]]} +; CHECK-DAG: ![[SPs2]] = !{![[SP2]]} !3 = !{!4, !7} -!4 = !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !1, scope: !5, type: !6, function: i32 ()* @_Z3foov, variables: !2) +!4 = distinct !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !1, scope: !5, type: !6, variables: !2) !5 = !DIFile(filename: "t1.cpp", directory: "/Users/dexonsmith/data/llvm/staging/test/Linker/repro/d1") !6 = !DISubroutineType(types: !2) -; Extract out the file from the replaced subprogram. Confirm that each -; subprogram is pointing at the correct function. -; CHECK-DAG: ![[SP1]] = !DISubprogram({{.*}} function: i32 ()* @_Z3foov -; CHECK-DAG: ![[SP2]] = !DISubprogram({{.*}} file: ![[FILE:[0-9]+]],{{.*}} function: i32 (%struct.Class*)* @_ZN5ClassIiE3fooEv +; Extract out the file from the replaced subprogram. +; CHECK-DAG: ![[SP2]] = distinct !DISubprogram({{.*}} file: ![[FILE:[0-9]+]], ; We can't use CHECK-NOT/CHECK-SAME with a CHECK-DAG, so rely on field order to ; prove that there's no function: here. ; CHECK-DAG: ![[SP2r]] = {{.*}}!DISubprogram({{.*}} isOptimized: false, variables: -!7 = !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !8, scope: !9, type: !6, function: i32 (%struct.Class*)* @_ZN5ClassIiE3fooEv, variables: !2) +!7 = distinct !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !8, scope: !9, type: !6, variables: !2) ; The new subprogram should be pointing at the new directory. ; CHECK-DAG: ![[FILE]] = !DIFile(filename: "../t.h", directory: "/Users/dexonsmith/data/llvm/staging/test/Linker/repro/d2") diff --git a/test/Linker/subprogram-linkonce-weak-odr.ll b/test/Linker/subprogram-linkonce-weak-odr.ll deleted file mode 100644 index c1fa0a5adeb5..000000000000 --- a/test/Linker/subprogram-linkonce-weak-odr.ll +++ /dev/null @@ -1,177 +0,0 @@ -; RUN: llvm-link %s %S/Inputs/subprogram-linkonce-weak-odr.ll -S -o %t1 -; RUN: FileCheck %s -check-prefix=LW -check-prefix=CHECK <%t1 -; RUN: llvm-link %S/Inputs/subprogram-linkonce-weak-odr.ll %s -S -o %t2 -; RUN: FileCheck %s -check-prefix=WL -check-prefix=CHECK <%t2 - -; This testcase tests the following flow: -; - File A defines a linkonce_odr version of @foo which has inlined into @bar. -; - File B defines a weak_odr version of @foo (identical definition). -; - Linkage rules state File B version of @foo wins. -; - Debug info for the subprograms of @foo match exactly. Without -; intervention, the same subprogram would show up in both compile units, and -; it would get associated with the compile unit where it was linkonce. -; - @bar has inlined debug info related to the linkonce_odr @foo. -; -; This checks a corner case for the fix for PR22792, where subprograms match -; exactly. It's a companion for subprogram-linkonce-weak.ll. - -; The LW prefix means linkonce (this file) first, then weak (the other file). -; The WL prefix means weak (the other file) first, then linkonce (this file). - -; We'll see @bar before @foo if this file is first. -; LW-LABEL: define i32 @bar( -; LW: %sum = add i32 %a, %b, !dbg ![[FOOINBAR:[0-9]+]] -; LW: ret i32 %sum, !dbg ![[BARRET:[0-9]+]] -; LW-LABEL: define weak_odr i32 @foo( -; LW: %sum = add i32 %a, %b, !dbg ![[FOOADD:[0-9]+]] -; LW: ret i32 %sum, !dbg ![[FOORET:[0-9]+]] - -; We'll see @foo before @bar if this file is second. -; WL-LABEL: define weak_odr i32 @foo( -; WL: %sum = add i32 %a, %b, !dbg ![[FOOADD:[0-9]+]] -; WL: ret i32 %sum, !dbg ![[FOORET:[0-9]+]] -; WL-LABEL: define i32 @bar( -; WL: %sum = add i32 %a, %b, !dbg ![[FOOINBAR:[0-9]+]] -; WL: ret i32 %sum, !dbg ![[BARRET:[0-9]+]] - -define i32 @bar(i32 %a, i32 %b) { -entry: - %sum = add i32 %a, %b, !dbg !DILocation(line: 2, scope: !4, - inlinedAt: !DILocation(line: 12, scope: !3)) - ret i32 %sum, !dbg !DILocation(line: 13, scope: !3) -} - -define linkonce_odr i32 @foo(i32 %a, i32 %b) { -entry: - %sum = add i32 %a, %b, !dbg !DILocation(line: 2, scope: !4) - ret i32 %sum, !dbg !DILocation(line: 3, scope: !4) -} - -!llvm.module.flags = !{!0} -!0 = !{i32 2, !"Debug Info Version", i32 3} - -; CHECK-LABEL: !llvm.dbg.cu = -; LW-SAME: !{![[LCU:[0-9]+]], ![[WCU:[0-9]+]]} -; WL-SAME: !{![[WCU:[0-9]+]], ![[LCU:[0-9]+]]} -!llvm.dbg.cu = !{!1} - -; LW: ![[LCU]] = !DICompileUnit({{.*}} subprograms: ![[LSPs:[0-9]+]] -; LW: ![[LSPs]] = !{![[BARSP:[0-9]+]], ![[FOOSP:[0-9]+]]} -; LW: ![[BARSP]] = !DISubprogram(name: "bar", -; LW-SAME: function: i32 (i32, i32)* @bar -; LW: ![[FOOSP]] = {{.*}}!DISubprogram(name: "foo", -; LW-NOT: function: -; LW-SAME: ){{$}} -; LW: ![[WCU]] = !DICompileUnit({{.*}} subprograms: ![[WSPs:[0-9]+]] -; LW: ![[WSPs]] = !{![[WEAKFOOSP:[0-9]+]]} -; LW: ![[WEAKFOOSP]] = !DISubprogram(name: "foo", -; LW-SAME: function: i32 (i32, i32)* @foo -; LW: ![[FOOINBAR]] = !DILocation(line: 2, scope: ![[FOOSP]], inlinedAt: ![[BARIA:[0-9]+]]) -; LW: ![[BARIA]] = !DILocation(line: 12, scope: ![[BARSP]]) -; LW: ![[BARRET]] = !DILocation(line: 13, scope: ![[BARSP]]) -; LW: ![[FOOADD]] = !DILocation(line: 2, scope: ![[WEAKFOOSP]]) -; LW: ![[FOORET]] = !DILocation(line: 3, scope: ![[WEAKFOOSP]]) - -; Same as above, but reordered. -; WL: ![[WCU]] = !DICompileUnit({{.*}} subprograms: ![[WSPs:[0-9]+]] -; WL: ![[WSPs]] = !{![[WEAKFOOSP:[0-9]+]]} -; WL: ![[WEAKFOOSP]] = !DISubprogram(name: "foo", -; WL-SAME: function: i32 (i32, i32)* @foo -; WL: ![[LCU]] = !DICompileUnit({{.*}} subprograms: ![[LSPs:[0-9]+]] -; Note: for symmetry, LSPs would have a different copy of the subprogram. -; WL: ![[LSPs]] = !{![[BARSP:[0-9]+]], ![[WEAKFOOSP:[0-9]+]]} -; WL: ![[BARSP]] = !DISubprogram(name: "bar", -; WL-SAME: function: i32 (i32, i32)* @bar -; WL: ![[FOOADD]] = !DILocation(line: 2, scope: ![[WEAKFOOSP]]) -; WL: ![[FOORET]] = !DILocation(line: 3, scope: ![[WEAKFOOSP]]) -; WL: ![[FOOINBAR]] = !DILocation(line: 2, scope: ![[WEAKFOOSP]], inlinedAt: ![[BARIA:[0-9]+]]) -; WL: ![[BARIA]] = !DILocation(line: 12, scope: ![[BARSP]]) -; WL: ![[BARRET]] = !DILocation(line: 13, scope: ![[BARSP]]) - -!1 = !DICompileUnit(language: DW_LANG_C99, file: !2, subprograms: !{!3, !4}, emissionKind: 1) -!2 = !DIFile(filename: "bar.c", directory: "/path/to/dir") -!3 = !DISubprogram(file: !2, scope: !2, line: 11, name: "bar", function: i32 (i32, i32)* @bar, type: !6) -!4 = !DISubprogram(file: !5, scope: !5, line: 1, name: "foo", function: i32 (i32, i32)* @foo, type: !6) -!5 = !DIFile(filename: "foo.h", directory: "/path/to/dir") -!6 = !DISubroutineType(types: !{}) - -; Crasher for llc. -; REQUIRES: object-emission -; RUN: %llc_dwarf -filetype=obj -O0 %t1 -o %t1.o -; RUN: llvm-dwarfdump %t1.o -debug-dump=all | FileCheck %s -check-prefix=DWLW -check-prefix=DW -; RUN: %llc_dwarf -filetype=obj -O0 %t2 -o %t2.o -; RUN: llvm-dwarfdump %t2.o -debug-dump=all | FileCheck %s -check-prefix=DWWL -check-prefix=DW -; Check that the debug info puts the subprogram (with PCs) in the correct -; compile unit. - -; DW-LABEL: .debug_info contents: -; DWLW: DW_TAG_compile_unit -; DWLW: DW_AT_name {{.*}}"bar.c" -; Note: If we stop emitting foo here, the comment below for DWWL (and the -; check) should be copied up here. -; DWLW: DW_TAG_subprogram -; DWLW-NOT: DW_AT_low_pc -; DWLW-NOT: DW_AT_high_pc -; DWLW: DW_AT_name {{.*}}foo -; DWLW: DW_AT_decl_file {{.*}}"/path/to/dir{{/|\\}}foo.h" -; DWLW: DW_AT_decl_line {{.*}}(1) -; DWLW: DW_TAG_subprogram -; DWLW: DW_AT_low_pc -; DWLW: DW_AT_high_pc -; DWLW: DW_AT_name {{.*}}bar -; DWLW: DW_AT_decl_file {{.*}}"/path/to/dir{{/|\\}}bar.c" -; DWLW: DW_AT_decl_line {{.*}}(11) -; DWLW: DW_TAG_inlined_subroutine -; DWLW: DW_AT_abstract_origin -; DWLW: DW_TAG_compile_unit -; DWLW: DW_AT_name {{.*}}"foo.c" -; DWLW: DW_TAG_subprogram -; DWLW: DW_AT_low_pc -; DWLW: DW_AT_high_pc -; DWLW: DW_AT_name {{.*}}foo -; DWLW: DW_AT_decl_file {{.*}}"/path/to/dir{{/|\\}}foo.h" -; DWLW: DW_AT_decl_line {{.*}}(1) - -; The DWARF output is already symmetric (just reordered). -; DWWL: DW_TAG_compile_unit -; DWWL: DW_AT_name {{.*}}"foo.c" -; DWWL: DW_TAG_subprogram -; DWWL: DW_AT_low_pc -; DWWL: DW_AT_high_pc -; DWWL: DW_AT_name {{.*}}foo -; DWWL: DW_AT_decl_file {{.*}}"/path/to/dir{{/|\\}}foo.h" -; DWWL: DW_AT_decl_line {{.*}}(1) -; DWWL: DW_TAG_compile_unit -; DWWL: DW_AT_name {{.*}}"bar.c" -; Note: for symmetry, foo would also show up in this compile unit -; (alternatively, it wouldn't show up in the DWLW case). If we start emitting -; foo here, this should be updated by checking that we don't emit low_pc and -; high_pc for it. -; DWWL-NOT: DW_AT_name {{.*}}foo -; DWWL: DW_TAG_subprogram -; DWWL-NOT: DW_AT_name {{.*}}foo -; DWWL: DW_AT_low_pc -; DWWL: DW_AT_high_pc -; DWWL-NOT: DW_AT_name {{.*}}foo -; DWWL: DW_AT_name {{.*}}bar -; DWWL: DW_AT_decl_file {{.*}}"/path/to/dir{{/|\\}}bar.c" -; DWWL: DW_AT_decl_line {{.*}}(11) -; DWWL: DW_TAG_inlined_subroutine -; DWWL: DW_AT_abstract_origin - -; DW-LABEL: .debug_line contents: -; Check that we have the right things in the line table as well. - -; DWLW-LABEL: file_names[{{ *}}1]{{.*}} bar.c -; DWLW-LABEL: file_names[{{ *}}2]{{.*}} foo.h -; DWLW: 2 0 2 0 0 is_stmt prologue_end -; DWLW-LABEL: file_names[{{ *}}1]{{.*}} foo.h -; DWLW: 2 0 1 0 0 is_stmt prologue_end -; DWLW-NOT: prologue_end - -; DWWL-LABEL: file_names[{{ *}}1]{{.*}} foo.h -; DWWL: 2 0 1 0 0 is_stmt prologue_end -; DWWL-LABEL: file_names[{{ *}}1]{{.*}} bar.c -; DWWL-LABEL: file_names[{{ *}}2]{{.*}} foo.h -; DWWL: 2 0 2 0 0 is_stmt prologue_end -; DWWL-NOT: prologue_end diff --git a/test/Linker/subprogram-linkonce-weak.ll b/test/Linker/subprogram-linkonce-weak.ll index 598cea7afeb0..e8bc67765bb8 100644 --- a/test/Linker/subprogram-linkonce-weak.ll +++ b/test/Linker/subprogram-linkonce-weak.ll @@ -2,6 +2,7 @@ ; RUN: FileCheck %s -check-prefix=LW -check-prefix=CHECK <%t1 ; RUN: llvm-link %S/Inputs/subprogram-linkonce-weak.ll %s -S -o %t2 ; RUN: FileCheck %s -check-prefix=WL -check-prefix=CHECK <%t2 +; REQUIRES: default_triple ; This testcase tests the following flow: ; - File A defines a linkonce version of @foo which has inlined into @bar. @@ -16,29 +17,29 @@ ; The WL prefix means weak (the other file) first, then linkonce (this file). ; We'll see @bar before @foo if this file is first. -; LW-LABEL: define i32 @bar( +; LW: define i32 @bar({{.*}} !dbg ![[BARSP:[0-9]+]] ; LW: %sum = add i32 %a, %b, !dbg ![[FOOINBAR:[0-9]+]] ; LW: ret i32 %sum, !dbg ![[BARRET:[0-9]+]] -; LW-LABEL: define weak i32 @foo( +; LW: define weak i32 @foo({{.*}} !dbg ![[WEAKFOOSP:[0-9]+]] ; LW: %sum = call i32 @fastadd(i32 %a, i32 %b), !dbg ![[FOOCALL:[0-9]+]] ; LW: ret i32 %sum, !dbg ![[FOORET:[0-9]+]] ; We'll see @foo before @bar if this file is second. -; WL-LABEL: define weak i32 @foo( +; WL: define weak i32 @foo({{.*}} !dbg ![[WEAKFOOSP:[0-9]+]] ; WL: %sum = call i32 @fastadd(i32 %a, i32 %b), !dbg ![[FOOCALL:[0-9]+]] ; WL: ret i32 %sum, !dbg ![[FOORET:[0-9]+]] -; WL-LABEL: define i32 @bar( +; WL: define i32 @bar({{.*}} !dbg ![[BARSP:[0-9]+]] ; WL: %sum = add i32 %a, %b, !dbg ![[FOOINBAR:[0-9]+]] ; WL: ret i32 %sum, !dbg ![[BARRET:[0-9]+]] -define i32 @bar(i32 %a, i32 %b) { +define i32 @bar(i32 %a, i32 %b) !dbg !3 { entry: %sum = add i32 %a, %b, !dbg !DILocation(line: 2, scope: !4, inlinedAt: !DILocation(line: 12, scope: !3)) ret i32 %sum, !dbg !DILocation(line: 13, scope: !3) } -define linkonce i32 @foo(i32 %a, i32 %b) { +define linkonce i32 @foo(i32 %a, i32 %b) !dbg !4 { entry: %sum = add i32 %a, %b, !dbg !DILocation(line: 2, scope: !4) ret i32 %sum, !dbg !DILocation(line: 3, scope: !4) @@ -52,17 +53,13 @@ entry: ; WL-SAME: !{![[WCU:[0-9]+]], ![[LCU:[0-9]+]]} !llvm.dbg.cu = !{!1} -; LW: ![[LCU]] = !DICompileUnit({{.*}} subprograms: ![[LSPs:[0-9]+]] -; LW: ![[LSPs]] = !{![[BARSP:[0-9]+]], ![[FOOSP:[0-9]+]]} -; LW: ![[BARSP]] = !DISubprogram(name: "bar", -; LW-SAME: function: i32 (i32, i32)* @bar -; LW: ![[FOOSP]] = {{.*}}!DISubprogram(name: "foo", -; LW-NOT: function: -; LW-SAME: ){{$}} -; LW: ![[WCU]] = !DICompileUnit({{.*}} subprograms: ![[WSPs:[0-9]+]] -; LW: ![[WSPs]] = !{![[WEAKFOOSP:[0-9]+]]} -; LW: ![[WEAKFOOSP]] = !DISubprogram(name: "foo", -; LW-SAME: function: i32 (i32, i32)* @foo +; LW: ![[LCU]] = distinct !DICompileUnit({{.*}} subprograms: ![[LSPs:[0-9]+]] +; LW: ![[LSPs]] = !{![[BARSP]], ![[FOOSP:[0-9]+]]} +; LW: ![[BARSP]] = distinct !DISubprogram(name: "bar", +; LW: ![[FOOSP]] = distinct !DISubprogram(name: "foo", +; LW: ![[WCU]] = distinct !DICompileUnit({{.*}} subprograms: ![[WSPs:[0-9]+]] +; LW: ![[WSPs]] = !{![[WEAKFOOSP]]} +; LW: ![[WEAKFOOSP]] = distinct !DISubprogram(name: "foo", ; LW: ![[FOOINBAR]] = !DILocation(line: 2, scope: ![[FOOSP]], inlinedAt: ![[BARIA:[0-9]+]]) ; LW: ![[BARIA]] = !DILocation(line: 12, scope: ![[BARSP]]) ; LW: ![[BARRET]] = !DILocation(line: 13, scope: ![[BARSP]]) @@ -70,27 +67,23 @@ entry: ; LW: ![[FOORET]] = !DILocation(line: 53, scope: ![[WEAKFOOSP]]) ; Same as above, but reordered. -; WL: ![[WCU]] = !DICompileUnit({{.*}} subprograms: ![[WSPs:[0-9]+]] -; WL: ![[WSPs]] = !{![[WEAKFOOSP:[0-9]+]]} -; WL: ![[WEAKFOOSP]] = !DISubprogram(name: "foo", -; WL-SAME: function: i32 (i32, i32)* @foo -; WL: ![[LCU]] = !DICompileUnit({{.*}} subprograms: ![[LSPs:[0-9]+]] +; WL: ![[WCU]] = distinct !DICompileUnit({{.*}} subprograms: ![[WSPs:[0-9]+]] +; WL: ![[WSPs]] = !{![[WEAKFOOSP]]} +; WL: ![[WEAKFOOSP]] = distinct !DISubprogram(name: "foo", +; WL: ![[LCU]] = distinct !DICompileUnit({{.*}} subprograms: ![[LSPs:[0-9]+]] ; WL: ![[LSPs]] = !{![[BARSP:[0-9]+]], ![[FOOSP:[0-9]+]]} -; WL: ![[BARSP]] = !DISubprogram(name: "bar", -; WL-SAME: function: i32 (i32, i32)* @bar -; WL: ![[FOOSP]] = {{.*}}!DISubprogram(name: "foo", -; Note, for symmetry, this should be "NOT: function:" and "SAME: ){{$}}". -; WL-SAME: function: i32 (i32, i32)* @foo +; WL: ![[BARSP]] = distinct !DISubprogram(name: "bar", +; WL: ![[FOOSP]] = distinct !DISubprogram(name: "foo", ; WL: ![[FOOCALL]] = !DILocation(line: 52, scope: ![[WEAKFOOSP]]) ; WL: ![[FOORET]] = !DILocation(line: 53, scope: ![[WEAKFOOSP]]) ; WL: ![[FOOINBAR]] = !DILocation(line: 2, scope: ![[FOOSP]], inlinedAt: ![[BARIA:[0-9]+]]) ; WL: ![[BARIA]] = !DILocation(line: 12, scope: ![[BARSP]]) ; WL: ![[BARRET]] = !DILocation(line: 13, scope: ![[BARSP]]) -!1 = !DICompileUnit(language: DW_LANG_C99, file: !2, subprograms: !{!3, !4}, emissionKind: 1) +!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, subprograms: !{!3, !4}, emissionKind: 1) !2 = !DIFile(filename: "bar.c", directory: "/path/to/dir") -!3 = !DISubprogram(file: !2, scope: !2, line: 11, name: "bar", function: i32 (i32, i32)* @bar, type: !5) -!4 = !DISubprogram(file: !2, scope: !2, line: 1, name: "foo", function: i32 (i32, i32)* @foo, type: !5) +!3 = distinct !DISubprogram(file: !2, scope: !2, line: 11, name: "bar", type: !5) +!4 = distinct !DISubprogram(file: !2, scope: !2, line: 1, name: "foo", type: !5) !5 = !DISubroutineType(types: !{}) ; Crasher for llc. diff --git a/test/Linker/testlink.ll b/test/Linker/testlink.ll index 2e9447ddfd37..6a316a3bf846 100644 --- a/test/Linker/testlink.ll +++ b/test/Linker/testlink.ll @@ -32,6 +32,11 @@ ; CHECK-DAG: @0 = external global i32 @0 = external global i32 + +define i32* @use0() { + ret i32* @0 +} + ; CHECK-DAG: @Inte = global i32 1 @Inte = global i32 1 @@ -43,7 +48,7 @@ ; This should get renamed since there is a definition that is non-internal in ; the other module. -; CHECK-DAG: @Intern2{{[0-9]+}} = internal constant i32 792 +; CHECK-DAG: @Intern2.{{[0-9]+}} = internal constant i32 792 @Intern2 = internal constant i32 792 @UseIntern2 = global i32* @Intern2 @@ -101,4 +106,6 @@ define void @testIntern() { ret void } -declare void @VecSizeCrash(%VecSize) +define void @VecSizeCrash(%VecSize) { + ret void +} diff --git a/test/Linker/thinlto_funcimport_debug.ll b/test/Linker/thinlto_funcimport_debug.ll new file mode 100644 index 000000000000..02f43b24c17a --- /dev/null +++ b/test/Linker/thinlto_funcimport_debug.ll @@ -0,0 +1,80 @@ +; Do setup work for all below tests: generate bitcode and combined index +; RUN: llvm-as -function-summary %s -o %t.bc +; RUN: llvm-as -function-summary %p/Inputs/thinlto_funcimport_debug.ll -o %t2.bc +; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc + +; If we import func1 and not func2 we should only link DISubprogram for func1 +; RUN: llvm-link %t2.bc -functionindex=%t3.thinlto.bc -import=func1:%t.bc -S | FileCheck %s + +; CHECK: declare i32 @func2 +; CHECK: define available_externally i32 @func1 + +; Extract out the list of subprograms from each compile unit and ensure +; that neither contains null. +; CHECK: !{{[0-9]+}} = distinct !DICompileUnit({{.*}} subprograms: ![[SPs1:[0-9]+]] +; CHECK-NOT: ![[SPs1]] = !{{{.*}}null{{.*}}} +; CHECK: !{{[0-9]+}} = distinct !DICompileUnit({{.*}} subprograms: ![[SPs2:[0-9]+]] +; CHECK-NOT: ![[SPs2]] = !{{{.*}}null{{.*}}} + +; CHECK: distinct !DISubprogram(name: "func1" +; CHECK-NOT: distinct !DISubprogram(name: "func2" + + +; ModuleID = 'dbg.o' +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; Function Attrs: nounwind readnone uwtable +define i32 @func1(i32 %n) #0 !dbg !4 { +entry: + tail call void @llvm.dbg.value(metadata i32 %n, i64 0, metadata !9, metadata !17), !dbg !18 + tail call void @llvm.dbg.value(metadata i32 5, i64 0, metadata !10, metadata !17), !dbg !19 + %cmp = icmp sgt i32 %n, 10, !dbg !20 + %. = select i1 %cmp, i32 10, i32 5, !dbg !22 + tail call void @llvm.dbg.value(metadata i32 %., i64 0, metadata !10, metadata !17), !dbg !19 + ret i32 %., !dbg !23 +} + +; Function Attrs: nounwind readnone uwtable +define i32 @func2(i32 %n) #0 !dbg !11 { +entry: + tail call void @llvm.dbg.value(metadata i32 %n, i64 0, metadata !13, metadata !17), !dbg !24 + ret i32 %n, !dbg !25 +} + +; Function Attrs: nounwind readnone +declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 + +attributes #0 = { nounwind readnone uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind readnone } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!14, !15} +!llvm.ident = !{!16} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 251407) (llvm/trunk 251401)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3) +!1 = !DIFile(filename: "dbg.c", directory: ".") +!2 = !{} +!3 = !{!4, !11} +!4 = distinct !DISubprogram(name: "func1", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, variables: !8) +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !7} +!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!8 = !{!9, !10} +!9 = !DILocalVariable(name: "n", arg: 1, scope: !4, file: !1, line: 1, type: !7) +!10 = !DILocalVariable(name: "x", scope: !4, file: !1, line: 2, type: !7) +!11 = distinct !DISubprogram(name: "func2", scope: !1, file: !1, line: 8, type: !5, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true, variables: !12) +!12 = !{!13} +!13 = !DILocalVariable(name: "n", arg: 1, scope: !11, file: !1, line: 8, type: !7) +!14 = !{i32 2, !"Dwarf Version", i32 4} +!15 = !{i32 2, !"Debug Info Version", i32 3} +!16 = !{!"clang version 3.8.0 (trunk 251407) (llvm/trunk 251401)"} +!17 = !DIExpression() +!18 = !DILocation(line: 1, column: 15, scope: !4) +!19 = !DILocation(line: 2, column: 7, scope: !4) +!20 = !DILocation(line: 3, column: 9, scope: !21) +!21 = distinct !DILexicalBlock(scope: !4, file: !1, line: 3, column: 7) +!22 = !DILocation(line: 3, column: 7, scope: !4) +!23 = !DILocation(line: 5, column: 3, scope: !4) +!24 = !DILocation(line: 8, column: 15, scope: !11) +!25 = !DILocation(line: 9, column: 3, scope: !11) diff --git a/test/Linker/type-unique-alias.ll b/test/Linker/type-unique-alias.ll index e43450fbbeb3..89e08dd593d1 100644 --- a/test/Linker/type-unique-alias.ll +++ b/test/Linker/type-unique-alias.ll @@ -3,8 +3,8 @@ %t = type { i8 } @g = global %t zeroinitializer -@a = weak alias %t* @g +@a = weak alias %t, %t* @g ; CHECK: @g = global %t zeroinitializer ; CHECK: @g2 = global %t zeroinitializer -; CHECK: @a = weak alias %t* @g +; CHECK: @a = weak alias %t, %t* @g diff --git a/test/Linker/type-unique-dst-types.ll b/test/Linker/type-unique-dst-types.ll index 30aecbb970cb..1adad49de91d 100644 --- a/test/Linker/type-unique-dst-types.ll +++ b/test/Linker/type-unique-dst-types.ll @@ -17,3 +17,7 @@ %A = type { %B } %B = type { i8 } @g3 = external global %A + +define %A* @use_g3() { + ret %A* @g3 +} diff --git a/test/Linker/type-unique-odr-a.ll b/test/Linker/type-unique-odr-a.ll index fa6b6bb4f221..d7d978c2d3d7 100644 --- a/test/Linker/type-unique-odr-a.ll +++ b/test/Linker/type-unique-odr-a.ll @@ -1,6 +1,6 @@ -; REQUIRES: object-emission +; REQUIRES: default_triple, object-emission ; -; RUN: llvm-link %s %p/type-unique-odr-b.ll -S -o - | %llc_dwarf -filetype=obj -O0 | llvm-dwarfdump -debug-dump=info - | FileCheck %s +; RUN: llvm-link %s %p/type-unique-odr-b.ll -S -o - | %llc_dwarf -dwarf-linkage-names=Enable -filetype=obj -O0 | llvm-dwarfdump -debug-dump=info - | FileCheck %s ; ; Test ODR-based type uniquing for C++ class members. ; rdar://problem/15851313. @@ -49,14 +49,14 @@ %class.A = type { i32 } ; Function Attrs: nounwind -define void @_Z3bazv() #0 { +define void @_Z3bazv() #0 !dbg !15 { entry: call void @_ZL3barv(), !dbg !23 ret void, !dbg !23 } ; Function Attrs: nounwind -define internal void @_ZL3barv() #0 { +define internal void @_ZL3barv() #0 !dbg !19 { entry: %a = alloca %class.A, align 4 call void @llvm.dbg.declare(metadata %class.A* %a, metadata !24, metadata !DIExpression()), !dbg !25 @@ -73,7 +73,7 @@ attributes #1 = { nounwind readnone } !llvm.module.flags = !{!20, !21} !llvm.ident = !{!22} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !14, globals: !2, imports: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !14, globals: !2, imports: !2) !1 = !DIFile(filename: "<unknown>", directory: "") !2 = !{} !3 = !{!4} @@ -87,15 +87,15 @@ attributes #1 = { nounwind readnone } !11 = !{null, !12} !12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1A") !14 = !{!15, !19} -!15 = !DISubprogram(name: "baz", linkageName: "_Z3bazv", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 11, file: !5, scope: !16, type: !17, function: void ()* @_Z3bazv, variables: !2) +!15 = distinct !DISubprogram(name: "baz", linkageName: "_Z3bazv", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 11, file: !5, scope: !16, type: !17, variables: !2) !16 = !DIFile(filename: "type-unique-odr-a.cpp", directory: "") !17 = !DISubroutineType(types: !18) !18 = !{null} -!19 = !DISubprogram(name: "bar", linkageName: "_ZL3barv", line: 7, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !5, scope: !16, type: !17, function: void ()* @_ZL3barv, variables: !2) +!19 = distinct !DISubprogram(name: "bar", linkageName: "_ZL3barv", line: 7, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !5, scope: !16, type: !17, variables: !2) !20 = !{i32 2, !"Dwarf Version", i32 4} !21 = !{i32 1, !"Debug Info Version", i32 3} !22 = !{!"clang version 3.5.0 "} !23 = !DILocation(line: 11, scope: !15) -!24 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "a", line: 8, scope: !19, file: !16, type: !"_ZTS1A") +!24 = !DILocalVariable(name: "a", line: 8, scope: !19, file: !16, type: !"_ZTS1A") !25 = !DILocation(line: 8, scope: !19) !26 = !DILocation(line: 9, scope: !19) diff --git a/test/Linker/type-unique-odr-b.ll b/test/Linker/type-unique-odr-b.ll index f57c21da824b..714bb314c908 100644 --- a/test/Linker/type-unique-odr-b.ll +++ b/test/Linker/type-unique-odr-b.ll @@ -22,7 +22,7 @@ %class.A = type { i32 } ; Function Attrs: nounwind -define void @_ZN1A6getFooEv(%class.A* %this) #0 align 2 { +define void @_ZN1A6getFooEv(%class.A* %this) #0 align 2 !dbg !15 { entry: %this.addr = alloca %class.A*, align 8 store %class.A* %this, %class.A** %this.addr, align 8 @@ -35,14 +35,14 @@ entry: declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 ; Function Attrs: nounwind -define void @_Z1fv() #0 { +define void @_Z1fv() #0 !dbg !16 { entry: call void @_ZL3barv(), !dbg !28 ret void, !dbg !28 } ; Function Attrs: nounwind -define internal void @_ZL3barv() #0 { +define internal void @_ZL3barv() #0 !dbg !20 { entry: ret void, !dbg !29 } @@ -54,7 +54,7 @@ attributes #1 = { nounwind readnone } !llvm.module.flags = !{!21, !22} !llvm.ident = !{!23} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !14, globals: !2, imports: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !14, globals: !2, imports: !2) !1 = !DIFile(filename: "<unknown>", directory: "") !2 = !{} !3 = !{!4} @@ -68,16 +68,16 @@ attributes #1 = { nounwind readnone } !11 = !{null, !12} !12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1A") !14 = !{!15, !16, !20} -!15 = !DISubprogram(name: "getFoo", linkageName: "_ZN1A6getFooEv", line: 8, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 8, file: !5, scope: !"_ZTS1A", type: !10, function: void (%class.A*)* @_ZN1A6getFooEv, declaration: !9, variables: !2) -!16 = !DISubprogram(name: "f", linkageName: "_Z1fv", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 11, file: !5, scope: !17, type: !18, function: void ()* @_Z1fv, variables: !2) +!15 = distinct !DISubprogram(name: "getFoo", linkageName: "_ZN1A6getFooEv", line: 8, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 8, file: !5, scope: !"_ZTS1A", type: !10, declaration: !9, variables: !2) +!16 = distinct !DISubprogram(name: "f", linkageName: "_Z1fv", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 11, file: !5, scope: !17, type: !18, variables: !2) !17 = !DIFile(filename: "type-unique-odr-b.cpp", directory: "") !18 = !DISubroutineType(types: !19) !19 = !{null} -!20 = !DISubprogram(name: "bar", linkageName: "_ZL3barv", line: 10, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 10, file: !5, scope: !17, type: !18, function: void ()* @_ZL3barv, variables: !2) +!20 = distinct !DISubprogram(name: "bar", linkageName: "_ZL3barv", line: 10, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 10, file: !5, scope: !17, type: !18, variables: !2) !21 = !{i32 2, !"Dwarf Version", i32 4} !22 = !{i32 1, !"Debug Info Version", i32 3} !23 = !{!"clang version 3.5.0 "} -!24 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !15, type: !25) +!24 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !15, type: !25) !25 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1A") !26 = !DILocation(line: 0, scope: !15) !27 = !DILocation(line: 8, scope: !15) diff --git a/test/Linker/type-unique-simple-a.ll b/test/Linker/type-unique-simple-a.ll index 1ab43d657e15..24a830922ef5 100644 --- a/test/Linker/type-unique-simple-a.ll +++ b/test/Linker/type-unique-simple-a.ll @@ -1,4 +1,4 @@ -; REQUIRES: object-emission +; REQUIRES: default_triple, object-emission ; RUN: llvm-link %s %p/type-unique-simple-b.ll -S -o %t ; RUN: cat %t | FileCheck %s -check-prefix=LINK @@ -49,7 +49,7 @@ %struct.Base = type { i32 } ; Function Attrs: nounwind ssp uwtable -define void @_Z1fi(i32 %a) #0 { +define void @_Z1fi(i32 %a) #0 !dbg !10 { entry: %a.addr = alloca i32, align 4 %t = alloca %struct.Base, align 4 @@ -68,7 +68,7 @@ attributes #1 = { nounwind readnone } !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!14, !20} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 (http://llvm.org/git/clang.git c23b1db6268c8e7ce64026d57d1510c1aac200a0) (http://llvm.org/git/llvm.git 09b98fe3978eddefc2145adc1056cf21580ce945)", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !9, globals: !2, imports: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 (http://llvm.org/git/clang.git c23b1db6268c8e7ce64026d57d1510c1aac200a0) (http://llvm.org/git/llvm.git 09b98fe3978eddefc2145adc1056cf21580ce945)", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !9, globals: !2, imports: !2) !1 = !DIFile(filename: "foo.cpp", directory: "/Users/mren/c_testing/type_unique_air/simple") !2 = !{} !3 = !{!4} @@ -78,14 +78,14 @@ attributes #1 = { nounwind readnone } !7 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 2, size: 32, align: 32, file: !5, scope: !"_ZTS4Base", baseType: !8) !8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) !9 = !{!10} -!10 = !DISubprogram(name: "f", linkageName: "_Z1fi", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !11, type: !12, function: void (i32)* @_Z1fi, variables: !2) +!10 = distinct !DISubprogram(name: "f", linkageName: "_Z1fi", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !11, type: !12, variables: !2) !11 = !DIFile(filename: "foo.cpp", directory: "/Users/mren/c_testing/type_unique_air/simple") !12 = !DISubroutineType(types: !13) !13 = !{null, !8} !14 = !{i32 2, !"Dwarf Version", i32 2} -!15 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "a", line: 3, arg: 1, scope: !10, file: !11, type: !8) +!15 = !DILocalVariable(name: "a", line: 3, arg: 1, scope: !10, file: !11, type: !8) !16 = !DILocation(line: 3, scope: !10) -!17 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "t", line: 4, scope: !10, file: !11, type: !4) +!17 = !DILocalVariable(name: "t", line: 4, scope: !10, file: !11, type: !4) !18 = !DILocation(line: 4, scope: !10) !19 = !DILocation(line: 5, scope: !10) !20 = !{i32 1, !"Debug Info Version", i32 3} diff --git a/test/Linker/type-unique-simple-b.ll b/test/Linker/type-unique-simple-b.ll index c12b91845299..b2228185c9b5 100644 --- a/test/Linker/type-unique-simple-b.ll +++ b/test/Linker/type-unique-simple-b.ll @@ -5,7 +5,7 @@ %struct.Base = type { i32 } ; Function Attrs: nounwind ssp uwtable -define void @_Z1gi(i32 %a) #0 { +define void @_Z1gi(i32 %a) #0 !dbg !10 { entry: %a.addr = alloca i32, align 4 %t = alloca %struct.Base, align 4 @@ -19,7 +19,7 @@ entry: declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 ; Function Attrs: ssp uwtable -define i32 @main() #2 { +define i32 @main() #2 !dbg !14 { entry: %retval = alloca i32, align 4 store i32 0, i32* %retval @@ -38,7 +38,7 @@ attributes #3 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!17, !26} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 (http://llvm.org/git/clang.git c23b1db6268c8e7ce64026d57d1510c1aac200a0) (http://llvm.org/git/llvm.git 09b98fe3978eddefc2145adc1056cf21580ce945)", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !9, globals: !2, imports: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 (http://llvm.org/git/clang.git c23b1db6268c8e7ce64026d57d1510c1aac200a0) (http://llvm.org/git/llvm.git 09b98fe3978eddefc2145adc1056cf21580ce945)", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !9, globals: !2, imports: !2) !1 = !DIFile(filename: "bar.cpp", directory: "/Users/mren/c_testing/type_unique_air/simple") !2 = !{} !3 = !{!4} @@ -48,17 +48,17 @@ attributes #3 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n !7 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 2, size: 32, align: 32, file: !5, scope: !"_ZTS4Base", baseType: !8) !8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) !9 = !{!10, !14} -!10 = !DISubprogram(name: "g", linkageName: "_Z1gi", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !1, scope: !11, type: !12, function: void (i32)* @_Z1gi, variables: !2) +!10 = distinct !DISubprogram(name: "g", linkageName: "_Z1gi", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !1, scope: !11, type: !12, variables: !2) !11 = !DIFile(filename: "bar.cpp", directory: "/Users/mren/c_testing/type_unique_air/simple") !12 = !DISubroutineType(types: !13) !13 = !{null, !8} -!14 = !DISubprogram(name: "main", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !11, type: !15, function: i32 ()* @main, variables: !2) +!14 = distinct !DISubprogram(name: "main", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !11, type: !15, variables: !2) !15 = !DISubroutineType(types: !16) !16 = !{!8} !17 = !{i32 2, !"Dwarf Version", i32 2} -!18 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "a", line: 4, arg: 1, scope: !10, file: !11, type: !8) +!18 = !DILocalVariable(name: "a", line: 4, arg: 1, scope: !10, file: !11, type: !8) !19 = !DILocation(line: 4, scope: !10) -!20 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "t", line: 5, scope: !10, file: !11, type: !4) +!20 = !DILocalVariable(name: "t", line: 5, scope: !10, file: !11, type: !4) !21 = !DILocation(line: 5, scope: !10) !22 = !DILocation(line: 6, scope: !10) !23 = !DILocation(line: 8, scope: !14) diff --git a/test/Linker/type-unique-simple2-a.ll b/test/Linker/type-unique-simple2-a.ll index f9170ab5f7fa..3779753a64ea 100644 --- a/test/Linker/type-unique-simple2-a.ll +++ b/test/Linker/type-unique-simple2-a.ll @@ -1,4 +1,4 @@ -; REQUIRES: object-emission +; REQUIRES: default_triple, object-emission ; ; RUN: llvm-link %s %p/type-unique-simple2-b.ll -S -o - | %llc_dwarf -filetype=obj -O0 | llvm-dwarfdump -debug-dump=info - | FileCheck %s ; @@ -18,7 +18,8 @@ ; return A().getFoo(); ; } ; -; CHECK: _ZN1A6setFooEv +; CHECK: DW_AT_name {{.*}} "setFoo" +; CHECK-NOT: DW_TAG ; CHECK: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public) ; CHECK-NOT: DW_AT_accessibility ; CHECK: DW_TAG @@ -30,7 +31,7 @@ @_ZTV1A = external unnamed_addr constant [4 x i8*] ; Function Attrs: nounwind -define i32 @_Z3barv() #0 { +define i32 @_Z3barv() #0 !dbg !27 { entry: %tmp = alloca %class.A, align 8 %0 = bitcast %class.A* %tmp to i8*, !dbg !38 @@ -44,7 +45,7 @@ entry: declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #1 ; Function Attrs: inlinehint nounwind -define linkonce_odr void @_ZN1AC1Ev(%class.A* %this) unnamed_addr #2 align 2 { +define linkonce_odr void @_ZN1AC1Ev(%class.A* %this) unnamed_addr #2 align 2 !dbg !31 { entry: %this.addr = alloca %class.A*, align 8 store %class.A* %this, %class.A** %this.addr, align 8 @@ -60,7 +61,7 @@ declare i32 @_ZN1A6getFooEv(%class.A*) declare void @llvm.dbg.declare(metadata, metadata, metadata) #4 ; Function Attrs: inlinehint nounwind -define linkonce_odr void @_ZN1AC2Ev(%class.A* %this) unnamed_addr #2 align 2 { +define linkonce_odr void @_ZN1AC2Ev(%class.A* %this) unnamed_addr #2 align 2 !dbg !34 { entry: %this.addr = alloca %class.A*, align 8 store %class.A* %this, %class.A** %this.addr, align 8 @@ -80,7 +81,7 @@ attributes #4 = { nounwind readnone } !llvm.module.flags = !{!35, !36} !llvm.ident = !{!37} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !26, globals: !2, imports: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !26, globals: !2, imports: !2) !1 = !DIFile(filename: "<unknown>", directory: "") !2 = !{} !3 = !{!4} @@ -105,22 +106,22 @@ attributes #4 = { nounwind readnone } !23 = !DIDerivedType(tag: DW_TAG_typedef, name: "foo_t", line: 1, file: !24, baseType: !13) !24 = !DIFile(filename: "a.cpp", directory: "") !26 = !{!27, !31, !34} -!27 = !DISubprogram(name: "bar", linkageName: "_Z3barv", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !24, scope: !28, type: !29, function: i32 ()* @_Z3barv, variables: !2) +!27 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barv", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !24, scope: !28, type: !29, variables: !2) !28 = !DIFile(filename: "a.cpp", directory: "") !29 = !DISubroutineType(types: !30) !30 = !{!23} -!31 = !DISubprogram(name: "A", linkageName: "_ZN1AC1Ev", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !"_ZTS1A", type: !15, function: void (%class.A*)* @_ZN1AC1Ev, declaration: !32, variables: !2) +!31 = distinct !DISubprogram(name: "A", linkageName: "_ZN1AC1Ev", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !"_ZTS1A", type: !15, declaration: !32, variables: !2) !32 = !DISubprogram(name: "A", isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scope: !"_ZTS1A", type: !15) -!34 = !DISubprogram(name: "A", linkageName: "_ZN1AC2Ev", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !"_ZTS1A", type: !15, function: void (%class.A*)* @_ZN1AC2Ev, declaration: !32, variables: !2) +!34 = distinct !DISubprogram(name: "A", linkageName: "_ZN1AC2Ev", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !"_ZTS1A", type: !15, declaration: !32, variables: !2) !35 = !{i32 2, !"Dwarf Version", i32 2} !36 = !{i32 1, !"Debug Info Version", i32 3} !37 = !{!"clang version 3.5 "} !38 = !DILocation(line: 3, scope: !27) -!39 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !31, type: !40) +!39 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !31, type: !40) !40 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1A") !41 = !DILocation(line: 0, scope: !31) !42 = !DILocation(line: 2, scope: !43) !43 = !DILexicalBlockFile(discriminator: 0, file: !5, scope: !31) -!44 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !34, type: !40) +!44 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !34, type: !40) !45 = !DILocation(line: 0, scope: !34) !46 = !DILocation(line: 2, scope: !34) diff --git a/test/Linker/type-unique-simple2-b.ll b/test/Linker/type-unique-simple2-b.ll index 5539fb4adb35..e69ab63e6d24 100644 --- a/test/Linker/type-unique-simple2-b.ll +++ b/test/Linker/type-unique-simple2-b.ll @@ -18,7 +18,7 @@ @_ZTI1A = unnamed_addr constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv117__class_type_infoE, i64 2) to i8*), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @_ZTS1A, i32 0, i32 0) } ; Function Attrs: nounwind -define void @_ZN1A6setFooEv(%class.A* %this) unnamed_addr #0 align 2 { +define void @_ZN1A6setFooEv(%class.A* %this) unnamed_addr #0 align 2 !dbg !26 { entry: %this.addr = alloca %class.A*, align 8 store %class.A* %this, %class.A** %this.addr, align 8 @@ -31,7 +31,7 @@ entry: declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 ; Function Attrs: nounwind -define i32 @_ZN1A6getFooEv(%class.A* %this) unnamed_addr #0 align 2 { +define i32 @_ZN1A6getFooEv(%class.A* %this) unnamed_addr #0 align 2 !dbg !28 { entry: %this.addr = alloca %class.A*, align 8 store %class.A* %this, %class.A** %this.addr, align 8 @@ -47,7 +47,7 @@ attributes #1 = { nounwind readnone } !llvm.module.flags = !{!29, !30} !llvm.ident = !{!31} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !25, globals: !2, imports: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !25, globals: !2, imports: !2) !1 = !DIFile(filename: "<unknown>", directory: "") !2 = !{} !3 = !{!4} @@ -71,16 +71,16 @@ attributes #1 = { nounwind readnone } !22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !23) !23 = !DIDerivedType(tag: DW_TAG_typedef, name: "foo_t", line: 1, file: !5, baseType: !13) !25 = !{!26, !28} -!26 = !DISubprogram(name: "setFoo", linkageName: "_ZN1A6setFooEv", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !27, scope: !"_ZTS1A", type: !15, function: void (%class.A*)* @_ZN1A6setFooEv, declaration: !14, variables: !2) +!26 = distinct !DISubprogram(name: "setFoo", linkageName: "_ZN1A6setFooEv", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !27, scope: !"_ZTS1A", type: !15, declaration: !14, variables: !2) !27 = !DIFile(filename: "b.cpp", directory: "") -!28 = !DISubprogram(name: "getFoo", linkageName: "_ZN1A6getFooEv", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !27, scope: !"_ZTS1A", type: !20, function: i32 (%class.A*)* @_ZN1A6getFooEv, declaration: !19, variables: !2) +!28 = distinct !DISubprogram(name: "getFoo", linkageName: "_ZN1A6getFooEv", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !27, scope: !"_ZTS1A", type: !20, declaration: !19, variables: !2) !29 = !{i32 2, !"Dwarf Version", i32 2} !30 = !{i32 1, !"Debug Info Version", i32 3} !31 = !{!"clang version 3.5 "} -!32 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !26, type: !33) +!32 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !26, type: !33) !33 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1A") !34 = !DILocation(line: 0, scope: !26) !35 = !DILocation(line: 2, scope: !26) -!36 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !28, type: !33) +!36 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !28, type: !33) !37 = !DILocation(line: 0, scope: !28) !38 = !DILocation(line: 4, scope: !28) diff --git a/test/Linker/type-unique-simple2.ll b/test/Linker/type-unique-simple2.ll index 8a56e2e80c67..7c31cdf5975e 100644 --- a/test/Linker/type-unique-simple2.ll +++ b/test/Linker/type-unique-simple2.ll @@ -1,4 +1,5 @@ ; REQUIRES: object-emission +; REQUIRES: default_triple ; RUN: llvm-link %S/Inputs/type-unique-simple2-a.ll %S/Inputs/type-unique-simple2-b.ll -S -o %t ; RUN: cat %t | FileCheck %S/Inputs/type-unique-simple2-a.ll -check-prefix=LINK diff --git a/test/Linker/type-unique-src-type.ll b/test/Linker/type-unique-src-type.ll index 110ecc87e1b1..ab7322892e07 100644 --- a/test/Linker/type-unique-src-type.ll +++ b/test/Linker/type-unique-src-type.ll @@ -10,7 +10,7 @@ ; CHECK-NEXT: %B = type { %A } ; CHECK-NEXT: %A = type { i8 } -; CHECK: @g1 = external global %C.0 +; CHECK: @g1 = global %C.0 zeroinitializer ; CHECK: getelementptr %C.0, %C.0* null, i64 0, i32 0, i32 0 %A = type { i8 } @@ -21,4 +21,4 @@ define void @f1() { getelementptr %C, %C* null, i64 0, i32 0, i32 0 ret void } -@g1 = external global %C.0 +@g1 = global %C.0 zeroinitializer diff --git a/test/Linker/type-unique-type-array-a.ll b/test/Linker/type-unique-type-array-a.ll index 98c8d657743d..0a79f20f40c6 100644 --- a/test/Linker/type-unique-type-array-a.ll +++ b/test/Linker/type-unique-type-array-a.ll @@ -1,4 +1,4 @@ -; REQUIRES: object-emission +; REQUIRES: default_triple, object-emission ; ; RUN: llvm-link %s %p/type-unique-type-array-b.ll -S -o - | %llc_dwarf -filetype=obj -O0 | llvm-dwarfdump -debug-dump=info - | FileCheck %s ; @@ -23,7 +23,7 @@ ; CHECK: DW_TAG_class_type ; CHECK-NEXT: DW_AT_name {{.*}} "A" ; CHECK: DW_TAG_subprogram -; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1A5testAE2SA" +; CHECK: DW_AT_name {{.*}} "testA" ; CHECK: DW_TAG_formal_parameter ; CHECK: DW_TAG_formal_parameter ; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x{{.*}} => {0x[[STRUCT:.*]]}) @@ -34,7 +34,7 @@ ; CHECK: DW_TAG_class_type ; CHECK-NEXT: DW_AT_name {{.*}} "B" ; CHECK: DW_TAG_subprogram -; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1B5testBE2SA" +; CHECK: DW_AT_name {{.*}} "testB" ; CHECK: DW_TAG_formal_parameter ; CHECK: DW_TAG_formal_parameter ; CHECK-NEXT: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[STRUCT]] @@ -43,7 +43,7 @@ %struct.SA = type { i32 } ; Function Attrs: ssp uwtable -define void @_Z4topAP1A2SA(%class.A* %a, i32 %sa.coerce) #0 { +define void @_Z4topAP1A2SA(%class.A* %a, i32 %sa.coerce) #0 !dbg !15 { entry: %sa = alloca %struct.SA, align 4 %a.addr = alloca %class.A*, align 8 @@ -67,7 +67,7 @@ entry: declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 ; Function Attrs: nounwind ssp uwtable -define linkonce_odr void @_ZN1A5testAE2SA(%class.A* %this, i32 %a.coerce) #2 align 2 { +define linkonce_odr void @_ZN1A5testAE2SA(%class.A* %this, i32 %a.coerce) #2 align 2 !dbg !20 { entry: %a = alloca %struct.SA, align 4 %this.addr = alloca %class.A*, align 8 @@ -92,7 +92,7 @@ attributes #3 = { nounwind } !llvm.module.flags = !{!21, !22} !llvm.ident = !{!23} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 (trunk 214102:214113M) (llvm/trunk 214102:214115M)", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !14, globals: !2, imports: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 (trunk 214102:214113M) (llvm/trunk 214102:214115M)", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !14, globals: !2, imports: !2) !1 = !DIFile(filename: "a.cpp", directory: "/Users/manmanren/test-Nov/type_unique/rdar_di_array") !2 = !{} !3 = !{!4, !10} @@ -107,23 +107,23 @@ attributes #3 = { nounwind } !12 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 2, size: 32, align: 32, file: !1, scope: !"_ZTS2SA", baseType: !13) !13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) !14 = !{!15, !20} -!15 = !DISubprogram(name: "topA", linkageName: "_Z4topAP1A2SA", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 11, file: !1, scope: !16, type: !17, function: void (%class.A*, i32)* @_Z4topAP1A2SA, variables: !2) +!15 = distinct !DISubprogram(name: "topA", linkageName: "_Z4topAP1A2SA", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 11, file: !1, scope: !16, type: !17, variables: !2) !16 = !DIFile(filename: "a.cpp", directory: "/Users/manmanren/test-Nov/type_unique/rdar_di_array") !17 = !DISubroutineType(types: !18) !18 = !{null, !19, !"_ZTS2SA"} !19 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1A") -!20 = !DISubprogram(name: "testA", linkageName: "_ZN1A5testAE2SA", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !"_ZTS1A", type: !7, function: void (%class.A*, i32)* @_ZN1A5testAE2SA, declaration: !6, variables: !2) +!20 = distinct !DISubprogram(name: "testA", linkageName: "_ZN1A5testAE2SA", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !"_ZTS1A", type: !7, declaration: !6, variables: !2) !21 = !{i32 2, !"Dwarf Version", i32 2} !22 = !{i32 2, !"Debug Info Version", i32 3} !23 = !{!"clang version 3.5.0 (trunk 214102:214113M) (llvm/trunk 214102:214115M)"} -!24 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "a", line: 11, arg: 1, scope: !15, file: !16, type: !19) +!24 = !DILocalVariable(name: "a", line: 11, arg: 1, scope: !15, file: !16, type: !19) !25 = !DILocation(line: 11, column: 14, scope: !15) -!26 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "sa", line: 11, arg: 2, scope: !15, file: !16, type: !"_ZTS2SA") +!26 = !DILocalVariable(name: "sa", line: 11, arg: 2, scope: !15, file: !16, type: !"_ZTS2SA") !27 = !DILocation(line: 11, column: 20, scope: !15) !28 = !DILocation(line: 12, column: 3, scope: !15) !29 = !DILocation(line: 13, column: 1, scope: !15) -!30 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !20, type: !19) +!30 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !20, type: !19) !31 = !DILocation(line: 0, scope: !20) -!32 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "a", line: 7, arg: 2, scope: !20, file: !16, type: !"_ZTS2SA") +!32 = !DILocalVariable(name: "a", line: 7, arg: 2, scope: !20, file: !16, type: !"_ZTS2SA") !33 = !DILocation(line: 7, column: 17, scope: !20) !34 = !DILocation(line: 8, column: 3, scope: !20) diff --git a/test/Linker/type-unique-type-array-b.ll b/test/Linker/type-unique-type-array-b.ll index 14ce59b3c127..b7796daf9b13 100644 --- a/test/Linker/type-unique-type-array-b.ll +++ b/test/Linker/type-unique-type-array-b.ll @@ -22,7 +22,7 @@ %struct.SA = type { i32 } ; Function Attrs: ssp uwtable -define void @_Z4topBP1B2SA(%class.B* %b, i32 %sa.coerce) #0 { +define void @_Z4topBP1B2SA(%class.B* %b, i32 %sa.coerce) #0 !dbg !15 { entry: %sa = alloca %struct.SA, align 4 %b.addr = alloca %class.B*, align 8 @@ -46,7 +46,7 @@ entry: declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 ; Function Attrs: nounwind ssp uwtable -define linkonce_odr void @_ZN1B5testBE2SA(%class.B* %this, i32 %sa.coerce) #2 align 2 { +define linkonce_odr void @_ZN1B5testBE2SA(%class.B* %this, i32 %sa.coerce) #2 align 2 !dbg !20 { entry: %sa = alloca %struct.SA, align 4 %this.addr = alloca %class.B*, align 8 @@ -71,7 +71,7 @@ attributes #3 = { nounwind } !llvm.module.flags = !{!21, !22} !llvm.ident = !{!23} -!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 (trunk 214102:214113M) (llvm/trunk 214102:214115M)", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !14, globals: !2, imports: !2) +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 (trunk 214102:214113M) (llvm/trunk 214102:214115M)", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !14, globals: !2, imports: !2) !1 = !DIFile(filename: "b.cpp", directory: "/Users/manmanren/test-Nov/type_unique/rdar_di_array") !2 = !{} !3 = !{!4, !10} @@ -86,23 +86,23 @@ attributes #3 = { nounwind } !12 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 2, size: 32, align: 32, file: !1, scope: !"_ZTS2SA", baseType: !13) !13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) !14 = !{!15, !20} -!15 = !DISubprogram(name: "topB", linkageName: "_Z4topBP1B2SA", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 11, file: !1, scope: !16, type: !17, function: void (%class.B*, i32)* @_Z4topBP1B2SA, variables: !2) +!15 = distinct !DISubprogram(name: "topB", linkageName: "_Z4topBP1B2SA", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 11, file: !1, scope: !16, type: !17, variables: !2) !16 = !DIFile(filename: "b.cpp", directory: "/Users/manmanren/test-Nov/type_unique/rdar_di_array") !17 = !DISubroutineType(types: !18) !18 = !{null, !19, !"_ZTS2SA"} !19 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1B") -!20 = !DISubprogram(name: "testB", linkageName: "_ZN1B5testBE2SA", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !"_ZTS1B", type: !7, function: void (%class.B*, i32)* @_ZN1B5testBE2SA, declaration: !6, variables: !2) +!20 = distinct !DISubprogram(name: "testB", linkageName: "_ZN1B5testBE2SA", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !"_ZTS1B", type: !7, declaration: !6, variables: !2) !21 = !{i32 2, !"Dwarf Version", i32 2} !22 = !{i32 2, !"Debug Info Version", i32 3} !23 = !{!"clang version 3.5.0 (trunk 214102:214113M) (llvm/trunk 214102:214115M)"} -!24 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "b", line: 11, arg: 1, scope: !15, file: !16, type: !19) +!24 = !DILocalVariable(name: "b", line: 11, arg: 1, scope: !15, file: !16, type: !19) !25 = !DILocation(line: 11, column: 14, scope: !15) -!26 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "sa", line: 11, arg: 2, scope: !15, file: !16, type: !"_ZTS2SA") +!26 = !DILocalVariable(name: "sa", line: 11, arg: 2, scope: !15, file: !16, type: !"_ZTS2SA") !27 = !DILocation(line: 11, column: 20, scope: !15) !28 = !DILocation(line: 12, column: 3, scope: !15) !29 = !DILocation(line: 13, column: 1, scope: !15) -!30 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !20, type: !19) +!30 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !20, type: !19) !31 = !DILocation(line: 0, scope: !20) -!32 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "sa", line: 7, arg: 2, scope: !20, file: !16, type: !"_ZTS2SA") +!32 = !DILocalVariable(name: "sa", line: 7, arg: 2, scope: !20, file: !16, type: !"_ZTS2SA") !33 = !DILocation(line: 7, column: 17, scope: !20) !34 = !DILocation(line: 8, column: 3, scope: !20) diff --git a/test/Linker/uniqued-distinct-cycles.ll b/test/Linker/uniqued-distinct-cycles.ll new file mode 100644 index 000000000000..05cc80d73042 --- /dev/null +++ b/test/Linker/uniqued-distinct-cycles.ll @@ -0,0 +1,14 @@ +; RUN: llvm-link -o - %s | llvm-dis | FileCheck %s + +; CHECK: !named = !{!0, !2} +!named = !{!0, !2} + +; CHECK: !0 = !{!1} +; CHECK-NEXT: !1 = distinct !{!0} +!0 = !{!1} +!1 = distinct !{!0} + +; CHECK-NEXT: !2 = distinct !{!3} +; CHECK-NEXT: !3 = !{!2} +!2 = distinct !{!3} +!3 = !{!2} diff --git a/test/Linker/unnamed-addr1-a.ll b/test/Linker/unnamed-addr1-a.ll index 794ae987797c..a96f089a99c0 100644 --- a/test/Linker/unnamed-addr1-a.ll +++ b/test/Linker/unnamed-addr1-a.ll @@ -15,6 +15,11 @@ define weak void @func-b() unnamed_addr { ret void } @global-c = common unnamed_addr global i32 0 ; CHECK-DAG: @global-c = common unnamed_addr global i32 0 @global-d = external global i32 + +define i32* @use-global-d() { + ret i32* @global-d +} + ; CHECK-DAG: @global-d = global i32 42 @global-e = external unnamed_addr global i32 ; CHECK-DAG: @global-e = unnamed_addr global i32 42 @@ -22,11 +27,16 @@ define weak void @func-b() unnamed_addr { ret void } ; CHECK-DAG: @global-f = global i32 42 @alias-a = weak global i32 42 -; CHECK-DAG: @alias-a = alias i32* @global-f +; CHECK-DAG: @alias-a = alias i32, i32* @global-f @alias-b = weak unnamed_addr global i32 42 -; CHECK-DAG: @alias-b = unnamed_addr alias i32* @global-f +; CHECK-DAG: @alias-b = unnamed_addr alias i32, i32* @global-f declare void @func-c() +define void @use-func-c() { + call void @func-c() + ret void +} + ; CHECK-DAG: define weak void @func-c() { define weak void @func-d() { ret void } ; CHECK-DAG: define weak void @func-d() { @@ -44,9 +54,9 @@ define weak void @func-e() unnamed_addr { ret void } ; CHECK-DAG: @global-j = global i32 42 @alias-c = weak global i32 42 -; CHECK-DAG: @alias-c = alias i32* @global-f +; CHECK-DAG: @alias-c = alias i32, i32* @global-f @alias-d = weak unnamed_addr global i32 42 -; CHECK-DAG: @alias-d = alias i32* @global-f +; CHECK-DAG: @alias-d = alias i32, i32* @global-f declare void @func-g() diff --git a/test/Linker/unnamed-addr1-b.ll b/test/Linker/unnamed-addr1-b.ll index d0f54f2259b4..94334d6da73f 100644 --- a/test/Linker/unnamed-addr1-b.ll +++ b/test/Linker/unnamed-addr1-b.ll @@ -6,8 +6,8 @@ @global-e = unnamed_addr global i32 42 @global-f = unnamed_addr global i32 42 -@alias-a = unnamed_addr alias i32* @global-f -@alias-b = unnamed_addr alias i32* @global-f +@alias-a = unnamed_addr alias i32, i32* @global-f +@alias-b = unnamed_addr alias i32, i32* @global-f define weak void @func-c() unnamed_addr { ret void } define weak void @func-d() unnamed_addr { ret void } @@ -18,8 +18,8 @@ define weak void @func-e() unnamed_addr { ret void } @global-i = global i32 42 @global-j = global i32 42 -@alias-c = alias i32* @global-f -@alias-d = alias i32* @global-f +@alias-c = alias i32, i32* @global-f +@alias-d = alias i32, i32* @global-f define weak void @func-g() { ret void } define weak void @func-h() { ret void } diff --git a/test/Linker/visibility.ll b/test/Linker/visibility.ll index 4938d7af56d6..4252aee61920 100644 --- a/test/Linker/visibility.ll +++ b/test/Linker/visibility.ll @@ -21,14 +21,14 @@ $c1 = comdat any @v4 = global i32 1, comdat($c1) ; Aliases -; CHECK: @a1 = hidden alias i32* @v1 -@a1 = alias i32* @v1 +; CHECK: @a1 = hidden alias i32, i32* @v1 +@a1 = alias i32, i32* @v1 -; CHECK: @a2 = protected alias i32* @v2 -@a2 = alias i32* @v2 +; CHECK: @a2 = protected alias i32, i32* @v2 +@a2 = alias i32, i32* @v2 -; CHECK: @a3 = hidden alias i32* @v3 -@a3 = protected alias i32* @v3 +; CHECK: @a3 = hidden alias i32, i32* @v3 +@a3 = protected alias i32, i32* @v3 ; Functions diff --git a/test/Linker/weakextern.ll b/test/Linker/weakextern.ll index 8d479a0d39b3..814550a907bb 100644 --- a/test/Linker/weakextern.ll +++ b/test/Linker/weakextern.ll @@ -1,12 +1,12 @@ -; RUN: llvm-as < %s > %t.bc -; RUN: llvm-as < %p/testlink.ll > %t2.bc -; RUN: llvm-link %t.bc %t.bc %t2.bc -o %t1.bc -; RUN: llvm-dis < %t1.bc | FileCheck %s +; RUN: llvm-link %s %s %p/testlink.ll -S | FileCheck %s ; CHECK: kallsyms_names = extern_weak ; CHECK: Inte = global i32 ; CHECK: MyVar = external global i32 -@kallsyms_names = extern_weak global [0 x i8] ; <[0 x i8]*> [#uses=0] -@MyVar = extern_weak global i32 ; <i32*> [#uses=0] -@Inte = extern_weak global i32 ; <i32*> [#uses=0] +@kallsyms_names = extern_weak global [0 x i8] +@MyVar = extern_weak global i32 +@Inte = extern_weak global i32 +define weak [0 x i8]* @use_kallsyms_names() { + ret [0 x i8]* @kallsyms_names +} |