blob: 66d37d5e8ae69d25cd169044ec0d2cfacd122869 [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) {
Peter Collingbourne93fdaca2017-07-19 17:54:29 +000028 %1 = tail call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %arg, i64 %arg)
Peter Collingbourne002c2d52017-02-14 03:42:38 +000029 ret i64 %arg
30}
31
Peter Collingbourne93fdaca2017-07-19 17:54:29 +000032; M1: declare { i64, i1 } @llvm.sadd.with.overflow.i64(i64, i64)
33declare { i64, i1 } @llvm.sadd.with.overflow.i64(i64, i64)
34
Peter Collingbourne002c2d52017-02-14 03:42:38 +000035; M0: define void @wrongtype1
36; M1: declare void @wrongtype1()
37define void @wrongtype1(i8*) {
38 ret void
39}
40
41; M0: define i128 @wrongtype2
42; M1: declare void @wrongtype2()
43define i128 @wrongtype2(i8*) {
44 ret i128 0
45}
46
47; M0: define i64 @wrongtype3
48; M1: declare void @wrongtype3()
49define i64 @wrongtype3() {
50 ret i64 0
51}
52
53; M0: define i64 @wrongtype4
54; M1: declare void @wrongtype4()
55define i64 @wrongtype4(i8*, i8*) {
56 ret i64 0
57}
58
59; M0: define i64 @wrongtype5
60; M1: declare void @wrongtype5()
61define i64 @wrongtype5(i8*, i128) {
62 ret i64 0
63}
64
65; M0: define i64 @usesthis
66; M1: declare void @usesthis()
67define i64 @usesthis(i8* %this) {
68 %i = ptrtoint i8* %this to i64
69 ret i64 %i
70}
71
72; M0: define i8 @reads
73; M1: declare void @reads()
74define i8 @reads(i8* %this) {
75 %l = load i8, i8* %this
76 ret i8 %l
77}
78
79!0 = !{i32 0, !"typeid"}