llvm.org GIT mirror llvm / ceca194
Remove llvm-upgrade and update tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48137 91177308-0d34-0410-b5e6-96231b3b80d8 Tanya Lattner 12 years ago
115 changed file(s) with 2628 addition(s) and 3189 deletion(s). Raw diff Collapse all Expand all
None ;; RUN: llvm-upgrade < %s | llvm-as | llc
0 ;; RUN: llvm-as < %s | llc
1 %llvm.dbg.anchor.type = type { i32, i32 }
2 %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 }
3 %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* }
4 %llvm.dbg.global_variable.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1, { }* }
5 %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 }
6 %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* }
7 @llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
8 @llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
9 @llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 52 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
10 @llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type {
11 i32 393262,
12 { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*),
13 { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*),
14 i8* getelementptr ([4 x i8]* @str, i32 0, i32 0),
15 i8* getelementptr ([4 x i8]* @str, i32 0, i32 0),
16 i8* null,
17 { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*),
18 i32 4,
19 { }* null,
20 i1 false,
21 i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
22 @str = internal constant [4 x i8] c"foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
23 @llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type {
24 i32 393233,
25 { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*),
26 i32 1,
27 i8* getelementptr ([11 x i8]* @str1, i32 0, i32 0),
28 i8* getelementptr ([50 x i8]* @str2, i32 0, i32 0),
29 i8* getelementptr ([45 x i8]* @str3, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
30 @str1 = internal constant [11 x i8] c"funccall.c\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
31 @str2 = internal constant [50 x i8] c"/Volumes/Big2/llvm/llvm/test/Regression/Debugger/\00", section "llvm.metadata" ; <[50 x i8]*> [#uses=1]
32 @str3 = internal constant [45 x i8] c"4.0.1 LLVM (Apple Computer, Inc. build 5421)\00", section "llvm.metadata" ; <[45 x i8]*> [#uses=1]
33 @llvm.dbg.variable = internal constant %llvm.dbg.variable.type {
34 i32 393472,
35 { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*),
36 i8* getelementptr ([2 x i8]* @str4, i32 0, i32 0),
37 { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*),
38 i32 5,
39 { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
40 @str4 = internal constant [2 x i8] c"t\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
41 @llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
42 i32 393252,
43 { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*),
44 i8* getelementptr ([4 x i8]* @str15, i32 0, i32 0),
45 { }* null,
46 i32 0,
47 i64 32,
48 i64 32,
49 i64 0,
50 i32 0,
51 i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
52 @str15 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
53 @llvm.dbg.subprogram2 = internal constant %llvm.dbg.subprogram.type {
54 i32 393262,
55 { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*),
56 { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*),
57 i8* getelementptr ([5 x i8]* @str6, i32 0, i32 0),
58 i8* getelementptr ([5 x i8]* @str6, i32 0, i32 0),
59 i8* null,
60 { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*),
61 i32 8,
62 { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*),
63 i1 false,
64 i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
65 @str6 = internal constant [5 x i8] c"main\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
66 @llvm.dbg.variable3 = internal constant %llvm.dbg.variable.type {
67 i32 393474,
68 { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram2 to { }*),
69 i8* getelementptr ([7 x i8]* @str7, i32 0, i32 0),
70 { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*),
71 i32 8,
72 { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
73 @str7 = internal constant [7 x i8] c"retval\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
74 @llvm.dbg.global_variable = internal constant %llvm.dbg.global_variable.type {
75 i32 393268,
76 { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.global_variables to { }*),
77 { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*),
78 i8* getelementptr ([2 x i8]* @str4, i32 0, i32 0),
79 i8* getelementptr ([2 x i8]* @str4, i32 0, i32 0),
80 i8* null,
81 { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*),
82 i32 2,
83 { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*),
84 i1 true,
85 i1 true,
86 { }* bitcast (i32* @q to { }*) }, section "llvm.metadata" ; <%llvm.dbg.global_variable.type*> [#uses=0]
87 @str4.upgrd.1 = internal constant [2 x i8] c"q\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=0]
88 @q = internal global i32 0 ; [#uses=7]
189
2 ;; Debugger type declarations
3 %llvm.dbg.anchor.type = type { uint, uint }
4 %llvm.dbg.basictype.type = type { uint, { }*, sbyte*, { }*, uint, ulong, ulong, ulong, uint, uint }
5 %llvm.dbg.compile_unit.type = type { uint, { }*, uint, sbyte*, sbyte*, sbyte* }
6 %llvm.dbg.global_variable.type = type { uint, { }*, { }*, sbyte*, sbyte*, sbyte*, { }*, uint, { }*, bool, bool, { }* }
7 %llvm.dbg.subprogram.type = type { uint, { }*, { }*, sbyte*, sbyte*, sbyte*, { }*, uint, { }*, bool, bool }
8 %llvm.dbg.variable.type = type { uint, { }*, sbyte*, { }*, uint, { }* }
90 declare void @llvm.dbg.func.start({ }*)
991
10 ;; Debugger intrinsic declarations...
11 declare void %llvm.dbg.func.start({ }*)
12 declare void %llvm.dbg.stoppoint(uint, uint, { }*)
13 declare void %llvm.dbg.declare({ }*, { }*)
14 declare void %llvm.dbg.region.start({ }*)
15 declare void %llvm.dbg.region.end({ }*)
92 declare void @llvm.dbg.stoppoint(i32, i32, { }*)
1693
17 ;; Debugger anchors
18 %llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type {
19 uint 393216, ;; DW_TAG_anchor | version(6)
20 uint 46 }, section "llvm.metadata" ;; DW_TAG_subprogram
21 %llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type {
22 uint 393216, ;; DW_TAG_anchor | version(6)
23 uint 17 }, section "llvm.metadata" ;; DW_TAG_compile_unit
24 %llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type {
25 uint 393216, ;; DW_TAG_anchor | version(6)
26 uint 52 }, section "llvm.metadata" ;; DW_TAG_variable
94 declare void @llvm.dbg.declare({ }*, { }*)
2795
28 ;; Debug info
29 %llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type {
30 uint 393262, ;; DW_TAG_subprogram | version(6)
31 { }* bitcast (%llvm.dbg.anchor.type* %llvm.dbg.subprograms to { }*), ;; Anchor
32 { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*),;; Context
33 sbyte* getelementptr ([4 x sbyte]* %str, int 0, int 0), ;; Name
34 sbyte* getelementptr ([4 x sbyte]* %str, int 0, int 0), ;; Fully quanlified name
35 sbyte* null, ;; Linkage name
36 { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*),;; Compile unit
37 uint 4, ;; Line number
38 { }* null, ;; Type descriptor
39 bool false, ;; Static?
40 bool true }, section "llvm.metadata" ;; External?
41 %str = internal constant [4 x sbyte] c"foo\00", section "llvm.metadata"
42
43 %llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type {
44 uint 393233, ;; DW_TAG_compile_unit | version(6)
45 { }* bitcast (%llvm.dbg.anchor.type* %llvm.dbg.compile_units to { }*), ;; Anchor
46 uint 1, ;; Language
47 sbyte* getelementptr ([11 x sbyte]* %str, int 0, int 0), ;; Source file
48 sbyte* getelementptr ([50 x sbyte]* %str, int 0, int 0), ;; Source file directory
49 sbyte* getelementptr ([45 x sbyte]* %str, int 0, int 0) }, section "llvm.metadata" ;; Produceer
50 %str = internal constant [11 x sbyte] c"funccall.c\00", section "llvm.metadata"
51 %str = internal constant [50 x sbyte] c"/Volumes/Big2/llvm/llvm/test/Regression/Debugger/\00", section "llvm.metadata"
52 %str = internal constant [45 x sbyte] c"4.0.1 LLVM (Apple Computer, Inc. build 5421)\00", section "llvm.metadata"
96 declare void @llvm.dbg.region.start({ }*)
5397
54 %llvm.dbg.variable = internal constant %llvm.dbg.variable.type {
55 uint 393472, ;; DW_TAG_auto_variable | version(6)
56 { }* bitcast (%llvm.dbg.subprogram.type* %llvm.dbg.subprogram to { }*), ;; Context
57 sbyte* getelementptr ([2 x sbyte]* %str, int 0, int 0), ;; Name
58 { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*),;; Compile unit
59 uint 5, ;; Line number
60 { }* bitcast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to { }*) }, section "llvm.metadata" ;; Type
61 %str = internal constant [2 x sbyte] c"t\00", section "llvm.metadata"
98 declare void @llvm.dbg.region.end({ }*)
6299
63 %llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
64 uint 393252, ;; DW_TAG_base_type | version(6)
65 { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*),;; Context
66 sbyte* getelementptr ([4 x sbyte]* %str1, int 0, int 0), ;; Name
67 { }* null, ;; Compile Unit
68 uint 0, ;; Line number
69 ulong 32, ;; Size in bits
70 ulong 32, ;; Align in bits
71 ulong 0, ;; Offset in bits
72 uint 0, ;; Flags
73 uint 5 }, section "llvm.metadata" ;; Basic type encoding
74 %str1 = internal constant [4 x sbyte] c"int\00", section "llvm.metadata"
75
76 %llvm.dbg.subprogram2 = internal constant %llvm.dbg.subprogram.type {
77 uint 393262, ;; DW_TAG_subprogram | version(6)
78 { }* bitcast (%llvm.dbg.anchor.type* %llvm.dbg.subprograms to { }*), ;; Anchor
79 { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*),;; Context
80 sbyte* getelementptr ([5 x sbyte]* %str, int 0, int 0), ;; Name
81 sbyte* getelementptr ([5 x sbyte]* %str, int 0, int 0), ;; Fully quanlified name
82 sbyte* null, ;; Linkage name
83 { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*),;; Compile unit
84 uint 8, ;; Line number
85 { }* bitcast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to { }*), ;; Type descriptor
86 bool false, ;; Static?
87 bool true }, section "llvm.metadata" ;; External?
88 %str = internal constant [5 x sbyte] c"main\00", section "llvm.metadata"
89
90 %llvm.dbg.variable3 = internal constant %llvm.dbg.variable.type {
91 uint 393474, ;; DW_TAG_return_variable | version(6)
92 { }* bitcast (%llvm.dbg.subprogram.type* %llvm.dbg.subprogram2 to { }*), ;; Context
93 sbyte* getelementptr ([7 x sbyte]* %str, int 0, int 0), ;; Name
94 { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*),;; Compile unit
95 uint 8, ;; Line number
96 { }* bitcast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to { }*) }, section "llvm.metadata" ;; Type
97 %str = internal constant [7 x sbyte] c"retval\00", section "llvm.metadata"
98
99 %llvm.dbg.global_variable = internal constant %llvm.dbg.global_variable.type {
100 uint 393268, ;; DW_TAG_variable | version(6)
101 { }* bitcast (%llvm.dbg.anchor.type* %llvm.dbg.global_variables to { }*), ;; Anchor
102 { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*),;; Context
103 sbyte* getelementptr ([2 x sbyte]* %str4, int 0, int 0), ;; Name
104 sbyte* getelementptr ([2 x sbyte]* %str4, int 0, int 0), ;; Fully qualified name
105 sbyte* null, ;; Linkage name
106 { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*),;; Compile unit
107 uint 2, ;; Line number
108 { }* bitcast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to { }*), ;; Type
109 bool true, ;; Static?
110 bool true, ;; External?
111 { }* bitcast (int* %q to { }*) }, section "llvm.metadata" ;; Variable
112 %str4 = internal constant [2 x sbyte] c"q\00", section "llvm.metadata"
113
114 ;; Global
115 %q = internal global int 0
116
117 implementation
118
119 void %foo() {
100 define void @foo() {
120101 entry:
121 %t = alloca int, align 4
122 "alloca point" = bitcast int 0 to int
123 call void %llvm.dbg.func.start( { }* bitcast (%llvm.dbg.subprogram.type* %llvm.dbg.subprogram to { }*) )
124 call void %llvm.dbg.stoppoint( uint 4, uint 0, { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*) )
125 %t = bitcast int* %t to { }*
126 call void %llvm.dbg.declare( { }* %t, { }* bitcast (%llvm.dbg.variable.type* %llvm.dbg.variable to { }*) )
127 call void %llvm.dbg.stoppoint( uint 5, uint 0, { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*) )
128 %tmp = load int* %q
129 store int %tmp, int* %t
130 call void %llvm.dbg.stoppoint( uint 6, uint 0, { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*) )
131 %tmp1 = load int* %t
132 %tmp2 = add int %tmp1, 1
133 store int %tmp2, int* %q
134 call void %llvm.dbg.stoppoint( uint 7, uint 0, { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*) )
135 call void %llvm.dbg.region.end( { }* bitcast (%llvm.dbg.subprogram.type* %llvm.dbg.subprogram to { }*) )
102 %t = alloca i32, align 4 ; [#uses=3]
103 %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
104 call void @llvm.dbg.func.start( { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*) )
105 call void @llvm.dbg.stoppoint( i32 4, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*) )
106 %t.upgrd.2 = bitcast i32* %t to { }* ; <{ }*> [#uses=1]
107 call void @llvm.dbg.declare( { }* %t.upgrd.2, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable to { }*) )
108 call void @llvm.dbg.stoppoint( i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*) )
109 %tmp = load i32* @q ; [#uses=1]
110 store i32 %tmp, i32* %t
111 call void @llvm.dbg.stoppoint( i32 6, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*) )
112 %tmp1 = load i32* %t ; [#uses=1]
113 %tmp2 = add i32 %tmp1, 1 ; [#uses=1]
114 store i32 %tmp2, i32* @q
115 call void @llvm.dbg.stoppoint( i32 7, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*) )
116 call void @llvm.dbg.region.end( { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*) )
136117 ret void
137118 }
138119
139 int %main() {
120 define i32 @main() {
140121 entry:
141 %retval = alloca int, align 4
142 %tmp = alloca int, align 4
143 "alloca point" = bitcast int 0 to int
144 call void %llvm.dbg.func.start( { }* bitcast (%llvm.dbg.subprogram.type* %llvm.dbg.subprogram2 to { }*) )
145 call void %llvm.dbg.stoppoint( uint 8, uint 0, { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*) )
146 %retval = bitcast int* %retval to { }*
147 call void %llvm.dbg.declare( { }* %retval, { }* bitcast (%llvm.dbg.variable.type* %llvm.dbg.variable3 to { }*) )
148 call void %llvm.dbg.stoppoint( uint 9, uint 0, { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*) )
149 store int 0, int* %q
150 call void %llvm.dbg.stoppoint( uint 10, uint 0, { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*) )
151 call void (...)* bitcast (void ()* %foo to void (...)*)( )
152 call void %llvm.dbg.stoppoint( uint 11, uint 0, { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*) )
153 %tmp = load int* %q
154 %tmp1 = sub int %tmp, 1
155 store int %tmp1, int* %q
156 call void %llvm.dbg.stoppoint( uint 13, uint 0, { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*) )
157 %tmp2 = load int* %q
158 store int %tmp2, int* %tmp
159 %tmp3 = load int* %tmp
160 store int %tmp3, int* %retval
161 %retval = load int* %retval
162 call void %llvm.dbg.stoppoint( uint 14, uint 0, { }* bitcast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*) )
163 call void %llvm.dbg.region.end( { }* bitcast (%llvm.dbg.subprogram.type* %llvm.dbg.subprogram2 to { }*) )
164 ret int %retval
122 %retval = alloca i32, align 4 ; [#uses=3]
123 %tmp = alloca i32, align 4 ; [#uses=2]
124 %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
125 call void @llvm.dbg.func.start( { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram2 to { }*) )
126 call void @llvm.dbg.stoppoint( i32 8, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*) )
127 %retval.upgrd.3 = bitcast i32* %retval to { }* ; <{ }*> [#uses=1]
128 call void @llvm.dbg.declare( { }* %retval.upgrd.3, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable3 to { }*) )
129 call void @llvm.dbg.stoppoint( i32 9, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*) )
130 store i32 0, i32* @q
131 call void @llvm.dbg.stoppoint( i32 10, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*) )
132 call void (...)* bitcast (void ()* @foo to void (...)*)( )
133 call void @llvm.dbg.stoppoint( i32 11, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*) )
134 %tmp.upgrd.4 = load i32* @q ; [#uses=1]
135 %tmp1 = sub i32 %tmp.upgrd.4, 1 ; [#uses=1]
136 store i32 %tmp1, i32* @q
137 call void @llvm.dbg.stoppoint( i32 13, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*) )
138 %tmp2 = load i32* @q ; [#uses=1]
139 store i32 %tmp2, i32* %tmp
140 %tmp3 = load i32* %tmp ; [#uses=1]
141 store i32 %tmp3, i32* %retval
142 %retval.upgrd.5 = load i32* %retval ; [#uses=1]
143 call void @llvm.dbg.stoppoint( i32 14, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*) )
144 call void @llvm.dbg.region.end( { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram2 to { }*) )
145 ret i32 %retval.upgrd.5
165146 }
None ; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3 %.LC0 = internal global [10 x sbyte] c"argc: %d\0A\00"
3 @.LC0 = internal global [10 x i8] c"argc: %d\0A\00" ; <[10 x i8]*> [#uses=1]
44
5 implementation ; Functions:
5 declare i32 @puts(i8*)
66
7 declare int %puts(sbyte*)
8
9 void %getoptions(int* %argc) {
10 bb0: ; No predecessors!
7 define void @getoptions(i32* %argc) {
8 bb0:
119 ret void
1210 }
1311
14 declare int %printf(sbyte*, ...)
12 declare i32 @printf(i8*, ...)
1513
16 int %main(int %argc, sbyte** %argv) {
17 bb0: ; No predecessors!
18 call int (sbyte*, ...)* %printf( sbyte* getelementptr ([10 x sbyte]* %.LC0, long 0, long 0), int %argc)
19 %cast224 = cast sbyte** %argv to sbyte* ; [#uses=1]
20 %local = alloca sbyte* ; [#uses=3]
21 store sbyte* %cast224, sbyte** %local
22 %cond226 = setle int %argc, 0 ; [#uses=1]
23 br bool %cond226, label %bb3, label %bb2
24
14 define i32 @main(i32 %argc, i8** %argv) {
15 bb0:
16 call i32 (i8*, ...)* @printf( i8* getelementptr ([10 x i8]* @.LC0, i64 0, i64 0), i32 %argc ) ; :0 [#uses=0]
17 %cast224 = bitcast i8** %argv to i8* ; [#uses=1]
18 %local = alloca i8* ; [#uses=3]
19 store i8* %cast224, i8** %local
20 %cond226 = icmp sle i32 %argc, 0 ; [#uses=1]
21 br i1 %cond226, label %bb3, label %bb2
2522 bb2: ; preds = %bb2, %bb0
26 %cann-indvar = phi int [ 0, %bb0 ], [ %add1-indvar, %bb2 ] ; [#uses=2]
27 %add1-indvar = add int %cann-indvar, 1 ; [#uses=2]
28 %cann-indvar-idxcast = cast int %cann-indvar to long ; [#uses=1]
29 ;%reg115 = load sbyte** %local ; [#uses=1]
30 ;%cann-indvar-idxcast-scale = mul long %cann-indvar-idxcast, 8 ; [#uses=1]
31 ;%reg232 = getelementptr sbyte* %reg115, long %cann-indvar-idxcast-scale ; [#uses=1]
32 ;%cast235 = cast sbyte* %reg232 to sbyte** ; [#uses=1]
33 %CT = cast sbyte** %local to sbyte***
34 %reg115 = load sbyte*** %CT
35 %cast235 = getelementptr sbyte** %reg115, long %cann-indvar-idxcast
36
37 %reg117 = load sbyte** %cast235 ; [#uses=1]
38 %reg236 = call int %puts( sbyte* %reg117 ) ; [#uses=0]
39 %cond239 = setlt int %add1-indvar, %argc ; [#uses=1]
40 br bool %cond239, label %bb2, label %bb3
41
23 %cann-indvar = phi i32 [ 0, %bb0 ], [ %add1-indvar, %bb2 ] ; [#uses=2]
24 %add1-indvar = add i32 %cann-indvar, 1 ; [#uses=2]
25 %cann-indvar-idxcast = sext i32 %cann-indvar to i64 ; [#uses=1]
26 %CT = bitcast i8** %local to i8*** ; [#uses=1]
27 %reg115 = load i8*** %CT ; [#uses=1]
28 %cast235 = getelementptr i8** %reg115, i64 %cann-indvar-idxcast ; [#uses=1]
29 %reg117 = load i8** %cast235 ; [#uses=1]
30 %reg236 = call i32 @puts( i8* %reg117 ) ; [#uses=0]
31 %cond239 = icmp slt i32 %add1-indvar, %argc ; [#uses=1]
32 br i1 %cond239, label %bb2, label %bb3
4233 bb3: ; preds = %bb2, %bb0
43 %cast243 = cast sbyte** %local to int* ; [#uses=1]
44 call void %getoptions( int* %cast243 )
45 ret int 0
34 %cast243 = bitcast i8** %local to i32* ; [#uses=1]
35 call void @getoptions( i32* %cast243 )
36 ret i32 0
4637 }
None ; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3
4 implementation ; Functions:
5
6 int %foo(int %X, int %Y, double %A) {
7 %cond212 = setne double %A, 1.000000e+00 ; [#uses=1]
8 %cast110 = cast bool %cond212 to int ; [#uses=1]
9 ret int %cast110
3 define i32 @foo(i32 %X, i32 %Y, double %A) {
4 %cond212 = fcmp une double %A, 1.000000e+00 ; [#uses=1]
5 %cast110 = zext i1 %cond212 to i32 ; [#uses=1]
6 ret i32 %cast110
107 }
118
12 int %main() {
13 %reg212 = call int %foo( int 0, int 1, double 1.000000e+00 ) ; [#uses=1]
14 ret int %reg212
9 define i32 @main() {
10 %reg212 = call i32 @foo( i32 0, i32 1, double 1.000000e+00 ) ; [#uses=1]
11 ret i32 %reg212
1512 }
13
None ; RUN: llvm-upgrade < %s | llvm-as -o %t.bc -f
0 ; RUN: llvm-as < %s -o %t.bc -f
11 ; RUN: lli %t.bc > /dev/null
22
3 implementation
4
5 int %main() {
6 call int %mylog(int 4)
7 ret int 0
3 define i32 @main() {
4 call i32 @mylog( i32 4 ) ; :1 [#uses=0]
5 ret i32 0
86 }
97
10 internal int %mylog(int %num) {
11 bb0: ; No predecessors!
8 define internal i32 @mylog(i32 %num) {
9 bb0:
1210 br label %bb2
13
14 bb2:
15 %reg112 = phi int [ 10, %bb2 ], [ 1, %bb0 ]
16 %cann-indvar = phi int [ %cann-indvar, %bb2 ], [0, %bb0]
17 %reg114 = add int %reg112, 1
18 %cond222 = setlt int %reg114, %num
19 br bool %cond222, label %bb2, label %bb3
20
21 bb3: ; preds = %bb2, %bb0
22 ret int %reg114
11 bb2: ; preds = %bb2, %bb0
12 %reg112 = phi i32 [ 10, %bb2 ], [ 1, %bb0 ] ; [#uses=1]
13 %cann-indvar = phi i32 [ %cann-indvar, %bb2 ], [ 0, %bb0 ] ; [#uses=1]
14 %reg114 = add i32 %reg112, 1 ; [#uses=2]
15 %cond222 = icmp slt i32 %reg114, %num ; [#uses=1]
16 br i1 %cond222, label %bb2, label %bb3
17 bb3: ; preds = %bb2
18 ret i32 %reg114
2319 }
2420
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3 int %main() {
3 define i32 @main() {
4 ;
45 br label %Loop
5 Loop:
6 %X = phi int [0, %0], [1, %Loop]
7 br bool true, label %Out, label %Loop
8 Out:
9 ret int %X
6 Loop: ; preds = %Loop, %0
7 %X = phi i32 [ 0, %0 ], [ 1, %Loop ] ; [#uses=1]
8 br i1 true, label %Out, label %Loop
9 Out: ; preds = %Loop
10 ret i32 %X
1011 }
12
None ; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
33 ; We were accidentally inverting the signedness of right shifts. Whoops.
44
5 int %main() {
6 %X = shr int -1, ubyte 16
7 %Y = shr int %X, ubyte 16
8 %Z = add int %Y, 1
9 ret int %Z
5 define i32 @main() {
6 %X = ashr i32 -1, 16 ; [#uses=1]
7 %Y = ashr i32 %X, 16 ; [#uses=1]
8 %Z = add i32 %Y, 1 ; [#uses=1]
9 ret i32 %Z
1010 }
11
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3 define i32 @main() {
4 %X = add double 0.000000e+00, 1.000000e+00 ; [#uses=1]
5 %Y = sub double 0.000000e+00, 1.000000e+00 ; [#uses=2]
6 %Z = fcmp oeq double %X, %Y ; [#uses=0]
7 add double %Y, 0.000000e+00 ; :1 [#uses=0]
8 ret i32 0
9 }
310
4 int %main() {
5 %X = add double 0.0, 1.0
6 %Y = sub double 0.0, 1.0
7 %Z = seteq double %X, %Y
8 add double %Y, 0.0
9 ret int 0
10 }
None ; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3
4 int %bar(sbyte* %X) {
5 %P = alloca double ; pointer should be 4 byte aligned!
6 %R = cast double* %P to int
7 %A = and int %R, 3
8 ret int %A
3 define i32 @bar(i8* %X) {
4 ; pointer should be 4 byte aligned!
5 %P = alloca double ; [#uses=1]
6 %R = ptrtoint double* %P to i32 ; [#uses=1]
7 %A = and i32 %R, 3 ; [#uses=1]
8 ret i32 %A
99 }
1010
11 int %main() {
12 %SP = alloca sbyte
13 %X = add uint 0, 0
14 alloca sbyte, uint %X
15
16 call int %bar(sbyte* %SP)
17 ret int %0
11 define i32 @main() {
12 %SP = alloca i8 ; [#uses=1]
13 %X = add i32 0, 0 ; [#uses=1]
14 alloca i8, i32 %X ; :1 [#uses=0]
15 call i32 @bar( i8* %SP ) ; :2 [#uses=1]
16 ret i32 %2
1817 }
0 ; This testcase shoudl return with an exit code of 1.
11 ;
2 ; RUN: llvm-upgrade < %s | llvm-as | not lli
2 ; RUN: llvm-as < %s | not lli
33
4 %test = global long 0
5 implementation
4 @test = global i64 0 ; [#uses=1]
5
6 define internal i64 @test.upgrd.1() {
7 %tmp.0 = load i64* @test ; [#uses=1]
8 %tmp.1 = add i64 %tmp.0, 1 ; [#uses=1]
9 ret i64 %tmp.1
10 }
11
12 define i32 @main() {
13 %L = call i64 @test.upgrd.1( ) ; [#uses=1]
14 %I = trunc i64 %L to i32 ; [#uses=1]
15 ret i32 %I
16 }
617
718
8 internal long %test() {
9 %tmp.0 = load long* %test ; [#uses=1]
10 %tmp.1 = add long %tmp.0, 1 ; [#uses=1]
11 ret long %tmp.1
12 }
13
14 int %main() {
15 %L = call long %test()
16 %I = cast long %L to int
17 ret int %I
18 }
19
None ; RUN: llvm-upgrade < %s | llvm-as | lli - test
0 ; RUN: llvm-as < %s | lli - test
11
2 implementation
2 declare i32 @puts(i8*)
33
4 declare int %puts(sbyte*)
5
6 int %main(int %argc.1, sbyte** %argv.1) {
7 %tmp.5 = getelementptr sbyte** %argv.1, long 1 ; [#uses=1]
8 %tmp.6 = load sbyte** %tmp.5 ; [#uses=1]
9 %tmp.0 = call int %puts( sbyte* %tmp.6 ) ; [#uses=0]
10 ret int 0
4 define i32 @main(i32 %argc.1, i8** %argv.1) {
5 %tmp.5 = getelementptr i8** %argv.1, i64 1 ; [#uses=1]
6 %tmp.6 = load i8** %tmp.5 ; [#uses=1]
7 %tmp.0 = call i32 @puts( i8* %tmp.6 ) ; [#uses=0]
8 ret i32 0
119 }
1210
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3 target endian = little
4 target pointersize = 32
3 target datalayout = "e-p:32:32"
54
6 implementation
7
8 int %main() {
5 define i32 @main() {
96 entry:
107 br label %endif
11 then:
8 then: ; No predecessors!
129 br label %endif
13 endif:
14 %x = phi uint [ 4, %entry ], [ 27, %then ]
15 %result = phi int [ 32, %then ], [ 0, %entry ]
16 ret int 0
10 endif: ; preds = %then, %entry
11 %x = phi i32 [ 4, %entry ], [ 27, %then ] ; [#uses=0]
12 %result = phi i32 [ 32, %then ], [ 0, %entry ] ; [#uses=0]
13 ret i32 0
1714 }
15
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
33 ; Testcase distilled from 256.bzip2.
44
5 target endian = little
6 target pointersize = 32
5 target datalayout = "e-p:32:32"
76
8 int %main() {
7 define i32 @main() {
98 entry:
109 br label %loopentry.0
10 loopentry.0: ; preds = %loopentry.0, %entry
11 %h.0 = phi i32 [ %tmp.2, %loopentry.0 ], [ -1, %entry ] ; [#uses=1]
12 %tmp.2 = add i32 %h.0, 1 ; [#uses=3]
13 %tmp.4 = icmp ne i32 %tmp.2, 0 ; [#uses=1]
14 br i1 %tmp.4, label %loopentry.0, label %loopentry.1
15 loopentry.1: ; preds = %loopentry.0
16 %h.1 = phi i32 [ %tmp.2, %loopentry.0 ] ; [#uses=1]
17 ret i32 %h.1
18 }
1119
12 loopentry.0:
13 %h.0 = phi int [ %tmp.2, %loopentry.0 ], [ -1, %entry ]
14 %tmp.2 = add int %h.0, 1
15 %tmp.4 = setne int %tmp.2, 0
16 br bool %tmp.4, label %loopentry.0, label %loopentry.1
17
18 loopentry.1:
19 %h.1 = phi int [ %tmp.2, %loopentry.0 ]
20 ret int %h.1
21 }
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
33 ; Testcase distilled from 256.bzip2.
44
5 target endian = little
6 target pointersize = 32
5 target datalayout = "e-p:32:32"
76
8 int %main() {
7 define i32 @main() {
98 entry:
10 %X = add int 1, -1
9 %X = add i32 1, -1 ; [#uses=3]
1110 br label %Next
11 Next: ; preds = %entry
12 %A = phi i32 [ %X, %entry ] ; [#uses=0]
13 %B = phi i32 [ %X, %entry ] ; [#uses=0]
14 %C = phi i32 [ %X, %entry ] ; [#uses=1]
15 ret i32 %C
16 }
1217
13 Next:
14 %A = phi int [ %X, %entry ]
15 %B = phi int [ %X, %entry ]
16 %C = phi int [ %X, %entry ]
17 ret int %C
18 }
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
33 ; This testcase failed to work because two variable sized allocas confused the
44 ; local register allocator.
55
6 int %main(uint %X) {
7 %A = alloca uint, uint %X
6 define i32 @main(i32 %X) {
7 %A = alloca i32, i32 %X ; [#uses=0]
8 %B = alloca float, i32 %X ; [#uses=0]
9 ret i32 0
10 }
811
9 %B = alloca float, uint %X
10 ret int 0
11 }
None ; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
33 ;
88 ; environment to the main() function.
99 ;
1010
11 implementation
1211
13 declare uint %strlen(sbyte*)
12 declare i32 @strlen(i8*)
1413
15 int %main(int %argc.1, sbyte** %argv.1, sbyte** %envp.1) {
16 %tmp.2 = load sbyte** %envp.1
17 %tmp.3 = call uint %strlen( sbyte* %tmp.2 )
18 %T = seteq uint %tmp.3, 0
19 %R = cast bool %T to int
20 ret int %R
14 define i32 @main(i32 %argc.1, i8** %argv.1, i8** %envp.1) {
15 %tmp.2 = load i8** %envp.1 ; [#uses=1]
16 %tmp.3 = call i32 @strlen( i8* %tmp.2 ) ; [#uses=1]
17 %T = icmp eq i32 %tmp.3, 0 ; [#uses=1]
18 %R = zext i1 %T to i32 ; [#uses=1]
19 ret i32 %R
2120 }
2221
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
33 ; This testcase exposes a bug in the local register allocator where it runs out
44 ; of registers (due to too many overlapping live ranges), but then attempts to
55 ; use the ESP register (which is not allocatable) to hold a value.
66
7 int %main(uint %A) {
8 %Ap2 = alloca uint, uint %A ; ESP gets used again...
9 %B = add uint %A, 1 ; Produce lots of overlapping live ranges
10 %C = add uint %A, 2
11 %D = add uint %A, 3
12 %E = add uint %A, 4
13 %F = add uint %A, 5
14 %G = add uint %A, 6
15 %H = add uint %A, 7
16 %I = add uint %A, 8
17 %J = add uint %A, 9
18 %K = add uint %A, 10
19
20 store uint %A, uint *%Ap2 ; Uses of all of the values
21 store uint %B, uint *%Ap2
22 store uint %C, uint *%Ap2
23 store uint %D, uint *%Ap2
24 store uint %E, uint *%Ap2
25 store uint %F, uint *%Ap2
26 store uint %G, uint *%Ap2
27 store uint %H, uint *%Ap2
28 store uint %I, uint *%Ap2
29 store uint %J, uint *%Ap2
30 store uint %K, uint *%Ap2
31 ret int 0
7 define i32 @main(i32 %A) {
8 ; ESP gets used again...
9 %Ap2 = alloca i32, i32 %A ; [#uses=11]
10 ; Produce lots of overlapping live ranges
11 %B = add i32 %A, 1 ; [#uses=1]
12 %C = add i32 %A, 2 ; [#uses=1]
13 %D = add i32 %A, 3 ; [#uses=1]
14 %E = add i32 %A, 4 ; [#uses=1]
15 %F = add i32 %A, 5 ; [#uses=1]
16 %G = add i32 %A, 6 ; [#uses=1]
17 %H = add i32 %A, 7 ; [#uses=1]
18 %I = add i32 %A, 8 ; [#uses=1]
19 %J = add i32 %A, 9 ; [#uses=1]
20 %K = add i32 %A, 10 ; [#uses=1]
21 ; Uses of all of the values
22 store i32 %A, i32* %Ap2
23 store i32 %B, i32* %Ap2
24 store i32 %C, i32* %Ap2
25 store i32 %D, i32* %Ap2
26 store i32 %E, i32* %Ap2
27 store i32 %F, i32* %Ap2
28 store i32 %G, i32* %Ap2
29 store i32 %H, i32* %Ap2
30 store i32 %I, i32* %Ap2
31 store i32 %J, i32* %Ap2
32 store i32 %K, i32* %Ap2
33 ret i32 0
3234 }
None ; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3 %A = global int 0
3 @A = global i32 0 ; [#uses=1]
44
5 int %main() {
6 %Ret = call int %test(bool true, int 0)
7 ret int %Ret
5 define i32 @main() {
6 %Ret = call i32 @test( i1 true, i32 0 ) ; [#uses=1]
7 ret i32 %Ret
88 }
99
10 int %test(bool %c, int %A) {
11 br bool %c, label %Taken1, label %NotTaken
10 define i32 @test(i1 %c, i32 %A) {
11 br i1 %c, label %Taken1, label %NotTaken
12 Cont: ; preds = %Taken1, %NotTaken
13 %V = phi i32 [ 0, %NotTaken ], [ sub (i32 ptrtoint (i32* @A to i32), i32 1234), %Taken1 ] ; [#uses=0]
14 ret i32 0
15 NotTaken: ; preds = %0
16 br label %Cont
17 Taken1: ; preds = %0
18 %B = icmp eq i32 %A, 0 ; [#uses=1]
19 br i1 %B, label %Cont, label %ExitError
20 ExitError: ; preds = %Taken1
21 ret i32 12
22 }
1223
13 Cont:
14 %V = phi int [0, %NotTaken],
15 [ sub (int cast (int* %A to int), int 1234), %Taken1]
16 ret int 0
17
18 NotTaken:
19 br label %Cont
20
21 Taken1:
22 %B = seteq int %A, 0
23 ; Code got inserted here, breaking the condition code.
24 br bool %B, label %Cont, label %ExitError
25
26 ExitError:
27 ret int 12
28
29 }
0 ; PR672
1 ; RUN: llvm-upgrade < %s | llvm-as | lli
1 ; RUN: llvm-as < %s | lli
22
3 int %main(){
4 %f = cast int (int, int*, int)* %check_tail to int*
5 %res = tail call fastcc int %check_tail( int 10, int* %f,int 10)
6 ret int %res
3 define i32 @main() {
4 %f = bitcast i32 (i32, i32*, i32)* @check_tail to i32* ; [#uses=1]
5 %res = tail call fastcc i32 @check_tail( i32 10, i32* %f, i32 10 ) ; [#uses=1]
6 ret i32 %res
77 }
8 fastcc int %check_tail(int %x, int* %f, int %g) {
9 %tmp1 = setgt int %x, 0
10 br bool %tmp1, label %if-then, label %if-else
118
12 if-then:
13 %fun_ptr = cast int* %f to int(int, int*, int)*
14 %arg1 = add int %x, -1
15 %res = tail call fastcc int %fun_ptr( int %arg1, int * %f, int %g)
16 ret int %res
9 define fastcc i32 @check_tail(i32 %x, i32* %f, i32 %g) {
10 %tmp1 = icmp sgt i32 %x, 0 ; [#uses=1]
11 br i1 %tmp1, label %if-then, label %if-else
12 if-then: ; preds = %0
13 %fun_ptr = bitcast i32* %f to i32 (i32, i32*, i32)* ; [#uses=1]
14 %arg1 = add i32 %x, -1 ; [#uses=1]
15 %res = tail call fastcc i32 %fun_ptr( i32 %arg1, i32* %f, i32 %g ) ; [#uses=1]
16 ret i32 %res
17 if-else: ; preds = %0
18 ret i32 %x
19 }
1720
18 if-else:
19 ret int %x
20 }
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3 %.LC0 = internal global [12 x sbyte] c"Hello World\00"
3 @.LC0 = internal global [12 x i8] c"Hello World\00" ; <[12 x i8]*> [#uses=1]
44
5 implementation
5 declare i32 @puts(i8*)
66
7 declare int %puts(sbyte*)
8
9 int %main() {
10 %reg210 = call int %puts( sbyte* getelementptr ([12 x sbyte]* %.LC0, long 0, long 0) )
11 ret int 0
7 define i32 @main() {
8 %reg210 = call i32 @puts( i8* getelementptr ([12 x i8]* @.LC0, i64 0, i64 0) ) ; [#uses=0]
9 ret i32 0
1210 }
1311
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3 @X = global i32 7 ; [#uses=0]
4 @msg = internal global [13 x i8] c"Hello World\0A\00" ; <[13 x i8]*> [#uses=1]
35
4 %X = global int 7
5 %msg = internal global [13 x sbyte] c"Hello World\0A\00"
6 declare void @printf([13 x i8]*, ...)
67
7
8 implementation
9
10 declare void %printf([13 x sbyte]*,...)
11
12 void %bar() {
13 call void([13 x sbyte]*,...)* %printf([13 x sbyte]* %msg)
14 ret void
8 define void @bar() {
9 call void ([13 x i8]*, ...)* @printf( [13 x i8]* @msg )
10 ret void
1511 }
1612
17 int %main() {
18 call void %bar()
19 ret int 0
13 define i32 @main() {
14 call void @bar( )
15 ret i32 0
2016 }
2117
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3
4 implementation
5
6 int %main() {
7 ret int 0
3 define i32 @main() {
4 ret i32 0
85 }
96
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3 implementation
4
5 int %bar() { ret int 0 }
6
7 int %main() {
8 %r = call int %bar()
9 ret int %r
3 define i32 @bar() {
4 ret i32 0
105 }
116
7 define i32 @main() {
8 %r = call i32 @bar( ) ; [#uses=1]
9 ret i32 %r
10 }
11
None ; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3 int %main() {
4 %A = add sbyte 0, 12
5 %B = sub sbyte %A, 1
6 %C = mul sbyte %B, %B
7 %D = div sbyte %C, %C
8 %E = rem sbyte %D, %D
9 %F = div ubyte 5, 6
10 %G = rem ubyte 6, 5
3 define i32 @main() {
4 %A = add i8 0, 12 ; [#uses=1]
5 %B = sub i8 %A, 1 ; [#uses=2]
6 %C = mul i8 %B, %B ; [#uses=2]
7 %D = sdiv i8 %C, %C ; [#uses=2]
8 %E = srem i8 %D, %D ; [#uses=0]
9 %F = udiv i8 5, 6 ; [#uses=0]
10 %G = urem i8 6, 5 ; [#uses=0]
11 %A.upgrd.1 = add i16 0, 12 ; [#uses=1]
12 %B.upgrd.2 = sub i16 %A.upgrd.1, 1 ; [#uses=2]
13 %C.upgrd.3 = mul i16 %B.upgrd.2, %B.upgrd.2 ; [#uses=2]
14 %D.upgrd.4 = sdiv i16 %C.upgrd.3, %C.upgrd.3 ; [#uses=2]
15 %E.upgrd.5 = srem i16 %D.upgrd.4, %D.upgrd.4 ; [#uses=0]
16 %F.upgrd.6 = udiv i16 5, 6 ; [#uses=0]
17 %G.upgrd.7 = urem i32 6, 5 ; [#uses=0]
18 %A.upgrd.8 = add i32 0, 12 ; [#uses=1]
19 %B.upgrd.9 = sub i32 %A.upgrd.8, 1 ; [#uses=2]
20 %C.upgrd.10 = mul i32 %B.upgrd.9, %B.upgrd.9 ; [#uses=2]
21 %D.upgrd.11 = sdiv i32 %C.upgrd.10, %C.upgrd.10 ; [#uses=2]
22 %E.upgrd.12 = srem i32 %D.upgrd.11, %D.upgrd.11 ; [#uses=0]
23 %F.upgrd.13 = udiv i32 5, 6 ; [#uses=0]
24 %G1 = urem i32 6, 5 ; [#uses=0]
25 %A.upgrd.14 = add i64 0, 12 ; [#uses=1]
26 %B.upgrd.15 = sub i64 %A.upgrd.14, 1 ; [#uses=2]
27 %C.upgrd.16 = mul i64 %B.upgrd.15, %B.upgrd.15 ; [#uses=2]
28 %D.upgrd.17 = sdiv i64 %C.upgrd.16, %C.upgrd.16 ; [#uses=2]
29 %E.upgrd.18 = srem i64 %D.upgrd.17, %D.upgrd.17 ; [#uses=0]
30 %F.upgrd.19 = udiv i64 5, 6 ; [#uses=0]
31 %G.upgrd.20 = urem i64 6, 5 ; [#uses=0]
32 ret i32 0
33 }
1134
12 %A = add short 0, 12
13 %B = sub short %A, 1
14 %C = mul short %B, %B
15 %D = div short %C, %C
16 %E = rem short %D, %D
17 %F = div ushort 5, 6
18 %G = rem uint 6, 5
19
20 %A = add int 0, 12
21 %B = sub int %A, 1
22 %C = mul int %B, %B
23 %D = div int %C, %C
24 %E = rem int %D, %D
25 %F = div uint 5, 6
26 %G1 = rem uint 6, 5
27
28 %A = add long 0, 12
29 %B = sub long %A, 1
30 %C = mul long %B, %B
31 %D = div long %C, %C
32 %E = rem long %D, %D
33 %F = div ulong 5, 6
34 %G = rem ulong 6, 5
35
36 ret int 0
37 }
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
33 ; test unconditional branch
4 int %main() {
4 define i32 @main() {
55 br label %Test
6 Test:
7 %X = seteq int 0, 4
8 br bool %X, label %Test, label %Label
9 Label:
10 ret int 0
6 Test: ; preds = %Test, %0
7 %X = icmp eq i32 0, 4 ; [#uses=1]
8 br i1 %X, label %Test, label %Label
9 Label: ; preds = %Test
10 ret i32 0
1111 }
12
None ; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3 declare void @exit(i32)
34
4 declare void %exit(int)
5
6 int %test(sbyte %C, short %S) {
7 %X = cast short %S to ubyte
8 %Y = cast ubyte %X to int
9 ret int %Y
5 define i32 @test(i8 %C, i16 %S) {
6 %X = trunc i16 %S to i8 ; [#uses=1]
7 %Y = zext i8 %X to i32 ; [#uses=1]
8 ret i32 %Y
109 }
1110
12 void %FP(void(int) * %F) {
13 %X = call int %test(sbyte 123, short 1024)
14 call void %F(int %X)
11 define void @FP(void (i32)* %F) {
12 %X = call i32 @test( i8 123, i16 1024 ) ; [#uses=1]
13 call void %F( i32 %X )
1514 ret void
1615 }
1716
18 int %main() {
19 call void %FP(void(int)* %exit)
20 ret int 1
17 define i32 @main() {
18 call void @FP( void (i32)* @exit )
19 ret i32 1
2120 }
21
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3
4 int %foo() {
5 ret int 0
3 define i32 @foo() {
4 ret i32 0
65 }
76
8 int %main() {
9 ; cast bool to ...
10 cast bool true to bool
11 cast bool true to ubyte
12 cast bool true to sbyte
13 cast bool true to short
14 cast bool true to ushort
15 cast bool true to int
16 cast bool true to uint
17 cast bool true to long
18 cast bool true to ulong
19 cast bool true to float
20 cast bool true to double
21
22 ; cast sbyte to ...
23 cast sbyte 0 to bool
24 cast sbyte 1 to bool
25 cast sbyte 0 to sbyte
26 cast sbyte -1 to ubyte
27 cast sbyte 4 to short
28 cast sbyte 4 to ushort
29 cast sbyte 4 to long
30 cast sbyte 4 to ulong
31 cast sbyte 4 to float
32 cast sbyte 4 to double
33
34 ; cast ubyte to ...
35 cast ubyte 0 to bool
36 cast ubyte 1 to bool
37 cast ubyte 0 to sbyte
38 cast ubyte 1 to ubyte
39 cast ubyte 4 to short
40 cast ubyte 4 to ushort
41 cast ubyte 4 to long
42 cast ubyte 4 to ulong
43 cast ubyte 0 to float
44 cast ubyte 0 to double
45
46 ; cast short to ...
47 cast short 1 to bool
48 cast short -1 to sbyte
49 cast short 255 to ubyte
50 cast short 0 to short
51 cast short 0 to ushort
52 cast short 0 to long
53 cast short 0 to ulong
54 cast short 0 to float
55 cast short 0 to double
56
57 ; cast ushort to ...
58 cast ushort 1 to bool
59 cast ushort 1 to sbyte
60 cast ushort 255 to ubyte
61 cast ushort 0 to short
62 cast ushort 0 to ushort
63 cast ushort 0 to long
64 cast ushort 0 to ulong
65 cast ushort 0 to float
66 cast ushort 0 to double
67
68 ; cast int to ...
69 cast int 6 to bool
70 cast int -6 to sbyte
71 cast int 6 to ubyte
72 cast int 6 to short
73 cast int 0 to int
74 cast int 0 to long
75 cast int 0 to ulong
76 cast int 0 to float
77 cast int 0 to double
78
79 ; cast uint to ...
80 cast uint 6 to bool
81 cast uint 7 to sbyte
82 cast uint 8 to ubyte
83 cast uint 9 to short
84 cast uint 10 to int
85 cast uint 0 to long
86 cast uint 0 to ulong
87 cast uint 0 to float
88 cast uint 0 to double
89
90 ; cast long to ...
91 cast long 0 to bool
92 cast long 0 to sbyte
93 cast long 0 to ubyte
94 cast long 0 to short
95 cast long 0 to ushort
96 cast long 0 to int
97 cast long 0 to uint
98 cast long 0 to long
99 cast long 0 to ulong
100 cast long 0 to float
101 cast long 0 to double
102
103 ; cast ulong to ...
104 cast ulong 1 to bool
105 cast ulong 1 to sbyte
106 cast ulong 1 to ubyte
107 cast ulong 1 to short
108 cast ulong 1 to ushort
109 cast ulong 1 to int
110 cast ulong 1 to uint
111 cast ulong 1 to long
112 cast ulong 1 to ulong
113 cast ulong 1 to float
114 cast ulong 0 to double
115
116 ; cast float to ...
117 ;cast float 0.0 to bool
118 cast float 0.0 to float
119 cast float 0.0 to double
120
121 ; cast double to ...
122 ;cast double 0.0 to bool
123 cast double 0.0 to sbyte
124 cast double 0.0 to ubyte
125 cast double 0.0 to short
126 cast double 0.0 to ushort
127 cast double 0.0 to int
128 cast double 0.0 to uint
129 cast double 0.0 to long
130 ;cast double 0.0 to ulong
131 cast double 0.0 to float
132 cast double 0.0 to double
133
134 ret int 0
7 define i32 @main() {
8 icmp ne i1 true, false ; :1 [#uses=0]
9 zext i1 true to i8 ; :2 [#uses=0]
10 zext i1 true to i8 ; :3 [#uses=0]
11 zext i1 true to i16 ; :4 [#uses=0]
12 zext i1 true to i16 ; :5 [#uses=0]
13 zext i1 true to i32 ; :6 [#uses=0]
14 zext i1 true to i32 ; :7 [#uses=0]
15 zext i1 true to i64 ; :8 [#uses=0]
16 zext i1 true to i64 ; :9 [#uses=0]
17 uitofp i1 true to float ; :10 [#uses=0]
18 uitofp i1 true to double ; :11 [#uses=0]
19 icmp ne i8 0, 0 ; :12 [#uses=0]
20 icmp ne i8 1, 0 ; :13 [#uses=0]
21 bitcast i8 0 to i8 ; :14 [#uses=0]
22 bitcast i8 -1 to i8 ; :15 [#uses=0]
23 sext i8 4 to i16 ; :16 [#uses=0]
24 sext i8 4 to i16 ; :17 [#uses=0]
25 sext i8 4 to i64 ; :18 [#uses=0]
26 sext i8 4 to i64 ; :19 [#uses=0]
27 sitofp i8 4 to float ; :20 [#uses=0]
28 sitofp i8 4 to double ; :21 [#uses=0]
29 icmp ne i8 0, 0 ; :22 [#uses=0]
30 icmp ne i8 1, 0 ; :23 [#uses=0]
31 bitcast i8 0 to i8 ; :24 [#uses=0]
32 bitcast i8 1 to i8 ; :25 [#uses=0]
33 zext i8 4 to i16 ; :26 [#uses=0]
34 zext i8 4 to i16 ; :27 [#uses=0]
35 zext i8 4 to i64 ; :28 [#uses=0]
36 zext i8 4 to i64 ; :29 [#uses=0]
37 uitofp i8 0 to float ; :30 [#uses=0]
38 uitofp i8 0 to double ; :31 [#uses=0]
39 icmp ne i16 1, 0 ; :32 [#uses=0]
40 trunc i16 -1 to i8 ; :33 [#uses=0]
41 trunc i16 255 to i8 ; :34 [#uses=0]
42 bitcast i16 0 to i16 ; :35 [#uses=0]
43 bitcast i16 0 to i16 ; :36 [#uses=0]
44 sext i16 0 to i64 ; :37 [#uses=0]
45 sext i16 0 to i64 ; :38 [#uses=0]
46 sitofp i16 0 to float ; :39 [#uses=0]
47 sitofp i16 0 to double ; :40 [#uses=0]
48 icmp ne i16 1, 0 ; :41 [#uses=0]
49 trunc i16 1 to i8 ; :42 [#uses=0]
50 trunc i16 255 to i8 ; :43 [#uses=0]
51 bitcast i16 0 to i16 ; :44 [#uses=0]
52 bitcast i16 0 to i16 ; :45 [#uses=0]
53 zext i16 0 to i64 ; :46 [#uses=0]
54 zext i16 0 to i64 ; :47 [#uses=0]
55 uitofp i16 0 to float ; :48 [#uses=0]
56 uitofp i16 0 to double ; :49 [#uses=0]
57 icmp ne i32 6, 0 ; :50 [#uses=0]
58 trunc i32 -6 to i8 ; :51 [#uses=0]
59 trunc i32 6 to i8 ; :52 [#uses=0]
60 trunc i32 6 to i16 ; :53 [#uses=0]
61 bitcast i32 0 to i32 ; :54 [#uses=0]
62 sext i32 0 to i64 ; :55 [#uses=0]
63 sext i32 0 to i64 ; :56 [#uses=0]
64 sitofp i32 0 to float ; :57 [#uses=0]
65 sitofp i32 0 to double ; :58 [#uses=0]
66 icmp ne i32 6, 0 ; :59 [#uses=0]
67 trunc i32 7 to i8 ; :60 [#uses=0]
68 trunc i32 8 to i8 ; :61 [#uses=0]
69 trunc i32 9 to i16 ; :62 [#uses=0]
70 bitcast i32 10 to i32 ; :63 [#uses=0]
71 zext i32 0 to i64 ; :64 [#uses=0]
72 zext i32 0 to i64 ; :65 [#uses=0]
73 uitofp i32 0 to float ; :66 [#uses=0]
74 uitofp i32 0 to double ; :67 [#uses=0]
75 icmp ne i64 0, 0 ; :68 [#uses=0]
76 trunc i64 0 to i8 ; :69 [#uses=0]
77 trunc i64 0 to i8 ; :70 [#uses=0]
78 trunc i64 0 to i16 ; :71 [#uses=0]
79 trunc i64 0 to i16 ; :72 [#uses=0]
80 trunc i64 0 to i32 ; :73 [#uses=0]
81 trunc i64 0 to i32 ; :74 [#uses=0]
82 bitcast i64 0 to i64 ; :75 [#uses=0]
83 bitcast i64 0 to i64 ; :76 [#uses=0]
84 sitofp i64 0 to float ; :77 [#uses=0]
85 sitofp i64 0 to double ; :78 [#uses=0]
86 icmp ne i64 1, 0 ; :79 [#uses=0]
87 trunc i64 1 to i8 ; :80 [#uses=0]
88 trunc i64 1 to i8 ; :81 [#uses=0]
89 trunc i64 1 to i16 ; :82 [#uses=0]
90 trunc i64 1 to i16 ; :83 [#uses=0]
91 trunc i64 1 to i32 ; :84 [#uses=0]
92 trunc i64 1 to i32 ; :85 [#uses=0]
93 bitcast i64 1 to i64 ; :86 [#uses=0]
94 bitcast i64 1 to i64 ; :87 [#uses=0]
95 uitofp i64 1 to float ; :88 [#uses=0]
96 uitofp i64 0 to double ; :89 [#uses=0]
97 bitcast float 0.000000e+00 to float ; :90 [#uses=0]
98 fpext float 0.000000e+00 to double ; :91 [#uses=0]
99 fptosi double 0.000000e+00 to i8 ; :92 [#uses=0]
100 fptoui double 0.000000e+00 to i8 ; :93 [#uses=0]
101 fptosi double 0.000000e+00 to i16 ; :94 [#uses=0]
102 fptoui double 0.000000e+00 to i16 ; :95 [#uses=0]
103 fptosi double 0.000000e+00 to i32 ; :96 [#uses=0]
104 fptoui double 0.000000e+00 to i32 ; :97 [#uses=0]
105 fptosi double 0.000000e+00 to i64 ; :98 [#uses=0]
106 fptrunc double 0.000000e+00 to float ; :99 [#uses=0]
107 bitcast double 0.000000e+00 to double ; :100 [#uses=0]
108 ret i32 0
135109 }
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
33 ; This tests to make sure that we can evaluate weird constant expressions
4 %A = global int 5
5 %B = global int 6
64
7 implementation
5 @A = global i32 5 ; [#uses=1]
6 @B = global i32 6 ; [#uses=1]
87
9 int %main() {
10 %A = or bool false, setlt (int* %A, int* %B) ; Which is lower in memory?
11 ret int 0
8 define i32 @main() {
9 %A = or i1 false, icmp slt (i32* @A, i32* @B) ; [#uses=0]
10 ret i32 0
1211 }
1312
None ; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3
4 double %test(double* %DP, double %Arg) {
5 %D = load double* %DP
6 %V = add double %D, 1.0
7 %W = sub double %V, %V
8 %X = mul double %W, %W
9 %Y = div double %X, %X
10 %Z = rem double %Y, %Y
11 %Z1 = div double %Z, %W
12 %Q = add double %Z, %Arg
13 %R = cast double %Q to double
3 define double @test(double* %DP, double %Arg) {
4 %D = load double* %DP ; [#uses=1]
5 %V = add double %D, 1.000000e+00 ; [#uses=2]
6 %W = sub double %V, %V ; [#uses=3]
7 %X = mul double %W, %W ; [#uses=2]
8 %Y = fdiv double %X, %X ; [#uses=2]
9 %Z = frem double %Y, %Y ; [#uses=3]
10 %Z1 = fdiv double %Z, %W ; [#uses=0]
11 %Q = add double %Z, %Arg ; [#uses=1]
12 %R = bitcast double %Q to double ; [#uses=1]
1413 store double %R, double* %DP
1514 ret double %Z
1615 }
1716
18 int %main() {
19 %X = alloca double
20 store double 0.0, double* %X
21 call double %test(double* %X, double 2.0)
22 ret int 0
17 define i32 @main() {
18 %X = alloca double ; [#uses=2]
19 store double 0.000000e+00, double* %X
20 call double @test( double* %X, double 2.000000e+00 ) ; :1 [#uses=0]
21 ret i32 0
2322 }
23
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3
4 void %test(sbyte* %P, short* %P, int* %P, long* %P) {
5 %V = load sbyte* %P
6 store sbyte %V, sbyte* %P
7
8 %V = load short* %P
9 store short %V, short* %P
10
11 %V = load int* %P
12 store int %V, int* %P
13
14 %V = load long* %P
15 store long %V, long* %P
16
3 define void @test(i8* %P, i16* %P.upgrd.1, i32* %P.upgrd.2, i64* %P.upgrd.3) {
4 %V = load i8* %P ; [#uses=1]
5 store i8 %V, i8* %P
6 %V.upgrd.4 = load i16* %P.upgrd.1 ; [#uses=1]
7 store i16 %V.upgrd.4, i16* %P.upgrd.1
8 %V.upgrd.5 = load i32* %P.upgrd.2 ; [#uses=1]
9 store i32 %V.upgrd.5, i32* %P.upgrd.2
10 %V.upgrd.6 = load i64* %P.upgrd.3 ; [#uses=1]
11 store i64 %V.upgrd.6, i64* %P.upgrd.3
1712 ret void
1813 }
1914
20 uint %varalloca(uint %Size) {
21 %X = alloca uint, uint %Size ;; Variable sized alloca
22 store uint %Size, uint* %X
23 %Y = load uint* %X
24 ret uint %Y
15 define i32 @varalloca(i32 %Size) {
16 ;; Variable sized alloca
17 %X = alloca i32, i32 %Size ; [#uses=2]
18 store i32 %Size, i32* %X
19 %Y = load i32* %X ; [#uses=1]
20 ret i32 %Y
2521 }
2622
27 int %main() {
28 %A = alloca sbyte
29 %B = alloca short
30 %C = alloca int
31 %D = alloca long
32 call void %test(sbyte* %A, short* %B, int* %C, long* %D)
33 call uint %varalloca(uint 7)
34
35 ret int 0
23 define i32 @main() {
24 %A = alloca i8 ; [#uses=1]
25 %B = alloca i16 ; [#uses=1]
26 %C = alloca i32 ; [#uses=1]
27 %D = alloca i64 ; [#uses=1]
28 call void @test( i8* %A, i16* %B, i32* %C, i64* %D )
29 call i32 @varalloca( i32 7 ) ; :1 [#uses=0]
30 ret i32 0
3631 }
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3 define i32 @main() {
4 %A = and i8 4, 8 ; [#uses=2]
5 %B = or i8 %A, 7 ; [#uses=1]
6 %C = xor i8 %B, %A ; [#uses=0]
7 %A.upgrd.1 = and i16 4, 8 ; [#uses=2]
8 %B.upgrd.2 = or i16 %A.upgrd.1, 7 ; [#uses=1]
9 %C.upgrd.3 = xor i16 %B.upgrd.2, %A.upgrd.1 ; [#uses=0]
10 %A.upgrd.4 = and i32 4, 8 ; [#uses=2]
11 %B.upgrd.5 = or i32 %A.upgrd.4, 7 ; [#uses=1]
12 %C.upgrd.6 = xor i32 %B.upgrd.5, %A.upgrd.4 ; [#uses=0]
13 %A.upgrd.7 = and i64 4, 8 ; [#uses=2]
14 %B.upgrd.8 = or i64 %A.upgrd.7, 7 ; [#uses=1]
15 %C.upgrd.9 = xor i64 %B.upgrd.8, %A.upgrd.7 ; [#uses=0]
16 ret i32 0
17 }
318
4 int %main() {
5 %A = and sbyte 4, 8
6 %B = or sbyte %A, 7
7 %C = xor sbyte %B, %A
8
9 %A = and short 4, 8
10 %B = or short %A, 7
11 %C = xor short %B, %A
12
13 %A = and int 4, 8
14 %B = or int %A, 7
15 %C = xor int %B, %A
16
17 %A = and long 4, 8
18 %B = or long %A, 7
19 %C = xor long %B, %A
20
21 ret int 0
22 }
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3 int %main() {
3 define i32 @main() {
4 ;
45 br label %Loop
5 Loop:
6 %I = phi int [0, %0], [%i2, %Loop]
7 %i2 = add int %I, 1
8 %C = seteq int %i2, 10
9 br bool %C, label %Out, label %Loop
10 Out:
11 ret int 0
6 Loop: ; preds = %Loop, %0
7 %I = phi i32 [ 0, %0 ], [ %i2, %Loop ] ; [#uses=1]
8 %i2 = add i32 %I, 1 ; [#uses=2]
9 %C = icmp eq i32 %i2, 10 ; [#uses=1]
10 br i1 %C, label %Out, label %Loop
11 Out: ; preds = %Loop
12 ret i32 0
1213 }
14
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3 define i32 @main() {
4 %X = malloc i32 ; [#uses=1]
5 %Y = malloc i32, i32 100 ; [#uses=1]
6 %u = add i32 1, 2 ; [#uses=1]
7 %Z = malloc i32, i32 %u ; [#uses=1]
8 free i32* %X
9 free i32* %Y
10 free i32* %Z
11 ret i32 0
12 }
313
4 int %main() {
5 %X = malloc int ; constant size
6 %Y = malloc int, uint 100 ; constant size
7 %u = add uint 1, 2
8 %Z = malloc int, uint %u ; variable size
9 free int* %X
10 free int* %Y
11 free int* %Z
12 ret int 0
13 }
None ; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
33 ; test phi node
4 @Y = global i32 6 ; [#uses=1]
45
5 %Y = global int 6
6
7 void %blah(int *%X) {
6 define void @blah(i32* %X) {
7 ;
88 br label %T
9 T:
10 phi int* [%X, %0], [%Y, %Dead]
9 T: ; preds = %Dead, %0
10 phi i32* [ %X, %0 ], [ @Y, %Dead ] ; :1 [#uses=0]
1111 ret void
12 Dead:
12 Dead: ; No predecessors!
1313 br label %T
1414 }
1515
16 int %test(bool %C) {
17 br bool %C, label %T, label %T
18 T:
19 %X = phi int [123, %0], [123, %0]
20 ret int %X
16 define i32 @test(i1 %C) {
17 ;
18 br i1 %C, label %T, label %T
19 T: ; preds = %0, %0
20 %X = phi i32 [ 123, %0 ], [ 123, %0 ] ; [#uses=1]
21 ret i32 %X
2122 }
2223
23 int %main() {
24 define i32 @main() {
25 ;
2426 br label %Test
25 Test:
26 %X = phi int [0, %0], [%Y, %Dead]
27 ret int %X
28 Dead:
29 %Y = shr int 12, ubyte 4
27 Test: ; preds = %Dead, %0
28 %X = phi i32 [ 0, %0 ], [ %Y, %Dead ] ; [#uses=1]
29 ret i32 %X
30 Dead: ; No predecessors!
31 %Y = ashr i32 12, 4 ; [#uses=1]
3032 br label %Test
3133 }
34
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
33 ; test return instructions
4 define void @test1() {
5 ret void
6 }
47
5 void %test1() { ret void }
6 sbyte %test2() { ret sbyte 1 }
7 ubyte %test3() { ret ubyte 1 }
8 short %test4() { ret short -1 }
9 ushort %test5() { ret ushort 65535 }
10 int %main() { ret int 0 }
11 uint %test6() { ret uint 4 }
12 long %test7() { ret long 0 }
13 ulong %test8() { ret ulong 0 }
14 float %test9() { ret float 1.0 }
15 double %test10() { ret double 2.0 }
8 define i8 @test2() {
9 ret i8 1
10 }
11
12 define i8 @test3() {
13 ret i8 1
14 }
15
16 define i16 @test4() {
17 ret i16 -1
18 }
19
20 define i16 @test5() {
21 ret i16 -1
22 }
23
24 define i32 @main() {
25 ret i32 0
26 }
27
28 define i32 @test6() {
29 ret i32 4
30 }
31
32 define i64 @test7() {
33 ret i64 0
34 }
35
36 define i64 @test8() {
37 ret i64 0
38 }
39
40 define float @test9() {
41 ret float 1.000000e+00
42 }
43
44 define double @test10() {
45 ret double 2.000000e+00
46 }
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
33
4 int %main() {
5 %double1 = add double 0.0, 0.0
6 %double2 = add double 0.0, 0.0
7 %float1 = add float 0.0, 0.0
8 %float2 = add float 0.0, 0.0
9 %test49 = seteq float %float1, %float2
10 %test50 = setge float %float1, %float2
11 %test51 = setgt float %float1, %float2
12 %test52 = setle float %float1, %float2
13 %test53 = setlt float %float1, %float2
14 %test54 = setne float %float1, %float2
15 %test55 = seteq double %double1, %double2
16 %test56 = setge double %double1, %double2
17 %test57 = setgt double %double1, %double2
18 %test58 = setle double %double1, %double2
19 %test59 = setlt double %double1, %double2
20 %test60 = setne double %double1, %double2
21 ret int 0
4 define i32 @main() {
5 %double1 = add double 0.000000e+00, 0.000000e+00 ; [#uses=6]
6 %double2 = add double 0.000000e+00, 0.000000e+00 ; [#uses=6]
7 %float1 = add float 0.000000e+00, 0.000000e+00 ; [#uses=6]
8 %float2 = add float 0.000000e+00, 0.000000e+00 ; [#uses=6]
9 %test49 = fcmp oeq float %float1, %float2 ; [#uses=0]
10 %test50 = fcmp oge float %float1, %float2 ; [#uses=0]
11 %test51 = fcmp ogt float %float1, %float2 ; [#uses=0]
12 %test52 = fcmp ole float %float1, %float2 ; [#uses=0]
13 %test53 = fcmp olt float %float1, %float2 ; [#uses=0]
14 %test54 = fcmp une float %float1, %float2 ; [#uses=0]
15 %test55 = fcmp oeq double %double1, %double2 ; [#uses=0]
16 %test56 = fcmp oge double %double1, %double2 ; [#uses=0]
17 %test57 = fcmp ogt double %double1, %double2 ; [#uses=0]
18 %test58 = fcmp ole double %double1, %double2 ; [#uses=0]
19 %test59 = fcmp olt double %double1, %double2 ; [#uses=0]
20 %test60 = fcmp une double %double1, %double2 ; [#uses=0]
21 ret i32 0
2222 }
23
24
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3
4 int %main() {
5 %int1 = add int 0, 0
6 %int2 = add int 0, 0
7 %long1 = add long 0, 0
8 %long2 = add long 0, 0
9 %sbyte1 = add sbyte 0, 0
10 %sbyte2 = add sbyte 0, 0
11 %short1 = add short 0, 0
12 %short2 = add short 0, 0
13 %ubyte1 = add ubyte 0, 0
14 %ubyte2 = add ubyte 0, 0
15 %uint1 = add uint 0, 0
16 %uint2 = add uint 0, 0
17 %ulong1 = add ulong 0, 0
18 %ulong2 = add ulong 0, 0
19 %ushort1 = add ushort 0, 0
20 %ushort2 = add ushort 0, 0
21 %test1 = seteq ubyte %ubyte1, %ubyte2
22 %test2 = setge ubyte %ubyte1, %ubyte2
23 %test3 = setgt ubyte %ubyte1, %ubyte2
24 %test4 = setle ubyte %ubyte1, %ubyte2
25 %test5 = setlt ubyte %ubyte1, %ubyte2
26 %test6 = setne ubyte %ubyte1, %ubyte2
27 %test7 = seteq ushort %ushort1, %ushort2
28 %test8 = setge ushort %ushort1, %ushort2
29 %test9 = setgt ushort %ushort1, %ushort2
30 %test10 = setle ushort %ushort1, %ushort2
31 %test11 = setlt ushort %ushort1, %ushort2
32 %test12 = setne ushort %ushort1, %ushort2
33 %test13 = seteq uint %uint1, %uint2
34 %test14 = setge uint %uint1, %uint2
35 %test15 = setgt uint %uint1, %uint2
36 %test16 = setle uint %uint1, %uint2
37 %test17 = setlt uint %uint1, %uint2
38 %test18 = setne uint %uint1, %uint2
39 %test19 = seteq ulong %ulong1, %ulong2
40 %test20 = setge ulong %ulong1, %ulong2
41 %test21 = setgt ulong %ulong1, %ulong2
42 %test22 = setle ulong %ulong1, %ulong2
43 %test23 = setlt ulong %ulong1, %ulong2
44 %test24 = setne ulong %ulong1, %ulong2
45 %test25 = seteq sbyte %sbyte1, %sbyte2
46 %test26 = setge sbyte %sbyte1, %sbyte2
47 %test27 = setgt sbyte %sbyte1, %sbyte2
48 %test28 = setle sbyte %sbyte1, %sbyte2
49 %test29 = setlt sbyte %sbyte1, %sbyte2
50 %test30 = setne sbyte %sbyte1, %sbyte2
51 %test31 = seteq short %short1, %short2
52 %test32 = setge short %short1, %short2
53 %test33 = setgt short %short1, %short2
54 %test34 = setle short %short1, %short2
55 %test35 = setlt short %short1, %short2
56 %test36 = setne short %short1, %short2
57 %test37 = seteq int %int1, %int2
58 %test38 = setge int %int1, %int2
59 %test39 = setgt int %int1, %int2
60 %test40 = setle int %int1, %int2
61 %test41 = setlt int %int1, %int2
62 %test42 = setne int %int1, %int2
63 %test43 = seteq long %long1, %long2
64 %test44 = setge long %long1, %long2
65 %test45 = setgt long %long1, %long2
66 %test46 = setle long %long1, %long2
67 %test47 = setlt long %long1, %long2
68 %test48 = setne long %long1, %long2
69 ret int 0
3 define i32 @main() {
4 %int1 = add i32 0, 0 ; [#uses=6]
5 %int2 = add i32 0, 0 ; [#uses=6]
6 %long1 = add i64 0, 0 ; [#uses=6]
7 %long2 = add i64 0, 0 ; [#uses=6]
8 %sbyte1 = add i8 0, 0 ; [#uses=6]
9 %sbyte2 = add i8 0, 0 ; [#uses=6]
10 %short1 = add i16 0, 0 ; [#uses=6]
11 %short2 = add i16 0, 0 ; [#uses=6]
12 %ubyte1 = add i8 0, 0 ; [#uses=6]
13 %ubyte2 = add i8 0, 0 ; [#uses=6]
14 %uint1 = add i32 0, 0 ; [#uses=6]
15 %uint2 = add i32 0, 0 ; [#uses=6]
16 %ulong1 = add i64 0, 0 ; [#uses=6]
17 %ulong2 = add i64 0, 0 ; [#uses=6]
18 %ushort1 = add i16 0, 0 ; [#uses=6]
19 %ushort2 = add i16 0, 0 ; [#uses=6]
20 %test1 = icmp eq i8 %ubyte1, %ubyte2 ; [#uses=0]
21 %test2 = icmp uge i8 %ubyte1, %ubyte2 ; [#uses=0]
22 %test3 = icmp ugt i8 %ubyte1, %ubyte2 ; [#uses=0]
23 %test4 = icmp ule i8 %ubyte1, %ubyte2 ; [#uses=0]
24 %test5 = icmp ult i8 %ubyte1, %ubyte2 ; [#uses=0]
25 %test6 = icmp ne i8 %ubyte1, %ubyte2 ; [#uses=0]
26 %test7 = icmp eq i16 %ushort1, %ushort2 ; [#uses=0]
27 %test8 = icmp uge i16 %ushort1, %ushort2 ; [#uses=0]
28 %test9 = icmp ugt i16 %ushort1, %ushort2 ; [#uses=0]
29 %test10 = icmp ule i16 %ushort1, %ushort2 ; [#uses=0]
30 %test11 = icmp ult i16 %ushort1, %ushort2 ; [#uses=0]
31 %test12 = icmp ne i16 %ushort1, %ushort2 ; [#uses=0]
32 %test13 = icmp eq i32 %uint1, %uint2 ; [#uses=0]
33 %test14 = icmp uge i32 %uint1, %uint2 ; [#uses=0]
34 %test15 = icmp ugt i32 %uint1, %uint2 ; [#uses=0]
35 %test16 = icmp ule i32 %uint1, %uint2 ; [#uses=0]
36 %test17 = icmp ult i32 %uint1, %uint2 ; [#uses=0]
37 %test18 = icmp ne i32 %uint1, %uint2 ; [#uses=0]
38 %test19 = icmp eq i64 %ulong1, %ulong2 ; [#uses=0]
39 %test20 = icmp uge i64 %ulong1, %ulong2 ; [#uses=0]
40 %test21 = icmp ugt i64 %ulong1, %ulong2 ; [#uses=0]
41 %test22 = icmp ule i64 %ulong1, %ulong2 ; [#uses=0]
42 %test23 = icmp ult i64 %ulong1, %ulong2 ; [#uses=0]
43 %test24 = icmp ne i64 %ulong1, %ulong2 ; [#uses=0]
44 %test25 = icmp eq i8 %sbyte1, %sbyte2 ; [#uses=0]
45 %test26 = icmp sge i8 %sbyte1, %sbyte2 ; [#uses=0]
46 %test27 = icmp sgt i8 %sbyte1, %sbyte2 ; [#uses=0]
47 %test28 = icmp sle i8 %sbyte1, %sbyte2 ; [#uses=0]
48 %test29 = icmp slt i8 %sbyte1, %sbyte2 ; [#uses=0]
49 %test30 = icmp ne i8 %sbyte1, %sbyte2 ; [#uses=0]
50 %test31 = icmp eq i16 %short1, %short2 ; [#uses=0]
51 %test32 = icmp sge i16 %short1, %short2 ; [#uses=0]
52 %test33 = icmp sgt i16 %short1, %short2 ; [#uses=0]
53 %test34 = icmp sle i16 %short1, %short2 ; [#uses=0]
54 %test35 = icmp slt i16 %short1, %short2 ; [#uses=0]
55 %test36 = icmp ne i16 %short1, %short2 ; [#uses=0]
56 %test37 = icmp eq i32 %int1, %int2 ; [#uses=0]
57 %test38 = icmp sge i32 %int1, %int2 ; [#uses=0]
58 %test39 = icmp sgt i32 %int1, %int2 ; [#uses=0]
59 %test40 = icmp sle i32 %int1, %int2 ; [#uses=0]
60 %test41 = icmp slt i32 %int1, %int2 ; [#uses=0]
61 %test42 = icmp ne i32 %int1, %int2 ; [#uses=0]
62 %test43 = icmp eq i64 %long1, %long2 ; [#uses=0]
63 %test44 = icmp sge i64 %long1, %long2 ; [#uses=0]
64 %test45 = icmp sgt i64 %long1, %long2 ; [#uses=0]
65 %test46 = icmp sle i64 %long1, %long2 ; [#uses=0]
66 %test47 = icmp slt i64 %long1, %long2 ; [#uses=0]
67 %test48 = icmp ne i64 %long1, %long2 ; [#uses=0]
68 ret i32 0
7069 }
None ; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
0 ; RUN: llvm-as < %s -f -o %t.bc
11 ; RUN: lli %t.bc > /dev/null
22
3 ; test shifts
4 int %main() {
5 %shamt = add ubyte 0, 1
6
7 ; Left shifts...
8 %t1.s = shl int 1, ubyte %shamt
9 %t2.s = shl int 1, ubyte 4
10
11 %t1 = shl uint 1, ubyte %shamt
12 %t2 = shl uint 1, ubyte 5
13
14 ;%t1 = shl long 1, ubyte %shamt
15 %t2.s = shl long 1, ubyte 4
16
17 ;%t1 = shl ulong 1, ubyte %shamt
18 %t2 = shl ulong 1, ubyte 5
19
20 ; Right shifts...
21 %tr1.s = shr int 1, ubyte %shamt
22 %tr2.s = shr int 1, ubyte 4
23
24 %tr1 = shr uint 1, ubyte %shamt
25 %tr2 = shr uint 1, ubyte 5
26
27 ;%tr1 = shr long 1, ubyte %shamt
28 %tr1.l = shr long 1, ubyte 4
29 %tr2.l = shr long 1, ubyte %shamt
30 %tr3.l = shl long 1, ubyte 4
31 %tr4.l = shl long 1, ubyte %shamt
32
33 ;%t1 = shr ulong 1, ubyte %shamt
34 %tr1.u = shr ulong 1, ubyte 5
35 %tr2.u = shr ulong 1, ubyte %shamt
36 %tr3.u = shl ulong 1, ubyte 5
37 %tr4.u = shl ulong 1, ubyte %shamt
38 ret int 0
3 define i32 @main() {
4 %shamt = add i8 0, 1 ; [#uses=8]
5 %shift.upgrd.1 = zext i8 %shamt to i32 ; [#uses=1]
6 %t1.s = shl i32 1, %shift.upgrd.1 ; [#uses=0]
7 %t2.s = shl i32 1, 4 ; [#uses=0]
8 %shift.upgrd.2 = zext i8 %shamt to i32 ; [#uses=1]
9 %t1 = shl i32 1, %shift.upgrd.2 ; [#uses=0]
10 %t2 = shl i32 1, 5 ; [#uses=0]
11 %t2.s.upgrd.3 = shl i64 1, 4 ; [#uses=0]
12 %t2.upgrd.4 = shl i64 1, 5 ; [#uses=0]
13 %shift.upgrd.5 = zext i8 %shamt to i32 ; [#uses=1]
14 %tr1.s = ashr i32 1, %shift.upgrd.5 ; [#uses=0]
15 %tr2.s = ashr i32 1, 4 ; [#uses=0]
16 %shift.upgrd.6 = zext i8 %shamt to i32 ; [#uses=1]
17 %tr1 = lshr i32 1, %shift.upgrd.6 ; [#uses=0]
18 %tr2 = lshr i32 1, 5 ; [#uses=0]
19 %tr1.l = ashr i64 1, 4 ; [#uses=0]
20 %shift.upgrd.7 = zext i8 %shamt to i64 ; [#uses=1]
21 %tr2.l = ashr i64 1, %shift.upgrd.7 ; [#uses=0]
22 %tr3.l = shl i64 1, 4 ; [#uses=0]
23 %shift.upgrd.8 = zext i8 %shamt to i64 ; [#uses=1]
24 %tr4.l = shl i64 1, %shift.upgrd.8 ; [#uses=0]
25 %tr1.u = lshr i64 1, 5 ; [#uses=0]
26 %shift.upgrd.9 = zext i8 %shamt to i64 ; [#uses=1]
27 %tr2.u = lshr i64 1, %shift.upgrd.9 ; [#uses=0]
28 %tr3.u = shl i64 1, 5 ; [#uses=0]
29 %shift.upgrd.10 = zext i8 %shamt to i64 ; [#uses=1]
30 %tr4.u = shl i64 1, %shift.upgrd.10 ; [#uses=0]
31 ret i32 0
3932 }
33 ; little symbol table. This is causing llvm-link to die, at no fault of its
44 ; own.
55
6 ; RUN: llvm-upgrade %s | llvm-as > %t.out2.bc
6 ; RUN: llvm-as < %s > %t.out2.bc
77 ; RUN: echo "%T1 = type opaque @GVar = external global %T1*" | llvm-as > %t.out1.bc
88 ; RUN: llvm-link %t.out1.bc %t.out2.bc
99
10 %T1 = type opaque
11 %T2 = type int
10 %T1 = type opaque
11 %T2 = type i32
12 @GVar = global i32* null ; [#uses=0]
1213
13 %GVar = global %T2 * null
14
15 implementation
16
17 void %foo(%T2 * %X) {
18 %X = cast %T2* %X to %T1 *
14 define void @foo(i32* %X) {
15 %X.upgrd.1 = bitcast i32* %X to %T1* ; <%T1*> [#uses=0]
1916 ret void
2017 }
2118
None ; RUN: llvm-upgrade < %s | llvm-as > %t.out2.bc
1 ; RUN: echo "%me = global int* null" | llvm-upgrade | llvm-as > %t.out1.bc
0 ; RUN: llvm-as < %s > %t.out2.bc
1 ; RUN: echo "@me = global i32* null" | llvm-as > %t.out1.bc
22 ; RUN: llvm-link %t.out1.bc %t.out2.bc -o /dev/null -f
33
4 %me = weak global int * null
4 @me = weak global i32* null ; [#uses=0]
55
66
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t1.bc
1 ; RUN: llvm-upgrade < %p/2004-05-07-TypeResolution2.ll | \
2 ; RUN: llvm-as -o %t2.bc -f
0 ; RUN: llvm-as < %s -f -o %t1.bc
1 ; RUN: llvm-as < %p/2004-05-07-TypeResolution2.ll -o %t2.bc -f
32 ; RUN: llvm-link -f -o %t3.bc %t1.bc %t2.bc
43
5 target endian = little
6 target pointersize = 32
4 target datalayout = "e-p:32:32"
5 %myint = type opaque
6 %struct1 = type { i32, void (%struct2*)*, %myint*, i32 (i32*)* }
7 %struct2 = type { %struct1 }
8 @driver1 = global %struct1 zeroinitializer ; <%struct1*> [#uses=1]
9 @m1 = external global [1 x i8]* ; <[1 x i8]**> [#uses=0]
10 @str1 = constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=0]
11 @str2 = constant [2 x i8] zeroinitializer ; <[2 x i8]*> [#uses=0]
12 @str3 = constant [3 x i8] zeroinitializer ; <[3 x i8]*> [#uses=0]
13 @str4 = constant [4 x i8] zeroinitializer ; <[4 x i8]*> [#uses=0]
14 @str5 = constant [5 x i8] zeroinitializer ; <[5 x i8]*> [#uses=0]
15 @str6 = constant [6 x i8] zeroinitializer ; <[6 x i8]*> [#uses=0]
16 @str7 = constant [7 x i8] zeroinitializer ; <[7 x i8]*> [#uses=0]
17 @str8 = constant [8 x i8] zeroinitializer ; <[8 x i8]*> [#uses=0]
18 @str9 = constant [9 x i8] zeroinitializer ; <[9 x i8]*> [#uses=0]
19 @stra = constant [10 x i8] zeroinitializer ; <[10 x i8]*> [#uses=0]
20 @strb = constant [11 x i8] zeroinitializer ; <[11 x i8]*> [#uses=0]
21 @strc = constant [12 x i8] zeroinitializer ; <[12 x i8]*> [#uses=0]
22 @strd = constant [13 x i8] zeroinitializer ; <[13 x i8]*> [#uses=0]
23 @stre = constant [14 x i8] zeroinitializer ; <[14 x i8]*> [#uses=0]
24 @strf = constant [15 x i8] zeroinitializer ; <[15 x i8]*> [#uses=0]
25 @strg = constant [16 x i8] zeroinitializer ; <[16 x i8]*> [#uses=0]
26 @strh = constant [17 x i8] zeroinitializer ; <[17 x i8]*> [#uses=0]
727
8 %myint = type opaque
9 %struct2 = type { %struct1 }
28 declare void @func(%struct2*)
1029
11 %struct1 = type { int, void (%struct2*)*, %myint *, int (uint *)* }
12
13
14 %driver1 = global %struct1 zeroinitializer ; <%struct1*> [#uses=1]
15
16 %m1 = external global [1 x sbyte] * ; <%struct.task_struct**> [#uses=0]
17 ;%m1 = external global uint ; <%struct.task_struct**> [#uses=0]
18 %str1 = constant [1 x ubyte] zeroinitializer
19 %str2 = constant [2 x ubyte] zeroinitializer
20 %str3 = constant [3 x ubyte] zeroinitializer
21 %str4 = constant [4 x ubyte] zeroinitializer
22 %str5 = constant [5 x ubyte] zeroinitializer
23 %str6 = constant [6 x ubyte] zeroinitializer
24 %str7 = constant [7 x ubyte] zeroinitializer
25 %str8 = constant [8 x ubyte] zeroinitializer
26 %str9 = constant [9 x ubyte] zeroinitializer
27 %stra = constant [10 x ubyte] zeroinitializer
28 %strb = constant [11 x ubyte] zeroinitializer
29 %strc = constant [12 x ubyte] zeroinitializer
30 %strd = constant [13 x ubyte] zeroinitializer
31 %stre = constant [14 x ubyte] zeroinitializer
32 %strf = constant [15 x ubyte] zeroinitializer
33 %strg = constant [16 x ubyte] zeroinitializer
34 %strh = constant [17 x ubyte] zeroinitializer
35
36 implementation ; Functions:
37
38 declare void %func(%struct2*)
39
40 void %tty_init() {
30 define void @tty_init() {
4131 entry:
42 volatile store void (%struct2*)* %func, void (%struct2 *)** getelementptr (%struct1* %driver1, uint 0, uint 1)
32 volatile store void (%struct2*)* @func, void (%struct2*)** getelementptr (%struct1* @driver1, i64 0, i32 1)
4333 ret void
4434 }
0 ; This file is used by testlink1.ll, so it doesn't actually do anything itself
11 ;
22 ; RUN: echo
3 target datalayout = "e-p:32:32"
4 %myint = type i16
5 %struct1 = type { i32, void (%struct2*)*, i16*, i32 (i32*)* }
6 %struct2 = type { %struct1 }
37
4 target endian = little
5 target pointersize = 32
6
7 %myint = type ushort
8 %struct2 = type { %struct1 }
9 %struct1 = type { int, void (%struct2*)*, %myint *, int (uint *)* }
10
11 implementation ; Functions:
12
13 internal void %f1 (%struct1* %tty) {
8 define internal void @f1(%struct1* %tty) {
149 loopentry.preheader:
15
16 ; [#uses=1]
17 ; [#uses=0]
18
19 %tmp.2.i.i = getelementptr %struct1* %tty, uint 0, uint 1
20 %tmp.3.i.i = volatile load void (%struct2*)** %tmp.2.i.i
21
10 %tmp.2.i.i = getelementptr %struct1* %tty, i64 0, i32 1 ; [#uses=1]
11 %tmp.3.i.i = volatile load void (%struct2*)** %tmp.2.i.i ; [#uses=0]
2212 ret void
2313 }
2414
11 ; to be nonconst.
22
33 ; RUN: echo {@X = global i32 7} | llvm-as > %t.2.bc
4 ; RUN: llvm-upgrade < %s | llvm-as > %t.1.bc
4 ; RUN: llvm-as < %s > %t.1.bc
55 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep {global i32 7}
66
7 @X = external constant i32
7 @X = external constant i32 ; [#uses=0]
0 ; RUN: echo { @G = appending global \[0 x i32\] zeroinitializer } | \
11 ; RUN: llvm-as > %t.out2.bc
2 ; RUN: llvm-upgrade < %s | llvm-as > %t.out1.bc
2 ; RUN: llvm-as < %s > %t.out1.bc
33 ; RUN: llvm-link %t.out1.bc %t.out2.bc | llvm-dis | grep {@G =}
44
55 ; When linked, the globals should be merged, and the result should still
66 ; be named '@G'.
77
8 %G = appending global [1 x int] zeroinitializer
8 @G = appending global [1 x i32] zeroinitializer ; <[1 x i32]*> [#uses=0]
9
None ; RUN: llvm-upgrade < %s | llvm-as -f -o %t1.bc
0 ; RUN: llvm-as < %s -f -o %t1.bc
11 ; RUN: llvm-link -f -o %t2.bc %t1.bc
22
3 target endian = big
4 target pointersize = 32
3 target datalayout = "E-p:32:32"
54 target triple = "powerpc-apple-darwin7.7.0"
65 deplibs = [ "c", "crtend" ]
7 %source = global <4 x int> < int 0, int 1, int 2, int 3 >
6 @source = global <4 x i32> < i32 0, i32 1, i32 2, i32 3 > ; <<4 x i32>*> [#uses=0]
87
9 implementation ; Functions:
8 define i32 @main() {
9 entry:
10 ret i32 0
11 }
1012
11 int %main() {
12 entry:
13 ret int 0
14 }
0 ; Test that appending linkage works correctly.
11
2 ; RUN: echo {%X = appending global \[1 x int\] \[int 8\] } | \
3 ; RUN: llvm-upgrade | llvm-as > %t.2.bc
4 ; RUN: llvm-upgrade < %s | llvm-as > %t.1.bc
2 ; RUN: echo {@X = appending global \[1 x i32\] \[i32 8\] } | \
3 ; RUN: llvm-as > %t.2.bc
4 ; RUN: llvm-as < %s > %t.1.bc
55 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep 7 | grep 4 | grep 8
66
7 %X = appending global [2 x int] [int 7, int 4]
7 @X = appending global [2 x i32] [ i32 7, i32 4 ] ; <[2 x i32]*> [#uses=2]
8 @Y = global i32* getelementptr ([2 x i32]* @X, i64 0, i64 0) ; [#uses=0]
89
9 %Y = global int* getelementptr ([2 x int]* %X, long 0, long 0)
10 define void @foo(i64 %V) {
11 %Y = getelementptr [2 x i32]* @X, i64 0, i64 %V ; [#uses=0]
12 ret void
13 }
1014
11 void %foo(long %V) {
12 %Y = getelementptr [2 x int]* %X, long 0, long %V
13 ret void
14 }
0 ; Test that appending linkage works correctly when arrays are the same size.
11
2 ; RUN: echo {%X = appending global \[1 x int\] \[int 8\] } | \
3 ; RUN: llvm-upgrade | llvm-as > %t.2.bc
4 ; RUN: llvm-upgrade < %s | llvm-as > %t.1.bc
2 ; RUN: echo {@X = appending global \[1 x i32\] \[i32 8\] } | \
3 ; RUN: llvm-as > %t.2.bc
4 ; RUN: llvm-as < %s > %t.1.bc
55 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep 7 | grep 8
66
7 %X = appending global [1 x int] [int 7]
7 @X = appending global [1 x i32] [ i32 7 ] ; <[1 x i32]*> [#uses=0]
0 ; Test that appending linkage works correctly when arrays are the same size.
11
2 ; RUN: echo {%X = constant \[1 x int\] \[int 8\] } | \
3 ; RUN: llvm-upgrade | llvm-as > %t.2.bc
4 ; RUN: llvm-upgrade < %s | llvm-as > %t.1.bc
2 ; RUN: echo {@X = constant \[1 x i32\] \[i32 8\] } | \
3 ; RUN: llvm-as > %t.2.bc
4 ; RUN: llvm-as < %s > %t.1.bc
55 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep constant
66
7 %X = uninitialized global [1 x int]
7 @X = external global [1 x i32] ; <[1 x i32]*> [#uses=0]
8
0 ; Test that appending linkage works correctly when arrays are the same size.
11
2 ; RUN: echo {%X = external global \[1 x int\] } | \
3 ; RUN: llvm-upgrade | llvm-as > %t.2.bc
4 ; RUN: llvm-upgrade %s -o - | llvm-as > %t.1.bc
2 ; RUN: echo {@X = external global \[1 x i32\] } | \
3 ; RUN: llvm-as > %t.2.bc
4 ; RUN: llvm-as < %s > %t.1.bc
55 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep constant
66
7 %X = constant [1 x int] [ int 12 ]
7 @X = constant [1 x i32] [ i32 12 ] ; <[1 x i32]*> [#uses=0]
8
0 ; Test that appending linkage works correctly when arrays are the same size.
11
2 ; RUN: echo {%X = external constant \[1 x int\] } | \
3 ; RUN: llvm-upgrade | llvm-as > %t.2.bc
4 ; RUN: llvm-upgrade %s | llvm-as > %t.1.bc
2 ; RUN: echo {@X = external constant \[1 x i32\] } | \
3 ; RUN: llvm-as > %t.2.bc
4 ; RUN: llvm-as < %s > %t.1.bc
55 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis | grep constant
66
7 %X = uninitialized global [1 x int]
7 @X = external global [1 x i32] ; <[1 x i32]*> [#uses=0]
0 ; This fails because the linker renames the non-opaque type not the opaque
11 ; one...
22
3 ; RUN: echo "%X = linkonce global int 8" | llvm-upgrade | llvm-as > %t.2.bc
4 ; RUN: llvm-upgrade < %s | llvm-as > %t.1.bc
3 ; RUN: echo "@X = linkonce global i32 8" | llvm-as > %t.2.bc
4 ; RUN: llvm-as < %s > %t.1.bc
55 ; RUN: llvm-link %t.1.bc %t.2.bc | llvm-dis
66
7 %X = linkonce global int 7
7 @X = linkonce global i32 7 ; [#uses=0]
None ; RUN: llvm-upgrade < %s | llvm-as > %t.bc
1 ; RUN: llvm-upgrade < %p/testlink2.ll | llvm-as > %t2.bc
0 ; RUN: llvm-as < %s > %t.bc
1 ; RUN: llvm-as < %p/testlink2.ll > %t2.bc
22 ; RUN: llvm-link %t.bc %t2.bc
33
4 %MyVar = external global int
5 %MyIntList = global { \2 *, int } { { \2, int }* null, int 17 }
6 external global int ; int*:0
4 @MyVar = external global i32 ; [#uses=3]
5 @MyIntList = global { \2*, i32 } { { \2*, i32 }* null, i32 17 } ; <{ \2*, i32 }*> [#uses=1]
6 external global i32 ; :0 [#uses=0]
7 @Inte = global i32 1 ; [#uses=0]
8 @AConst = linkonce constant i32 123 ; [#uses=0]
9 @Intern1 = internal constant i32 42 ; [#uses=0]
10 @Intern2 = internal constant i32 792 ; [#uses=0]
11 @MyVarPtr = linkonce global { i32* } { i32* @MyVar } ; <{ i32* }*> [#uses=0]
712
8 %Inte = global int 1
13 declare i32 @foo(i32)
914
10 %AConst = linkonce constant int 123
15 declare void @print(i32)
1116
12 %Intern1 = internal constant int 42
13 %Intern2 = internal constant int 792
17 define void @main() {
18 %v1 = load i32* @MyVar ; [#uses=1]
19 call void @print( i32 %v1 )
20 %idx = getelementptr { \2*, i32 }* @MyIntList, i64 0, i32 1 ; [#uses=2]
21 %v2 = load i32* %idx ; [#uses=1]
22 call void @print( i32 %v2 )
23 call i32 @foo( i32 5 ) ; :1 [#uses=0]
24 %v3 = load i32* @MyVar ; [#uses=1]
25 call void @print( i32 %v3 )
26 %v4 = load i32* %idx ; [#uses=1]
27 call void @print( i32 %v4 )
28 ret void
29 }
1430
15 ; Initialized to point to external %MyVar
16 %MyVarPtr = linkonce global { int * } { int * %MyVar }
31 define internal void @testintern() {
32 ret void
33 }
1734
18 declare int "foo"(int %blah) ;; Declared in testlink2.ll
35 define internal void @Testintern() {
36 ret void
37 }
1938
20 declare void "print"(int %Value)
21
22 implementation
23
24 void "main"()
25 begin
26 %v1 = load int* %MyVar
27 call void %print(int %v1) ;; Should start out 4
28
29 %idx = getelementptr { \2 *, int }* %MyIntList, long 0, uint 1
30 %v2 = load int* %idx
31 call void %print(int %v2) ;; Should start out 17
32
33 call int %foo(int 5) ;; Modify global variablesx
34
35 %v3 = load int* %MyVar
36 call void %print(int %v3) ;; Should now be 5
37
38 %v4 = load int* %idx
39 call void %print(int %v4) ;; Should start out 12
40
39 define void @testIntern() {
4140 ret void
42 end
43
44 internal void "testintern"() begin ret void end
45 internal void "Testintern"() begin ret void end
46 void "testIntern"() begin ret void end
47
41 }
11 ;
22 ; RUN: true
33
4 %MyVar = global int 4
5 %MyIntList = external global { \2 *, int }
4 @MyVar = global i32 4 ; [#uses=2]
5 @MyIntList = external global { \2*, i32 } ; <{ \2*, i32 }*> [#uses=2]
6 @AConst = constant i32 123 ; [#uses=0]
67
7 %AConst = constant int 123
8 ;; Intern in both testlink[12].ll
9 @Intern1 = internal constant i32 52 ; [#uses=0]
810
9 %Intern1 = internal constant int 52 ;; Intern in both testlink[12].ll
10 %Intern2 = constant int 12345 ;; Intern in one but not in other
11 ;; Intern in one but not in other
12 @Intern2 = constant i32 12345 ; [#uses=0]
1113
12 %MyIntListPtr = constant { {\2,int}* } { {\2,int}* %MyIntList }
13 %MyVarPtr = linkonce global { int * } { int * %MyVar }
14 @MyIntListPtr = constant { { \2*, i32 }* } { { \2*, i32 }* @MyIntList } ; <{ { \2*, i32 }* }*> [#uses=0]
15 @MyVarPtr = linkonce global { i32* } { i32* @MyVar } ; <{ i32* }*> [#uses=0]
16 constant i32 412 ; :0 [#uses=1]
1417
15 constant int 412
18 define i32 @foo(i32 %blah) {
19 store i32 %blah, i32* @MyVar
20 %idx = getelementptr { \2*, i32 }* @MyIntList, i64 0, i32 1 ; [#uses=1]
21 store i32 12, i32* %idx
22 %ack = load i32* @0 ; [#uses=1]
23 %fzo = add i32 %ack, %blah ; [#uses=1]
24 ret i32 %fzo
25 }
1626
17 implementation
27 declare void @unimp(float, double)
1828
19 int "foo"(int %blah)
20 begin
21 store int %blah, int *%MyVar
22 %idx = getelementptr { \2 *, int } * %MyIntList, long 0, uint 1
23 store int 12, int* %idx
29 define internal void @testintern() {
30 ret void
31 }
2432
25 %ack = load int * %0 ;; Load from the unnamed constant
26 %fzo = add int %ack, %blah
27 ret int %fzo
28 end
33 define void @Testintern() {
34 ret void
35 }
2936
30 declare void "unimp"(float, double)
37 define internal void @testIntern() {
38 ret void
39 }
3140
32 internal void "testintern"() begin ret void end
33 void "Testintern"() begin ret void end
34 internal void "testIntern"() begin ret void end
35
None ; RUN: llvm-upgrade < %s | llvm-as > %t.bc
1 ; RUN: llvm-upgrade < %p/testlink1.ll | llvm-as > %t2.bc
0 ; RUN: llvm-as < %s > %t.bc
1 ; RUN: llvm-as < %p/testlink1.ll > %t2.bc
22 ; RUN: llvm-link %t.bc %t.bc %t2.bc -o %t1.bc -f
33 ; RUN: llvm-dis < %t1.bc | grep {kallsyms_names = extern_weak}
44 ; RUN: llvm-dis < %t1.bc | grep {MyVar = external global i32}
55 ; RUN: llvm-dis < %t1.bc | grep {Inte = global i32}
66
7 %kallsyms_names = extern_weak global [0 x ubyte]
8 %MyVar = extern_weak global int
9 %Inte = extern_weak global int
7 @kallsyms_names = extern_weak global [0 x i8] ; <[0 x i8]*> [#uses=0]
8 @MyVar = extern_weak global i32 ; [#uses=0]
9 @Inte = extern_weak global i32 ; [#uses=0]
1010
11 implementation
0 ; Basic block #2 should not be merged into BB #3!
11 ;
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
2 ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
33 ; RUN: grep {br label}
44 ;
5 declare void %foo()
6 implementation
75
8 void "cprop_test12"(int* %data) {
6 declare void @foo()
7
8 define void @cprop_test12(i32* %data) {
99 bb0:
10 %reg108 = load int* %data
11 %cond218 = setne int %reg108, 5
12 br bool %cond218, label %bb3, label %bb2
13
14 bb2:
15 call void %foo()
16 br label %bb3
17
18 bb3:
19 %reg117 = phi int [ 110, %bb2 ], [ %reg108, %bb0 ]
20 store int %reg117, int* %data
21 ret void
10 %reg108 = load i32* %data ; [#uses=2]
11 %cond218 = icmp ne i32 %reg108, 5 ; [#uses=1]
12 br i1 %cond218, label %bb3, label %bb2
13 bb2: ; preds = %bb0
14 call void @foo( )
15 br label %bb3
16 bb3: ; preds = %bb2, %bb0
17 %reg117 = phi i32 [ 110, %bb2 ], [ %reg108, %bb0 ] ; [#uses=1]
18 store i32 %reg117, i32* %data
19 ret void
2220 }
2321
33 ;
44 ; Which is not valid SSA
55 ;
6 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis
6 ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis
77
8 void "test"() {
9 br bool true, label %end, label %Loop
10
11 Loop:
12 %V = phi int [0, %0], [%V1, %Loop]
13 %V1 = add int %V, 1
14
8 define void @test() {
9 ;
10 br i1 true, label %end, label %Loop
11 Loop: ; preds = %Loop, %0
12 %V = phi i32 [ 0, %0 ], [ %V1, %Loop ] ; [#uses=1]
13 %V1 = add i32 %V, 1 ; [#uses=1]
1514 br label %Loop
16 end:
15 end: ; preds = %0
1716 ret void
1817 }
18
0 ; -simplifycfg is not folding blocks if there is a PHI node involved. This
11 ; should be fixed eventually
22
3 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep br
3 ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
44
5 int %main(int %argc) {
6 br label %InlinedFunctionReturnNode
7
8 InlinedFunctionReturnNode: ;[#uses=1]
9 %X = phi int [ 7, %0 ] ; [#uses=1]
10 %Y = add int %X, %argc ; [#uses=1]
11 ret int %Y
5 define i32 @main(i32 %argc) {
6 ;
7 br label %InlinedFunctionReturnNode
8 InlinedFunctionReturnNode: ; preds = %0
9 %X = phi i32 [ 7, %0 ] ; [#uses=1]
10 %Y = add i32 %X, %argc ; [#uses=1]
11 ret i32 %Y
1212 }
1313
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg
0 ; RUN: llvm-as < %s | opt -simplifycfg
11
2 int %test(int %A, int %B, bool %cond) {
2 define i32 @test(i32 %A, i32 %B, i1 %cond) {
33 J:
4 %C = add int %A, 12
5 br bool %cond, label %L, label %L
6 L:
7 %Q = phi int [%C, %J], [%C, %J] ; PHI node is obviously redundant
8 %D = add int %C, %B
9 %E = add int %Q, %D
10 ret int %E
4 %C = add i32 %A, 12 ; [#uses=3]
5 br i1 %cond, label %L, label %L
6 L: ; preds = %J, %J
7 %Q = phi i32 [ %C, %J ], [ %C, %J ] ; [#uses=1]
8 %D = add i32 %C, %B ; [#uses=1]
9 %E = add i32 %Q, %D ; [#uses=1]
10 ret i32 %E
1111 }
12
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -disable-output
0 ; RUN: llvm-as < %s | opt -simplifycfg -disable-output
11
2 implementation ; Functions:
3
4 void %test(int* %ldo, bool %c, bool %d) {
2 define void @test(i32* %ldo, i1 %c, i1 %d) {
53 bb9:
6 br bool %c, label %bb11, label %bb10
7
4 br i1 %c, label %bb11, label %bb10
85 bb10: ; preds = %bb9
96 br label %bb11
10
117 bb11: ; preds = %bb10, %bb9
12 %reg330 = phi int* [ null, %bb10 ], [ %ldo, %bb9 ]
8 %reg330 = phi i32* [ null, %bb10 ], [ %ldo, %bb9 ] ; [#uses=1]
139 br label %bb20
14
15 bb20: ; preds = %bb23, %bb25, %bb27, %bb11
16 store int* %reg330, int** null
17 br bool %d, label %bb20, label %done
18
19 done:
10 bb20: ; preds = %bb20, %bb11
11 store i32* %reg330, i32** null
12 br i1 %d, label %bb20, label %done
13 done: ; preds = %bb20
2014 ret void
2115 }
16
0 ; Do not remove the invoke!
11 ;
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -disable-output
2 ; RUN: llvm-as < %s | opt -simplifycfg -disable-output
33
4 int %test() {
5 %A = invoke int %test() to label %Ret except label %Ret2
6 Ret:
7 ret int %A
8 Ret2:
9 ret int undef
4 define i32 @test() {
5 %A = invoke i32 @test( )
6 to label %Ret unwind label %Ret2 ; [#uses=1]
7 Ret: ; preds = %0
8 ret i32 %A
9 Ret2: ; preds = %0
10 ret i32 undef
1011 }
12
0 ; Do not remove the invoke!
11 ;
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | grep invoke
2 ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep invoke
33
4 int %test() {
5 invoke int %test() to label %Ret except label %Ret
6 Ret:
7 %A = add int 0, 1
8 ret int %A
4 define i32 @test() {
5 invoke i32 @test( )
6 to label %Ret unwind label %Ret ; :1 [#uses=0]
7 Ret: ; preds = %0, %0
8 %A = add i32 0, 1 ; [#uses=1]
9 ret i32 %A
910 }
11
0 ; This test checks to make sure that 'br X, Dest, Dest' is folded into
11 ; 'br Dest'
22
3 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
3 ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
44 ; RUN: not grep {br bool %c2}
55
6 declare void %noop()
6 declare void @noop()
77
8 int %test(bool %c1, bool %c2) {
9 call void %noop()
10 br bool %c1, label %A, label %Y
11 A:
12 call void %noop()
13 br bool %c2, label %X, label %X ; Can be converted to unconditional br
14 X:
15 call void %noop()
16 ret int 0
17 Y:
18 call void %noop()
8 define i32 @test(i1 %c1, i1 %c2) {
9 call void @noop( )
10 br i1 %c1, label %A, label %Y
11 A: ; preds = %0
12 call void @noop( )
13 br i1 %c2, label %X, label %X
14 X: ; preds = %Y, %A, %A
15 call void @noop( )
16 ret i32 0
17 Y: ; preds = %0
18 call void @noop( )
1919 br label %X
2020 }
21
22 ; due to the fact that the SimplifyCFG function does not use
33 ; the ConstantFoldTerminator function.
44
5 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
5 ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
66 ; RUN: not grep {br bool %c2}
77
8 declare void %noop()
8 declare void @noop()
99
10 int %test(bool %c1, bool %c2) {
11 call void %noop()
12 br bool %c1, label %A, label %Y
13 A:
14 call void %noop()
15 br bool %c2, label %Z, label %X ; Can be converted to unconditional br
16 Z:
10 define i32 @test(i1 %c1, i1 %c2) {
11 call void @noop( )
12 br i1 %c1, label %A, label %Y
13 A: ; preds = %0
14 call void @noop( )
15 br i1 %c2, label %Z, label %X
16 Z: ; preds = %A
1717 br label %X
18 X:
19 call void %noop()
20 ret int 0
21 Y:
22 call void %noop()
18 X: ; preds = %Y, %Z, %A
19 call void @noop( )
20 ret i32 0
21 Y: ; preds = %0
22 call void @noop( )
2323 br label %X
2424 }
25
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
0 ; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
11 ; RUN: not grep switch
22
3 int %test1() { ; Test normal folding
4 switch uint 5, label %Default [
5 uint 0, label %Foo
6 uint 1, label %Bar
7 uint 2, label %Baz
8 uint 5, label %TheDest
9 ]
10 Default:ret int -1
11 Foo: ret int -2
12 Bar: ret int -3
13 Baz: ret int -4
14 TheDest:ret int 1234
3 ; Test normal folding
4 define i32 @test1() {
5 switch i32 5, label %Default [
6 i32 0, label %Foo
7 i32 1, label %Bar
8 i32 2, label %Baz
9 i32 5, label %TheDest
10 ]
11 Default: ; preds = %0
12 ret i32 -1
13 Foo: ; preds = %0
14 ret i32 -2
15 Bar: ; preds = %0
16 ret i32 -3
17 Baz: ; preds = %0
18 ret i32 -4
19 TheDest: ; preds = %0
20 ret i32 1234
1521 }
1622
17 int %test2() { ; Test folding to default dest
18 switch uint 3, label %Default [
19 uint 0, label %Foo
20 uint 1, label %Bar
21 uint 2, label %Baz
22 uint 5, label %TheDest
23 ]
24 Default:ret int 1234
25 Foo: ret int -2
26 Bar: ret int -5
27 Baz: ret int -6
28 TheDest:ret int -8
23 ; Test folding to default dest
24 define i32 @test2() {
25 switch i32 3, label %Default [
26 i32 0, label %Foo
27 i32 1, label %Bar
28 i32 2, label %Baz
29 i32 5, label %TheDest
30 ]
31 Default: ; preds = %0
32 ret i32 1234
33 Foo: ; preds = %0
34 ret i32 -2
35 Bar: ; preds = %0
36 ret i32 -5
37 Baz: ; preds = %0
38 ret i32 -6
39 TheDest: ; preds = %0
40 ret i32 -8
2941 }
3042
31 int %test3(bool %C) { ; Test folding all to same dest
32 br bool %C, label %Start, label %TheDest
33 Start:
34 switch uint 3, label %TheDest [
35 uint 0, label %TheDest
36 uint 1, label %TheDest
37 uint 2, label %TheDest
38 uint 5, label %TheDest
39 ]
40 TheDest: ret int 1234
43 ; Test folding all to same dest
44 define i32 @test3(i1 %C) {
45 br i1 %C, label %Start, label %TheDest
46 Start: ; preds = %0
47 switch i32 3, label %TheDest [
48 i32 0, label %TheDest
49 i32 1, label %TheDest
50 i32 2, label %TheDest
51 i32 5, label %TheDest
52 ]
53 TheDest: ; preds = %Start, %Start, %Start, %Start, %Start, %0
54 ret i32 1234
4155 }
4256
43 int %test4(uint %C) { ; Test folding switch -> branch
44 switch uint %C, label %L1 [
45 uint 0, label %L2
46 ]
47 L1: ret int 0
48 L2: ret int 1
57 ; Test folding switch -> branch
58 define i32 @test4(i32 %C) {
59 switch i32 %C, label %L1 [
60 i32 0, label %L2
61 ]
62 L1: ; preds = %0
63 ret i32 0
64 L2: ; preds = %0
65 ret i32 1
4966 }
5067
51 int %test5(uint %C) {
52 switch uint %C, label %L1 [ ; Can fold into a cond branch!
53 uint 0, label %L2
54 uint 123, label %L1
55 ]
56 L1: ret int 0
57 L2: ret int 1
68 ; Can fold into a cond branch!
69 define i32 @test5(i32 %C) {
70 switch i32 %C, label %L1 [
71 i32 0, label %L2
72 i32 123, label %L1
73 ]
74 L1: ; preds = %0, %0
75 ret i32 0
76 L2: ; preds = %0
77 ret i32 1
5878 }
5979
60
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -disable-output
0 ; RUN: llvm-as < %s | opt -simplifycfg -disable-output
11
2 implementation ; Functions:
3
4 void %symhash_add() {
2 define void @symhash_add() {
53 entry:
6 br bool undef, label %then.0, label %UnifiedReturnBlock
7
4 br i1 undef, label %then.0, label %UnifiedReturnBlock
85 then.0: ; preds = %entry
9 br bool undef, label %loopentry.2, label %loopentry.1.preheader
10
6 br i1 undef, label %loopentry.2, label %loopentry.1.preheader
117 loopentry.1.preheader: ; preds = %then.0
128 br label %loopentry.1.outer
13
14 loopentry.1.outer: ; preds = %loopentry.1.preheader, %loopexit.1
9 loopentry.1.outer: ; preds = %loopexit.1, %loopentry.1.preheader
1510 br label %loopentry.1
16
17 loopentry.1: ; preds = %loopentry.1.outer, %then.1, %then.3, %then.4, %endif.1
18 br bool undef, label %loopexit.1, label %no_exit.1
19
11 loopentry.1: ; preds = %endif.1, %then.4, %then.3, %then.1, %loopentry.1.outer
12 br i1 undef, label %loopexit.1, label %no_exit.1
2013 no_exit.1: ; preds = %loopentry.1
21 br bool undef, label %then.1, label %else.0
22
14 br i1 undef, label %then.1, label %else.0
2315 then.1: ; preds = %no_exit.1
2416 br label %loopentry.1
25
2617 else.0: ; preds = %no_exit.1
27 br bool undef, label %then.2, label %else.1
28
18 br i1 undef, label %then.2, label %else.1
2919 then.2: ; preds = %else.0
30 br bool undef, label %then.3, label %endif.1
31
20 br i1 undef, label %then.3, label %endif.1
3221 then.3: ; preds = %then.2
3322 br label %loopentry.1
34
3523 else.1: ; preds = %else.0
36 br bool undef, label %endif.1, label %then.4
37
24 br i1 undef, label %endif.1, label %then.4
3825 then.4: ; preds = %else.1
3926 br label %loopentry.1
40
41 endif.1: ; preds = %then.2, %else.1
27 endif.1: ; preds = %else.1, %then.2
4228 br label %loopentry.1
43
4429 loopexit.1: ; preds = %loopentry.1
45 br bool undef, label %loopentry.1.outer, label %loopentry.2
46
47 loopentry.2: ; preds = %then.0, %loopexit.1, %no_exit.2
48 br bool undef, label %loopexit.2, label %no_exit.2
49
30 br i1 undef, label %loopentry.1.outer, label %loopentry.2
31 loopentry.2: ; preds = %no_exit.2, %loopexit.1, %then.0
32 br i1 undef, label %loopexit.2, label %no_exit.2
5033 no_exit.2: ; preds = %loopentry.2
5134 br label %loopentry.2
52
5335 loopexit.2: ; preds = %loopentry.2
5436 ret void
55
5637 UnifiedReturnBlock: ; preds = %entry
5738 ret void
5839 }
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -disable-output
0 ; RUN: llvm-as < %s | opt -simplifycfg -disable-output
11 ; PR584
2 @g_38098584 = external global i32 ; [#uses=1]
3 @g_60187400 = external global i32 ; [#uses=1]
4 @g_59182229 = external global i32 ; [#uses=2]
25
3 %g_38098584 = external global uint ; [#uses=1]
4 %g_60187400 = external global uint ; [#uses=1]
5 %g_59182229 = external global uint ; [#uses=2]
6
7 implementation ; Functions:
8
9 int %_Z13func_26556482h(ubyte %l_88173906) {
6 define i32 @_Z13func_26556482h(i8 %l_88173906) {
107 entry:
11 %tmp.1 = cast ubyte %l_88173906 to sbyte ; [#uses=2]
12 %tmp.3 = seteq ubyte %l_88173906, 0 ; [#uses=1]
13 br bool %tmp.3, label %else.0, label %then.0
14
8 %tmp.1 = bitcast i8 %l_88173906 to i8 ; [#uses=2]
9 %tmp.3 = icmp eq i8 %l_88173906, 0 ; [#uses=1]
10 br i1 %tmp.3, label %else.0, label %then.0
1511 then.0: ; preds = %entry
16 %tmp.5 = seteq ubyte %l_88173906, 0 ; [#uses=1]
17 br bool %tmp.5, label %else.1, label %then.1
18
12 %tmp.5 = icmp eq i8 %l_88173906, 0 ; [#uses=1]
13 br i1 %tmp.5, label %else.1, label %then.1
1914 then.1: ; preds = %then.0
2015 br label %return
21
2216 else.1: ; preds = %then.0
2317 br label %loopentry.0
24
2518 loopentry.0: ; preds = %no_exit.0, %else.1
26 %i.0.1 = phi int [ 0, %else.1 ], [ %inc.0, %no_exit.0 ] ; [#uses=2]
27 %tmp.9 = setgt int %i.0.1, 99 ; [#uses=1]
28 br bool %tmp.9, label %endif.0, label %no_exit.0
29
19 %i.0.1 = phi i32 [ 0, %else.1 ], [ %inc.0, %no_exit.0 ] ; [#uses=2]
20 %tmp.9 = icmp sgt i32 %i.0.1, 99 ; [#uses=1]
21 br i1 %tmp.9, label %endif.0, label %no_exit.0
3022 no_exit.0: ; preds = %loopentry.0
31 %inc.0 = add int %i.0.1, 1 ; > [#uses=1]
23 %inc.0 = add i32 %i.0.1, 1 ; > [#uses=1]
3224 br label %loopentry.0
33
3425 else.0: ; preds = %entry
35 %tmp.12 = cast sbyte %tmp.1 to int ; > [#uses=1]
26 %tmp.12 = sext i8 %tmp.1 to i32 ; > [#uses=1]
3627 br label %return
37
3828 endif.0: ; preds = %loopentry.0
39 %tmp.14 = cast sbyte %tmp.1 to int ; [#uses=1]
40 %tmp.16 = cast ubyte %l_88173906 to int ; [#uses=1]
41 %tmp.17 = setgt int %tmp.14, %tmp.16 ; [#uses=1]
42 %tmp.19 = load uint* %g_59182229 ; [#uses=2]
43 br bool %tmp.17, label %cond_true, label %cond_false
44
29 %tmp.14 = sext i8 %tmp.1 to i32 ; [#uses=1]
30 %tmp.16 = zext i8 %l_88173906 to i32 ; [#uses=1]
31 %tmp.17 = icmp sgt i32 %tmp.14, %tmp.16 ; [#uses=1]
32 %tmp.19 = load i32* @g_59182229 ; [#uses=2]
33 br i1 %tmp.17, label %cond_true, label %cond_false
4534 cond_true: ; preds = %endif.0
46 %tmp.20 = setne uint %tmp.19, 1 ; > [#uses=1]
35 %tmp.20 = icmp ne i32 %tmp.19, 1 ; > [#uses=1]
4736 br label %cond_continue
48
4937 cond_false: ; preds = %endif.0
50 %tmp.22 = setne uint %tmp.19, 0 ; > [#uses=1]
38 %tmp.22 = icmp ne i32 %tmp.19, 0 ; > [#uses=1]
5139 br label %cond_continue
52
5340 cond_continue: ; preds = %cond_false, %cond_true
54 %mem_tmp.0 = phi bool [ %tmp.20, %cond_true ], [ %tmp.22, %cond_false ] ; [#uses=1]
55 br bool %mem_tmp.0, label %then.2, label %else.2
56
41 %mem_tmp.0 = phi i1 [ %tmp.20, %cond_true ], [ %tmp.22, %cond_false ] ; [#uses=1]
42 br i1 %mem_tmp.0, label %then.2, label %else.2
5743 then.2: ; preds = %cond_continue
58 %tmp.25 = cast ubyte %l_88173906 to int ; > [#uses=1]
44 %tmp.25 = zext i8 %l_88173906 to i32 ; > [#uses=1]
5945 br label %return
60
6146 else.2: ; preds = %cond_continue
6247 br label %loopentry.1
63
6448 loopentry.1: ; preds = %endif.3, %else.2
65 %i.1.1 = phi int [ 0, %else.2 ], [ %inc.3, %endif.3 ] ; [#uses=2]
66 %i.3.2 = phi int [ undef, %else.2 ], [ %i.3.0, %endif.3 ] ; [#uses=2]
67 %l_88173906_addr.1 = phi ubyte [ %l_88173906, %else.2 ], [ %l_88173906_addr.0, %endif.3 ] ; [#uses=3]
68 %tmp.29 = setgt int %i.1.1, 99 ; [#uses=1]
69 br bool %tmp.29, label %endif.2, label %no_exit.1
70
49 %i.1.1 = phi i32 [ 0, %else.2 ], [ %inc.3, %endif.3 ] ; [#uses=2]
50 %i.3.2 = phi i32 [ undef, %else.2 ], [ %i.3.0, %endif.3 ] ; [#uses=2]
51 %l_88173906_addr.1 = phi i8 [ %l_88173906, %else.2 ], [ %l_88173906_addr.0, %endif.3 ] ; [#uses=3]
52 %tmp.29 = icmp sgt i32 %i.1.1, 99 ; [#uses=1]
53 br i1 %tmp.29, label %endif.2, label %no_exit.1
7154 no_exit.1: ; preds = %loopentry.1
72 %tmp.30 = load uint* %g_38098584 ; [#uses=1]
73 %tmp.31 = seteq uint %tmp.30, 0 ; [#uses=1]
74 br bool %tmp.31, label %else.3, label %then.3
75
55 %tmp.30 = load i32* @g_38098584 ; [#uses=1]
56 %tmp.31 = icmp eq i32 %tmp.30, 0 ; [#uses=1]
57 br i1 %tmp.31, label %else.3, label %then.3
7658 then.3: ; preds = %no_exit.1
7759 br label %endif.3
78
7960 else.3: ; preds = %no_exit.1
80 br bool false, label %else.4, label %then.4
81
61 br i1 false, label %else.4, label %then.4
8262 then.4: ; preds = %else.3
8363 br label %endif.3
84
8564 else.4: ; preds = %else.3
86 br bool false, label %else.5, label %then.5
87
65 br i1 false, label %else.5, label %then.5
8866 then.5: ; preds = %else.4
89 store uint 3290648471, uint* %g_59182229
67 store i32 -1004318825, i32* @g_59182229
9068 br label %return
91
9269 else.5: ; preds = %else.4
9370 br label %loopentry.3
94
9571 loopentry.3: ; preds = %then.7, %else.5
96 %i.3.3 = phi int [ 0, %else.5 ], [ %inc.2, %then.7 ] ; [#uses=3]
97 %tmp.55 = setgt int %i.3.3, 99 ; [#uses=1]
98 br bool %tmp.55, label %endif.3, label %no_exit.3
99
72 %i.3.3 = phi i32 [ 0, %else.5 ], [ %inc.2, %then.7 ] ; [#uses=3]
73 %tmp.55 = icmp sgt i32 %i.3.3, 99 ; [#uses=1]
74 br i1 %tmp.55, label %endif.3, label %no_exit.3
10075 no_exit.3: ; preds = %loopentry.3
101 %tmp.57 = seteq ubyte %l_88173906_addr.1, 0 ; [#uses=1]
102 br bool %tmp.57, label %else.7, label %then.7
103
76 %tmp.57 = icmp eq i8 %l_88173906_addr.1, 0 ; [#uses=1]
77 br i1 %tmp.57, label %else.7, label %then.7
10478 then.7: ; preds = %no_exit.3
105 store uint 16239, uint* %g_60187400
106 %inc.2 = add int %i.3.3, 1 ; [#uses=1]
79 store i32 16239, i32* @g_60187400
80 %inc.2 = add i32 %i.3.3, 1 ; [#uses=1]
10781 br label %loopentry.3
108
10982 else.7: ; preds = %no_exit.3
11083 br label %return
111
11284 endif.3: ; preds = %loopentry.3, %then.4, %then.3
113 %i.3.0 = phi int [ %i.3.2, %then.3 ], [ %i.3.2, %then.4 ], [ %i.3.3, %loopentry.3 ] ; [#uses=1]
114 %l_88173906_addr.0 = phi ubyte [ 100, %then.3 ], [ %l_88173906_addr.1, %then.4 ], [ %l_88173906_addr.1, %loopentry.3 ] ; [#uses=1]
115 %inc.3 = add int %i.1.1, 1 ; > [#uses=1]
85 %i.3.0 = phi i32 [ %i.3.2, %then.3 ], [ %i.3.2, %then.4 ], [ %i.3.3, %loopentry.3 ] ; > [#uses=1]
86 %l_88173906_addr.0 = phi i8 [ 100, %then.3 ], [ %l_88173906_addr.1, %then.4 ], [ %l_88173906_addr.1, %loopentry.3 ] ; [#uses=1]
87 %inc.3 = add i32 %i.1.1, 1 ; [#uses=1]
11688 br label %loopentry.1
117
11889 endif.2: ; preds = %loopentry.1
11990 br label %return
120
12191 return: ; preds = %endif.2, %else.7, %then.5, %then.2, %else.0, %then.1
122 %result.0 = phi int [ 1624650671, %then.1 ], [ %tmp.25, %then.2 ], [ 3379, %then.5 ], [ 52410, %else.7 ], [ -1526438411, %endif.2 ], [ %tmp.12, %else.0 ] ; [#uses=1]
123 ret int %result.0
92 %result.0 = phi i32 [ 1624650671, %then.1 ], [ %tmp.25, %then.2 ], [ 3379, %then.5 ], [ 52410, %else.7 ], [ -1526438411, %endif.2 ], [ %tmp.12, %else.0 ] ; [#uses=1]
93 ret i32 %result.0
12494 }
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -disable-output
0 ; RUN: llvm-as < %s | opt -simplifycfg -disable-output
1 ; END.
12
2 void %main() {
3 define void @main() {
34 entry:
4 %tmp.14.i19 = seteq int 0, 2 ; [#uses=1]
5 br bool %tmp.14.i19, label %endif.1.i20, label %read_min.exit
6
5 %tmp.14.i19 = icmp eq i32 0, 2 ; [#uses=1]
6 br i1 %tmp.14.i19, label %endif.1.i20, label %read_min.exit
77 endif.1.i20: ; preds = %entry
8 %tmp.9.i.i = seteq sbyte* null, null ; [#uses=1]
9 br bool %tmp.9.i.i, label %then.i12.i, label %then.i.i
10
8 %tmp.9.i.i = icmp eq i8* null, null ; [#uses=1]
9 br i1 %tmp.9.i.i, label %then.i12.i, label %then.i.i
1110 then.i.i: ; preds = %endif.1.i20
1211 ret void
13
1412 then.i12.i: ; preds = %endif.1.i20
15 %tmp.9.i4.i = seteq sbyte* null, null ; [#uses=1]
16 br bool %tmp.9.i4.i, label %endif.2.i33, label %then.i5.i
17
13 %tmp.9.i4.i = icmp eq i8* null, null ; [#uses=1]
14 br i1 %tmp.9.i4.i, label %endif.2.i33, label %then.i5.i
1815 then.i5.i: ; preds = %then.i12.i
1916 ret void
20
2117 endif.2.i33: ; preds = %then.i12.i
22 br bool false, label %loopexit.0.i40, label %no_exit.0.i35
23
18 br i1 false, label %loopexit.0.i40, label %no_exit.0.i35
2419 no_exit.0.i35: ; preds = %no_exit.0.i35, %endif.2.i33
25 %tmp.130.i = setlt int 0, 0 ; [#uses=1]
26 br bool %tmp.130.i, label %loopexit.0.i40.loopexit, label %no_exit.0.i35
27
20 %tmp.130.i = icmp slt i32 0, 0 ; [#uses=1]
21 br i1 %tmp.130.i, label %loopexit.0.i40.loopexit, label %no_exit.0.i35
2822 loopexit.0.i40.loopexit: ; preds = %no_exit.0.i35
2923 br label %loopexit.0.i40
30
3124 loopexit.0.i40: ; preds = %loopexit.0.i40.loopexit, %endif.2.i33
32 %tmp.341.i = seteq int 0, 0 ; [#uses=1]
33 br bool %tmp.341.i, label %loopentry.1.i, label %read_min.exit
34
25 %tmp.341.i = icmp eq i32 0, 0 ; [#uses=1]
26 br i1 %tmp.341.i, label %loopentry.1.i, label %read_min.exit
3527 loopentry.1.i: ; preds = %loopexit.0.i40
36 %tmp.347.i = setgt int 0, 0 ; [#uses=1]
37 br bool %tmp.347.i, label %no_exit.1.i41, label %loopexit.2.i44
38
28 %tmp.347.i = icmp sgt i32 0, 0 ; [#uses=1]
29 br i1 %tmp.347.i, label %no_exit.1.i41, label %loopexit.2.i44
3930 no_exit.1.i41: ; preds = %endif.5.i, %loopentry.1.i
40 %indvar.i42 = phi uint [ %indvar.next.i, %endif.5.i ], [ 0, %loopentry.1.i ] ; [#uses=1]
41 %tmp.355.i = seteq int 0, 3 ; [#uses=1]
42 br bool %tmp.355.i, label %endif.5.i, label %read_min.exit
43
31 %indvar.i42 = phi i32 [ %indvar.next.i, %endif.5.i ], [ 0, %loopentry.1.i ] ; [#uses=1]
32 %tmp.355.i = icmp eq i32 0, 3 ; [#uses=1]
33 br i1 %tmp.355.i, label %endif.5.i, label %read_min.exit
4434 endif.5.i: ; preds = %no_exit.1.i41
45 %tmp.34773.i = setgt int 0, 0 ; [#uses=1]
46 %indvar.next.i = add uint %indvar.i42, 1 ; [#uses=1]
47 br bool %tmp.34773.i, label %no_exit.1.i41, label %loopexit.1.i.loopexit
48
35 %tmp.34773.i = icmp sgt i32 0, 0 ; [#uses=1]
36 %indvar.next.i = add i32 %indvar.i42, 1 ; [#uses=1]
37 br i1 %tmp.34773.i, label %no_exit.1.i41, label %loopexit.1.i.loopexit
4938 loopexit.1.i.loopexit: ; preds = %endif.5.i
5039 ret void
51
5240 loopexit.2.i44: ; preds = %loopentry.1.i
5341 ret void
54
5542 read_min.exit: ; preds = %no_exit.1.i41, %loopexit.0.i40, %entry
56 %tmp.23 = seteq int 0, 0 ; [#uses=1]
57 br bool %tmp.23, label %endif.1, label %then.1
58
43 %tmp.23 = icmp eq i32 0, 0 ; [#uses=1]
44 br i1 %tmp.23, label %endif.1, label %then.1
5945 then.1: ; preds = %read_min.exit
60 br bool false, label %endif.0.i, label %then.0.i
61
46 br i1 false, label %endif.0.i, label %then.0.i
6247 then.0.i: ; preds = %then.1
63 br bool false, label %endif.1.i, label %then.1.i
64
48 br i1 false, label %endif.1.i, label %then.1.i
6549 endif.0.i: ; preds = %then.1
66 br bool false, label %endif.1.i, label %then.1.i
67
50 br i1 false, label %endif.1.i, label %then.1.i
6851 then.1.i: ; preds = %endif.0.i, %then.0.i
69 br bool false, label %getfree.exit, label %then.2.i
70
52 br i1 false, label %getfree.exit, label %then.2.i
7153 endif.1.i: ; preds = %endif.0.i, %then.0.i
72 br bool false, label %getfree.exit, label %then.2.i
73
54 br i1 false, label %getfree.exit, label %then.2.i
7455 then.2.i: ; preds = %endif.1.i, %then.1.i
7556 ret void
76
7757 getfree.exit: ; preds = %endif.1.i, %then.1.i
7858 ret void
79
8059 endif.1: ; preds = %read_min.exit
81 %tmp.27.i = getelementptr int* null, int 0
82 br bool false, label %loopexit.0.i15, label %no_exit.0.i14
83
60 %tmp.27.i = getelementptr i32* null, i32 0 ; [#uses=0]
61 br i1 false, label %loopexit.0.i15, label %no_exit.0.i14
8462 no_exit.0.i14: ; preds = %endif.1
8563 ret void
86
8764 loopexit.0.i15: ; preds = %endif.1
88 br bool false, label %primal_start_artificial.exit, label %no_exit.1.i16
89
65 br i1 false, label %primal_start_artificial.exit, label %no_exit.1.i16
9066 no_exit.1.i16: ; preds = %no_exit.1.i16, %loopexit.0.i15
91 br bool false, label %primal_start_artificial.exit, label %no_exit.1.i16
92
67 br i1 false, label %primal_start_artificial.exit, label %no_exit.1.i16
9368 primal_start_artificial.exit: ; preds = %no_exit.1.i16, %loopexit.0.i15
9469 ret void
9570 }
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -disable-output
0 ; RUN: llvm-as < %s | opt -simplifycfg -disable-output
11 ; END.
22
3 %arraytype.1.Char = type { int, [0 x sbyte] }
4 %arraytype.4.Signed = type { int, [0 x int] }
3 %arraytype.1.Char = type { i32, [0 x i8] }
4 %arraytype.4.Signed = type { i32, [0 x i32] }
55 %functiontype.23 = type %structtype.Task* (%structtype.Task*, %structtype.Packet*, %structtype.FailedRun*)
66 %functiontype.27 = type %structtype.object* ()
7 %functiontype.28 = type bool (%structtype.object*, %structtype.object_vtable*)
8 %functiontype.39 = type int (%structtype.listiter*)
9 %opaquetype.RuntimeTypeInfo = type sbyte* (sbyte*)
7 %functiontype.28 = type i1 (%structtype.object*, %structtype.object_vtable*)
8 %functiontype.39 = type i32 (%structtype.listiter*)
9 %opaquetype.RuntimeTypeInfo = type i8* (i8*)
1010 %structtype.AssertionError_vtable = type { %structtype.FailedRun_vtable }
1111 %structtype.DeviceTask = type { %structtype.Task }
1212 %structtype.FailedRun = type { %structtype.object }
1313 %structtype.FailedRun_vtable = type { %structtype.object_vtable }
14 %structtype.Packet = type { %structtype.object, %structtype.list.1*, int, int, int, %structtype.Packet* }
15 %structtype.Task = type { %structtype.TaskState, %structtype.FailedRun*, int, %structtype.Packet*, %structtype.Task*, int }
16 %structtype.TaskState = type { %structtype.object, bool, bool, bool }
14 %structtype.Packet = type { %structtype.object, %structtype.list.1*, i32, i32, i32, %structtype.Packet* }
15 %structtype.Task = type { %structtype.TaskState, %structtype.FailedRun*, i32, %structtype.Packet*, %structtype.Task*, i32 }
16 %structtype.TaskState = type { %structtype.object, i1, i1, i1 }
1717 %structtype.list.1 = type { %arraytype.4.Signed* }
18 %structtype.listiter = type { %structtype.list.1*, int }
18 %structtype.listiter = type { %structtype.list.1*, i32 }
1919 %structtype.object = type { %structtype.object_vtable* }
2020 %structtype.object_vtable = type { %structtype.object_vtable*, %opaquetype.RuntimeTypeInfo*, %arraytype.1.Char*, %functiontype.27* }
21 %structinstance.59 = external global %structtype.AssertionError_vtable ; <%structtype.AssertionError_vtable*> [#uses=0]
21 @structinstance.59 = external global %structtype.AssertionError_vtable ; <%structtype.AssertionError_vtable*> [#uses=0]
2222
23 implementation ; Functions:
23 declare fastcc i1 @ll_isinstance__objectPtr_object_vtablePtr()
2424
25 declare fastcc bool %ll_isinstance__objectPtr_object_vtablePtr()
25 declare fastcc void @ll_listnext__listiterPtr()
2626
27 declare fastcc void %ll_listnext__listiterPtr()
28
29 fastcc void %WorkTask.fn() {
27 define fastcc void @WorkTask.fn() {
3028 block0:
3129 br label %block1
32
3330 block1: ; preds = %block0
34 %v2542 = call fastcc bool %ll_isinstance__objectPtr_object_vtablePtr( ) ; [#uses=1]
35 br bool %v2542, label %block4, label %block2
36
31 %v2542 = call fastcc i1 @ll_isinstance__objectPtr_object_vtablePtr( ) ; [#uses=1]
32 br i1 %v2542, label %block4, label %block2
3733 block2: ; preds = %block1
3834 br label %block3
39
4035 block3: ; preds = %block2
4136 unwind
42
4337 block4: ; preds = %block1
4438 br label %block5
45
4639 block5: ; preds = %block4
47 %v2565 = seteq %structtype.Packet* null, null ; [#uses=1]
48 br bool %v2565, label %block15, label %block6
49
40 %v2565 = icmp eq %structtype.Packet* null, null ; [#uses=1]
41 br i1 %v2565, label %block15, label %block6
5042 block6: ; preds = %block5
5143 %self_2575 = phi %structtype.DeviceTask* [ null, %block5 ] ; <%structtype.DeviceTask*> [#uses=1]
52 br bool false, label %block14, label %block7
53
44 br i1 false, label %block14, label %block7
5445 block7: ; preds = %block14, %block6
5546 %self_2635 = phi %structtype.DeviceTask* [ %self_2575, %block6 ], [ null, %block14 ] ; <%structtype.DeviceTask*> [#uses=1]
56 %tmp.124 = getelementptr %structtype.Packet* null, int 0, uint 2 ; *> [#uses=0]
47 %tmp.124 = getelementptr %structtype.Packet* null, i32 0, i32 2 ; *> [#uses=0]
5748 br label %block8
58
5949 block8: ; preds = %block10, %block7
6050 %self_2672 = phi %structtype.DeviceTask* [ %self_2635, %block7 ], [ null, %block10 ] ; <%structtype.DeviceTask*> [#uses=0]
61 invoke fastcc void %ll_listnext__listiterPtr( )
51 invoke fastcc void @ll_listnext__listiterPtr( )
6252 to label %block9 unwind label %block8_exception_handling
63
6453 block8_exception_handling: ; preds = %block8
65 br bool false, label %block8_exception_found_branchto_block12, label %block8_not_exception_structinstance.10
66
54 br i1 false, label %block8_exception_found_branchto_block12, label %block8_not_exception_structinstance.10
6755 block8_not_exception_structinstance.10: ; preds = %block8_exception_handling
6856 unwind
69
7057 block8_exception_found_branchto_block12: ; preds = %block8_exception_handling
7158 br label %block12
72
7359 block9: ; preds = %block8
74 br bool false, label %block11, label %block10
75
60 br i1 false, label %block11, label %block10
7661 block10: ; preds = %block11, %block9
7762 br label %block8
78
7963 block11: ; preds = %block9
8064 br label %block10
81
8265 block12: ; preds = %block8_exception_found_branchto_block12
8366 br label %block13
84
8567 block13: ; preds = %block15, %block12
8668 ret void
87
8869 block14: ; preds = %block6
8970 br label %block7
90
9171 block15: ; preds = %block5
9272 %v2586 = phi %structtype.DeviceTask* [ null, %block5 ] ; <%structtype.DeviceTask*> [#uses=0]
9373 br label %block13
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -disable-output
0 ; RUN: llvm-as < %s | opt -simplifycfg -disable-output
11
2 bool %foo() {
3 %X = invoke bool %foo() to label %N unwind label %F
4 F:
5 ret bool false
6 N:
7 br bool %X, label %A, label %B
8 A:
9 ret bool true
10 B:
11 ret bool true
2 define i1 @foo() {
3 %X = invoke i1 @foo( )
4 to label %N unwind label %F ; [#uses=1]
5 F: ; preds = %0
6 ret i1 false
7 N: ; preds = %0
8 br i1 %X, label %A, label %B
9 A: ; preds = %N
10 ret i1 true
11 B: ; preds = %N
12 ret i1 true
1213 }
14
0 ; Make sure this doesn't turn into an infinite loop
11
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -constprop -simplifycfg |\
2 ; RUN: llvm-as < %s | opt -simplifycfg -constprop -simplifycfg |\
33 ; RUN: llvm-dis | grep bb86
44 ; END.
5
6 %struct.anon = type { i32, i32, i32, i32, [1024 x i8] }
7 @_zero_ = external global %struct.anon* ; <%struct.anon**> [#uses=2]
8 @_one_ = external global %struct.anon* ; <%struct.anon**> [#uses=4]
9 @str = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=0]
510
6 %struct.anon = type { uint, int, int, int, [1024 x sbyte] }
7 %_zero_ = external global %struct.anon* ; <%struct.anon**> [#uses=2]
8 %_one_ = external global %struct.anon* ; <%struct.anon**> [#uses=4]
9 %str = internal constant [4 x sbyte] c"%d\0A\00" ; <[4 x sbyte]*> [#uses=1]