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
88
89
90
91
92
93
94
95
96
97
98
|
; RUN: llvm-upgrade < %s | llvm-as | opt -globalopt -disable-output &&
; RUN: llvm-upgrade < %s | llvm-as | opt -globalopt | llvm-dis | not grep CTOR
%llvm.global_ctors = appending global [10 x { int, void ()* }] [
{ int, void ()* } { int 65535, void ()* %CTOR1 },
{ int, void ()* } { int 65535, void ()* %CTOR1 },
{ int, void ()* } { int 65535, void ()* %CTOR2 },
{ int, void ()* } { int 65535, void ()* %CTOR3 },
{ int, void ()* } { int 65535, void ()* %CTOR4 },
{ int, void ()* } { int 65535, void ()* %CTOR5 },
{ int, void ()* } { int 65535, void ()* %CTOR6 },
{ int, void ()* } { int 65535, void ()* %CTOR7 },
{ int, void ()* } { int 65535, void ()* %CTOR8 },
{ int, void ()* } { int 2147483647, void ()* null }
]
%G = global int 0
%G2 = global int 0
%G3 = global int -123
%X = global {int, [2 x int]} { int 0, [2 x int] [ int 17, int 21] }
%Y = global int -1
%Z = global int 123
%D = global double 0.0
%CTORGV = internal global bool false ;; Should become constant after eval
implementation
internal void %CTOR1() { ;; noop ctor, remove.
ret void
}
internal void %CTOR2() { ;; evaluate the store
%A = add int 1, 23
store int %A, int* %G
store bool true, bool* %CTORGV
ret void
}
internal void %CTOR3() {
%X = or bool true, false
br label %Cont
Cont:
br bool %X, label %S, label %T
S:
store int 24, int* %G2
ret void
T:
ret void
}
internal void %CTOR4() {
%X = load int* %G3
%Y = add int %X, 123
store int %Y, int* %G3
ret void
}
internal void %CTOR5() {
%X.2p = getelementptr {int,[2 x int]}* %X, int 0, uint 1, int 0
%X.2 = load int* %X.2p
%X.1p = getelementptr {int,[2 x int]}* %X, int 0, uint 0
store int %X.2, int* %X.1p
store int 42, int* %X.2p
ret void
}
internal void %CTOR6() {
%A = alloca int
%y = load int* %Y
store int %y, int* %A
%Av = load int* %A
%Av1 = add int %Av, 1
store int %Av1, int* %Y
ret void
}
internal void %CTOR7() {
call void %setto(int* %Z, int 0)
ret void
}
void %setto(int* %P, int %V) {
store int %V, int* %P
ret void
}
declare double %cos(double)
internal void %CTOR8() {
%X = call double %cos(double 1.0)
store double %X, double* %D
ret void
}
bool %accessor() {
%V = load bool* %CTORGV ;; constant true
ret bool %V
}
|