xref: /llvm-project/llvm/test/ThinLTO/X86/dicompositetype-unique-alias.ll (revision d5d3eb16b7ab72529c83dacb2889811491e48909)
1; RUN: opt -module-summary -o %t1.bc %s
2; RUN: opt -module-summary -o %t2.bc %S/Inputs/dicompositetype-unique-alias.ll
3; RUN: llvm-lto --thinlto-action=run %t1.bc %t2.bc -thinlto-save-temps=%t3.
4; RUN: llvm-dis %t3.0.3.imported.bc -o - | FileCheck %s
5; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t --save-temps \
6; RUN: -r %t1.bc,_ZN1CD2Ev,pl \
7; RUN: -r %t1.bc,_ZN4CFVSD1Ev,l \
8; RUN: -r %t1.bc,_ZN4CFVSD2Ev,l \
9; RUN: -r %t1.bc,_Z3Getv,l \
10; RUN: -r %t2.bc,_ZN4CFVSD1Ev,pl \
11; RUN: -r %t2.bc,_ZN4CFVSD2Ev,pl \
12; RUN: -r %t2.bc,_Z3Getv,l
13; RUN: llvm-dis %t.1.3.import.bc -o - | FileCheck %s
14
15; Only llvm-lto2 adds the dso_local keyword, hence the {{.*}}
16; CHECK: define available_externally{{.*}} void @_ZN4CFVSD1Ev
17
18; Confirm that we only have a single DICompositeType after importing
19; both an alias and its aliasee, since ODR Type Uniquing is enabled.
20; CHECK: DICompositeType
21; CHECK-NOT: DICompositeType
22
23target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
24target triple = "x86_64-scei-ps4"
25
26%class.C = type <{ ptr, %class.A, %struct.CFVS, [6 x i8] }>
27%class.A = type { %struct.Vec }
28%struct.Vec = type { i8 }
29%struct.CFVS = type { %struct.Vec }
30%struct.S = type { i8 }
31
32define void @_ZN1CD2Ev(ptr %this) unnamed_addr align 2 {
33entry:
34  %this.addr = alloca ptr, align 8
35  %this1 = load ptr, ptr %this.addr, align 8
36  %m = getelementptr inbounds %class.C, ptr %this1, i32 0, i32 2
37  call void @_ZN4CFVSD1Ev(ptr %m), !dbg !50
38  call void @_ZN4CFVSD2Ev(ptr %m), !dbg !50
39  ret void
40}
41
42declare void @_ZN4CFVSD1Ev(ptr) unnamed_addr
43declare void @_ZN4CFVSD2Ev(ptr) unnamed_addr
44
45declare dereferenceable(1) ptr @_Z3Getv()
46
47!llvm.dbg.cu = !{!0}
48!llvm.module.flags = !{!3, !4, !5, !6}
49
50!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 6.0.0 (trunk 321360) (llvm/trunk 321359)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
51!1 = !DIFile(filename: "bz188598-a.cpp", directory: ".")
52!2 = !{}
53!3 = !{i32 2, !"Dwarf Version", i32 4}
54!4 = !{i32 2, !"Debug Info Version", i32 3}
55!5 = !{i32 1, !"wchar_size", i32 2}
56!6 = !{i32 7, !"PIC Level", i32 2}
57!8 = distinct !DISubprogram(name: "~C", linkageName: "_ZN1CD2Ev", scope: !1, file: !1, line: 9, type: !47, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
58!47 = !DISubroutineType(types: !48)
59!48 = !{!55}
60!50 = !DILocation(line: 9, scope: !51)
61!51 = distinct !DILexicalBlock(scope: !8, file: !1, line: 9)
62!55 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
63