File: split-vfunc.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (87 lines) | stat: -rw-r--r-- 2,550 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t %s
; RUN: llvm-modextract -b -n 0 -o - %t | llvm-dis | FileCheck --check-prefix=M0 %s
; RUN: llvm-modextract -b -n 1 -o - %t | llvm-dis | FileCheck --check-prefix=M1 %s

; M0: @g = external constant [10 x i8*]{{$}}
; M1: @g = constant [10 x i8*]
@g = constant [10 x i8*] [
  i8* bitcast (i64 (i8*)* @ok1 to i8*),
  i8* bitcast (i64 (i8*, i64)* @ok2 to i8*),
  i8* bitcast (void (i8*)* @wrongtype1 to i8*),
  i8* bitcast (i128 (i8*)* @wrongtype2 to i8*),
  i8* bitcast (i64 ()* @wrongtype3 to i8*),
  i8* bitcast (i64 (i8*, i8*)* @wrongtype4 to i8*),
  i8* bitcast (i64 (i8*, i128)* @wrongtype5 to i8*),
  i8* bitcast (i64 (i8*)* @usesthis to i8*),
  i8* bitcast (i8 (i8*)* @reads to i8*),
  i8* bitcast (i8* (i8*, i8)* @attributedFunc to i8*)
], !type !0

; M0: define i64 @ok1
; M1: define available_externally i64 @ok1
define i64 @ok1(i8* %this) {
  ret i64 42
}

; M0: define i64 @ok2
; M1: define available_externally i64 @ok2
define i64 @ok2(i8* %this, i64 %arg) {
  %1 = tail call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %arg, i64 %arg)
  ret i64 %arg
}

; M1: declare { i64, i1 } @llvm.sadd.with.overflow.i64(i64, i64)
declare { i64, i1 } @llvm.sadd.with.overflow.i64(i64, i64)

; M0: define void @wrongtype1
; M1: declare void @wrongtype1()
define void @wrongtype1(i8*) {
  ret void
}

; M0: define i128 @wrongtype2
; M1: declare void @wrongtype2()
define i128 @wrongtype2(i8*) {
  ret i128 0
}

; M0: define i64 @wrongtype3
; M1: declare void @wrongtype3()
define i64 @wrongtype3() {
  ret i64 0
}

; M0: define i64 @wrongtype4
; M1: declare void @wrongtype4()
define i64 @wrongtype4(i8*, i8*) {
  ret i64 0
}

; M0: define i64 @wrongtype5
; M1: declare void @wrongtype5()
define i64 @wrongtype5(i8*, i128) {
  ret i64 0
}

; M0: define i64 @usesthis
; M1: declare void @usesthis()
define i64 @usesthis(i8* %this) {
  %i = ptrtoint i8* %this to i64
  ret i64 %i
}

; M0: define i8 @reads
; M1: declare void @reads()
define i8 @reads(i8* %this) {
  %l = load i8, i8* %this
  ret i8 %l
}

; Check function attributes are copied over splitted module
; M0: declare dso_local noundef i8* @attributedFunc(i8* noalias, i8 zeroext) unnamed_addr #[[ATTR0:[0-9]+]]
; M1: declare dso_local void @attributedFunc() unnamed_addr #[[ATTR1:[0-9]+]]
declare dso_local noundef i8* @attributedFunc(i8* noalias, i8 zeroext) unnamed_addr alwaysinline willreturn
; M0: attributes #[[ATTR0]] = { alwaysinline willreturn }
; M1: attributes #[[ATTR1]] = { alwaysinline willreturn }

!0 = !{i32 0, !"typeid"}