aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/Internalize/2008-05-09-AllButMain.ll
blob: 1101f997d738f929b593ebfbfa9c2533a6a556b2 (plain)
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
; No arguments means internalize all but main
; RUN: opt < %s -internalize -S | FileCheck --check-prefix=NOARGS %s

; Internalize all but foo and j
; RUN: opt < %s -internalize -internalize-public-api-list foo -internalize-public-api-list j -S | FileCheck --check-prefix=LIST %s

; Non existent files should be treated as if they were empty (so internalize all but main)
; RUN: opt < %s -internalize -internalize-public-api-file /nonexistent/file 2> /dev/null -S | FileCheck --check-prefix=EMPTYFILE %s

; RUN: opt < %s -S -internalize -internalize-public-api-list bar -internalize-public-api-list foo -internalize-public-api-file /nonexistent/file  2> /dev/null | FileCheck --check-prefix=LIST2 %s

; -file and -list options should be merged, the .apifile contains foo and j
; RUN: opt < %s -internalize -internalize-public-api-list bar -internalize-public-api-file %s.apifile -S | FileCheck --check-prefix=MERGE %s

; NOARGS: @i = internal global
; LIST: @i = internal global
; EMPTYFILE: @i = internal global
; LIST2: @i = internal global
; MERGE: @i = internal global
@i = global i32 0

; NOARGS: @j = internal global
; LIST: @j = global
; EMPTYFILE: @j = internal global
; LIST2: @j = internal global
; MERGE: @j = global
@j = global i32 0

; NOARGS: define void @main
; LIST: define internal void @main
; EMPTYFILE: define void @main
; LIST2: define internal void @main
; MERGE: define internal void @main
define void @main() {
        ret void
}

; NOARGS: define internal void @foo
; LIST: define void @foo
; EMPTYFILE: define internal void @foo
; LIST2: define void @foo
; MERGE: define void @foo
define void @foo() {
        ret void
}

; NOARGS: define internal void @bar
; LIST: define internal void @bar
; EMPTYFILE: define internal void @bar
; LIST2: define void @bar
; MERGE: define void @bar
define void @bar() {
        ret void
}