blob: 0793459af4147adfa251d25f501cc047d462f4b4 [file] [log] [blame]
Peter Collingbourne002c2d52017-02-14 03:42:38 +00001; RUN: opt -thinlto-bc -o %t %s
2; RUN: llvm-modextract -b -n 0 -o - %t | llvm-dis | FileCheck --check-prefix=M0 %s
3; RUN: llvm-modextract -b -n 1 -o - %t | llvm-dis | FileCheck --check-prefix=M1 %s
4
5; M0: @g = external constant [9 x i8*]{{$}}
6; M1: @g = constant [9 x i8*]
7@g = constant [9 x i8*] [
8 i8* bitcast (i64 (i8*)* @ok1 to i8*),
9 i8* bitcast (i64 (i8*, i64)* @ok2 to i8*),
10 i8* bitcast (void (i8*)* @wrongtype1 to i8*),
11 i8* bitcast (i128 (i8*)* @wrongtype2 to i8*),
12 i8* bitcast (i64 ()* @wrongtype3 to i8*),
13 i8* bitcast (i64 (i8*, i8*)* @wrongtype4 to i8*),
14 i8* bitcast (i64 (i8*, i128)* @wrongtype5 to i8*),
15 i8* bitcast (i64 (i8*)* @usesthis to i8*),
16 i8* bitcast (i8 (i8*)* @reads to i8*)
17], !type !0
18
19; M0: define i64 @ok1
20; M1: define available_externally i64 @ok1
21define i64 @ok1(i8* %this) {
22 ret i64 42
23}
24
25; M0: define i64 @ok2
26; M1: define available_externally i64 @ok2
27define i64 @ok2(i8* %this, i64 %arg) {
28 ret i64 %arg
29}
30
31; M0: define void @wrongtype1
32; M1: declare void @wrongtype1()
33define void @wrongtype1(i8*) {
34 ret void
35}
36
37; M0: define i128 @wrongtype2
38; M1: declare void @wrongtype2()
39define i128 @wrongtype2(i8*) {
40 ret i128 0
41}
42
43; M0: define i64 @wrongtype3
44; M1: declare void @wrongtype3()
45define i64 @wrongtype3() {
46 ret i64 0
47}
48
49; M0: define i64 @wrongtype4
50; M1: declare void @wrongtype4()
51define i64 @wrongtype4(i8*, i8*) {
52 ret i64 0
53}
54
55; M0: define i64 @wrongtype5
56; M1: declare void @wrongtype5()
57define i64 @wrongtype5(i8*, i128) {
58 ret i64 0
59}
60
61; M0: define i64 @usesthis
62; M1: declare void @usesthis()
63define i64 @usesthis(i8* %this) {
64 %i = ptrtoint i8* %this to i64
65 ret i64 %i
66}
67
68; M0: define i8 @reads
69; M1: declare void @reads()
70define i8 @reads(i8* %this) {
71 %l = load i8, i8* %this
72 ret i8 %l
73}
74
75!0 = !{i32 0, !"typeid"}