llvm.org GIT mirror llvm / 1624215
3 more bugs from the SPEC codes and from richards_benchmark.c git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6458 91177308-0d34-0410-b5e6-96231b3b80d8 Vikram S. Adve 17 years ago
6 changed file(s) with 524 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ;; Date: May 28, 2003.
1 ;; From: test/Programs/External/SPEC/CINT2000/175.vpr.llvm.bc
2 ;; Function: int %main(int %argc.1, sbyte** %argv.1)
3 ;;
4 ;; Error: A function call with about 56 arguments causes an assertion failure
5 ;; in llc because the register allocator cannot find a register
6 ;; not used explicitly by the call instruction.
7 ;;
8 ;; Cause: Regalloc was not keeping track of free registers correctly.
9 ;; It was counting the registers allocated to all outgoing arguments,
10 ;; even though most of those are copied to the stack (so those
11 ;; registers are not actually used by the call instruction).
12 ;;
13 ;; Fixed: By rewriting selection and allocation so that selection explicitly
14 ;; inserts all copy operations required for passing arguments and
15 ;; for the return value of a call, copying to/from registers
16 ;; and/or to stack locations as needed.
17 ;;
18
19 target endian = little
20 target pointersize = 32
21 %struct..s_annealing_sched = type { uint, float, float, float, float }
22 %struct..s_chan = type { uint, float, float, float, float }
23 %struct..s_det_routing_arch = type { uint, float, float, float, uint, int, short, short, short, float, float }
24 %struct..s_placer_opts = type { int, float, int, uint, sbyte*, uint, int }
25 %struct..s_router_opts = type { float, float, float, float, float, int, int, uint, int }
26 %struct..s_segment_inf = type { float, int, short, short, float, float, uint, float, float }
27 %struct..s_switch_inf = type { uint, float, float, float, float }
28
29 implementation
30
31 int %main(int %argc.1, sbyte** %argv.1) {
32 entry:
33 %net_file = alloca [300 x sbyte]
34 %place_file = alloca [300 x sbyte]
35 %arch_file = alloca [300 x sbyte]
36 %route_file = alloca [300 x sbyte]
37 %full_stats = alloca uint
38 %operation = alloca int
39 %verify_binary_search = alloca uint
40 %show_graphics = alloca uint
41 %annealing_sched = alloca %struct..s_annealing_sched
42 %placer_opts = alloca %struct..s_placer_opts
43 %router_opts = alloca %struct..s_router_opts
44 %det_routing_arch = alloca %struct..s_det_routing_arch
45 %segment_inf = alloca %struct..s_segment_inf*
46 %timing_inf = alloca { uint, float, float, float, float, float, float, float, float, float, float }
47 %tmp.101 = getelementptr %struct..s_placer_opts* %placer_opts, long 0, ubyte 4
48 %tmp.105 = getelementptr [300 x sbyte]* %net_file, long 0, long 0
49 %tmp.106 = getelementptr [300 x sbyte]* %arch_file, long 0, long 0
50 %tmp.107 = getelementptr [300 x sbyte]* %place_file, long 0, long 0
51 %tmp.108 = getelementptr [300 x sbyte]* %route_file, long 0, long 0
52 %tmp.109 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 0
53 %tmp.112 = getelementptr %struct..s_placer_opts* %placer_opts, long 0, ubyte 0
54 %tmp.114 = getelementptr %struct..s_placer_opts* %placer_opts, long 0, ubyte 6
55 %tmp.118 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 7
56 %tmp.135 = load int* %operation
57 %tmp.137 = load int* %tmp.112
58 %tmp.138 = getelementptr %struct..s_placer_opts* %placer_opts, long 0, ubyte 1
59 %tmp.139 = load float* %tmp.138
60 %tmp.140 = getelementptr %struct..s_placer_opts* %placer_opts, long 0, ubyte 2
61 %tmp.141 = load int* %tmp.140
62 %tmp.142 = getelementptr %struct..s_placer_opts* %placer_opts, long 0, ubyte 3
63 %tmp.143 = load uint* %tmp.142
64 %tmp.145 = load sbyte** %tmp.101
65 %tmp.146 = getelementptr %struct..s_placer_opts* %placer_opts, long 0, ubyte 5
66 %tmp.147 = load uint* %tmp.146
67 %tmp.149 = load int* %tmp.114
68 %tmp.154 = load uint* %full_stats
69 %tmp.155 = load uint* %verify_binary_search
70 %tmp.156 = getelementptr %struct..s_annealing_sched* %annealing_sched, long 0, ubyte 0
71 %tmp.157 = load uint* %tmp.156
72 %tmp.158 = getelementptr %struct..s_annealing_sched* %annealing_sched, long 0, ubyte 1
73 %tmp.159 = load float* %tmp.158
74 %tmp.160 = getelementptr %struct..s_annealing_sched* %annealing_sched, long 0, ubyte 2
75 %tmp.161 = load float* %tmp.160
76 %tmp.162 = getelementptr %struct..s_annealing_sched* %annealing_sched, long 0, ubyte 3
77 %tmp.163 = load float* %tmp.162
78 %tmp.164 = getelementptr %struct..s_annealing_sched* %annealing_sched, long 0, ubyte 4
79 %tmp.165 = load float* %tmp.164
80 %tmp.166 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 0
81 %tmp.167 = load float* %tmp.166
82 %tmp.168 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 1
83 %tmp.169 = load float* %tmp.168
84 %tmp.170 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 2
85 %tmp.171 = load float* %tmp.170
86 %tmp.172 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 3
87 %tmp.173 = load float* %tmp.172
88 %tmp.174 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 4
89 %tmp.175 = load float* %tmp.174
90 %tmp.176 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 5
91 %tmp.177 = load int* %tmp.176
92 %tmp.178 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 6
93 %tmp.179 = load int* %tmp.178
94 %tmp.181 = load uint* %tmp.118
95 %tmp.182 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 8
96 %tmp.183 = load int* %tmp.182
97 %tmp.184 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 0
98 %tmp.185 = load uint* %tmp.184
99 %tmp.186 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 1
100 %tmp.187 = load float* %tmp.186
101 %tmp.188 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 2
102 %tmp.189 = load float* %tmp.188
103 %tmp.190 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 3
104 %tmp.191 = load float* %tmp.190
105 %tmp.192 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 4
106 %tmp.193 = load uint* %tmp.192
107 %tmp.194 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 5
108 %tmp.195 = load int* %tmp.194
109 %tmp.196 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 6
110 %tmp.197 = load short* %tmp.196
111 %tmp.198 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 7
112 %tmp.199 = load short* %tmp.198
113 %tmp.200 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 8
114 %tmp.201 = load short* %tmp.200
115 %tmp.202 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 9
116 %tmp.203 = load float* %tmp.202
117 %tmp.204 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 10
118 %tmp.205 = load float* %tmp.204
119 %tmp.206 = load %struct..s_segment_inf** %segment_inf
120 %tmp.208 = load uint* %tmp.109
121 %tmp.209 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 1
122 %tmp.210 = load float* %tmp.209
123 %tmp.211 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 2
124 %tmp.212 = load float* %tmp.211
125 %tmp.213 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 3
126 %tmp.214 = load float* %tmp.213
127 %tmp.215 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 4
128 %tmp.216 = load float* %tmp.215
129 %tmp.217 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 5
130 %tmp.218 = load float* %tmp.217
131 %tmp.219 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 6
132 %tmp.220 = load float* %tmp.219
133 %tmp.221 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 7
134 %tmp.222 = load float* %tmp.221
135 %tmp.223 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 8
136 %tmp.224 = load float* %tmp.223
137 %tmp.225 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 9
138 %tmp.226 = load float* %tmp.225
139 %tmp.227 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 10
140 %tmp.228 = load float* %tmp.227
141 call void %place_and_route( int %tmp.135, int %tmp.137, float %tmp.139, int %tmp.141, uint %tmp.143, sbyte* %tmp.145, uint %tmp.147, int %tmp.149, sbyte* %tmp.107, sbyte* %tmp.105, sbyte* %tmp.106, sbyte* %tmp.108, uint %tmp.154, uint %tmp.155, uint %tmp.157, float %tmp.159, float %tmp.161, float %tmp.163, float %tmp.165, float %tmp.167, float %tmp.169, float %tmp.171, float %tmp.173, float %tmp.175, int %tmp.177, int %tmp.179, uint %tmp.181, int %tmp.183, uint %tmp.185, float %tmp.187, float %tmp.189, float %tmp.191, uint %tmp.193, int %tmp.195, short %tmp.197, short %tmp.199, short %tmp.201, float %tmp.203, float %tmp.205, %struct..s_segment_inf* %tmp.206, uint %tmp.208, float %tmp.210, float %tmp.212, float %tmp.214, float %tmp.216, float %tmp.218, float %tmp.220, float %tmp.222, float %tmp.224, float %tmp.226, float %tmp.228 )
142 %tmp.231 = load uint* %show_graphics
143 %tmp.232 = setne uint %tmp.231, 0
144 br bool %tmp.232, label %then.2, label %endif.2
145
146 then.2:
147 br label %endif.2
148
149 endif.2:
150 ret int 0
151 }
152
153 declare int %printf(sbyte*, ...)
154
155 declare void %place_and_route(int, int, float, int, uint, sbyte*, uint, int, sbyte*, sbyte*, sbyte*, sbyte*, uint, uint, uint, float, float, float, float, float, float, float, float, float, int, int, uint, int, uint, float, float, float, uint, int, short, short, short, float, float, %struct..s_segment_inf*, uint, float, float, float, float, float, float, float, float, float, float)
0 ;; Date: May 28, 2003.
1 ;; From: test/Programs/External/SPEC/CINT2000/254.gap.llvm.bc
2 ;; Function: int %OpenOutput(sbyte* %filename.1)
3 ;;
4 ;; Error: A sequence of GEPs is folded incorrectly by llc during selection
5 ;; causing an assertion about a dynamic casting error.
6 ;; This code sequence was produced (correctly) by preselection
7 ;; from a nested pair of ConstantExpr getelementptrs.
8 ;; The code below is the output of preselection.
9 ;; The original ConstantExprs are included in a comment.
10 ;;
11 ;; Cause: FoldGetElemChain() was inserting an extra leading 0 even though
12 ;; the first instruction in the sequence contributes no indices.
13 ;; The next instruction contributes a leading non-zero so another
14 ;; zero should not be added before it!
15 ;;
16
17
18 %FileType = type { int, [256 x sbyte], int, int, int, int }
19 %OutputFiles = uninitialized global [16 x %FileType]
20 %Output = internal global %FileType* null
21
22
23 implementation; Functions:
24
25 internal int %OpenOutput(sbyte* %filename.1) {
26 entry:
27 %tmp.0 = load %FileType** %Output
28 %tmp.4 = getelementptr %FileType* %tmp.0, long 1
29
30 ;;------ Original instruction in 254.gap.llvm.bc:
31 ;; %tmp.10 = seteq { int, [256 x sbyte], int, int, int, int }* %tmp.4, getelementptr ([16 x { int, [256 x sbyte], int, int, int, int }]* getelementptr ([16 x { int, [256 x sbyte], int, int, int, int }]* %OutputFiles, long 1), long 0, long 0)
32
33 ;;------ Code sequence produced by preselection phase for above instr:
34 ;; This code sequence is folded incorrectly by llc during selection
35 ;; causing an assertion about a dynamic casting error.
36 %addrOfGlobal = getelementptr [16 x %FileType]* %OutputFiles, long 0
37 %constantGEP = getelementptr [16 x %FileType]* %addrOfGlobal, long 1
38 %constantGEP = getelementptr [16 x %FileType]* %constantGEP, long 0, long 0
39 %tmp.10 = seteq %FileType* %tmp.4, %constantGEP
40 br bool %tmp.10, label %return, label %endif.0
41
42 endif.0:
43 ret int 0
44
45 return:
46 ret int 1
47 }
0 ;; Date: May 28, 2003.
1 ;; From: test/Programs/SingleSource/richards_benchmark.c
2 ;; Function: struct task *handlerfn(struct packet *pkt)
3 ;;
4 ;; Error: PreSelection puts the arguments of the Phi just before
5 ;; the Phi instead of in predecessor blocks. This later
6 ;; causes llc to produces an invalid register
7 ;; for the phi arguments.
8 ;;
9 ;; PreSelection Output:
10 ;; *** LLVM code after pre-selection for function handlerfn:
11 ;;
12 ;;
13 ;; %struct..task* %handlerfn(%struct..packet*) {
14 ;; ;
15 ;; setne %struct..packet* %0, null ; :0 [#uses=1]
16 ;; br bool %0, label %1, label %2
17 ;;
18 ;; ;
19 ;; br label %2
20 ;;
21 ;; ;
22 ;; %addrOfGlobal = getelementptr int* %v2, long 0 ; [#uses=1]
23 ;; %addrOfGlobal1 = getelementptr int* %v1, long 0 ; [#uses=1]
24 ;; phi int* [ %addrOfGlobal, %1 ], [ %addrOfGlobal1, %0 ] ; :0 [#uses=1]
25 ;; cast int* %0 to %struct..packet* ; <%struct..packet*>:1 [#uses=1]
26 ;; call void %append( %struct..packet* %0, %struct..packet* %1 )
27 ;; ret %struct..task* null
28 ;; }
29 ;; llc: ../../../include/llvm/CodeGen/MachineInstr.h:294: int MachineOperand::getAllocatedRegNum() const: Assertion `hasAllocatedReg()' failed.
30 ;;
31
32
33 target endian = little
34 target pointersize = 32
35 %struct..packet = type { %struct..packet*, int, int, int, [4 x sbyte] }
36 %struct..task = type { %struct..task*, int, int, %struct..packet*, int, %struct..task* (%struct..packet*)*, int, int }
37 %v1 = external global int
38 %v2 = external global int
39
40 implementation ; Functions:
41
42 %struct..task* %handlerfn(%struct..packet* %pkt.2) {
43 entry: ; No predecessors!
44 %tmp.1 = setne %struct..packet* %pkt.2, null
45 br bool %tmp.1, label %cond_false, label %cond_continue
46
47 cond_false: ; preds = %entry
48 br label %cond_continue
49
50 cond_continue: ; preds = %entry, %cond_false
51 %mem_tmp.0 = phi int* [ %v2, %cond_false ], [ %v1, %entry ]
52 %tmp.12 = cast int* %mem_tmp.0 to %struct..packet*
53 call void %append( %struct..packet* %pkt.2, %struct..packet* %tmp.12 )
54 ret %struct..task* null
55 }
56
57 declare void %append(%struct..packet*, %struct..packet*)
0 ;; Date: May 28, 2003.
1 ;; From: test/Programs/External/SPEC/CINT2000/175.vpr.llvm.bc
2 ;; Function: int %main(int %argc.1, sbyte** %argv.1)
3 ;;
4 ;; Error: A function call with about 56 arguments causes an assertion failure
5 ;; in llc because the register allocator cannot find a register
6 ;; not used explicitly by the call instruction.
7 ;;
8 ;; Cause: Regalloc was not keeping track of free registers correctly.
9 ;; It was counting the registers allocated to all outgoing arguments,
10 ;; even though most of those are copied to the stack (so those
11 ;; registers are not actually used by the call instruction).
12 ;;
13 ;; Fixed: By rewriting selection and allocation so that selection explicitly
14 ;; inserts all copy operations required for passing arguments and
15 ;; for the return value of a call, copying to/from registers
16 ;; and/or to stack locations as needed.
17 ;;
18
19 target endian = little
20 target pointersize = 32
21 %struct..s_annealing_sched = type { uint, float, float, float, float }
22 %struct..s_chan = type { uint, float, float, float, float }
23 %struct..s_det_routing_arch = type { uint, float, float, float, uint, int, short, short, short, float, float }
24 %struct..s_placer_opts = type { int, float, int, uint, sbyte*, uint, int }
25 %struct..s_router_opts = type { float, float, float, float, float, int, int, uint, int }
26 %struct..s_segment_inf = type { float, int, short, short, float, float, uint, float, float }
27 %struct..s_switch_inf = type { uint, float, float, float, float }
28
29 implementation
30
31 int %main(int %argc.1, sbyte** %argv.1) {
32 entry:
33 %net_file = alloca [300 x sbyte]
34 %place_file = alloca [300 x sbyte]
35 %arch_file = alloca [300 x sbyte]
36 %route_file = alloca [300 x sbyte]
37 %full_stats = alloca uint
38 %operation = alloca int
39 %verify_binary_search = alloca uint
40 %show_graphics = alloca uint
41 %annealing_sched = alloca %struct..s_annealing_sched
42 %placer_opts = alloca %struct..s_placer_opts
43 %router_opts = alloca %struct..s_router_opts
44 %det_routing_arch = alloca %struct..s_det_routing_arch
45 %segment_inf = alloca %struct..s_segment_inf*
46 %timing_inf = alloca { uint, float, float, float, float, float, float, float, float, float, float }
47 %tmp.101 = getelementptr %struct..s_placer_opts* %placer_opts, long 0, ubyte 4
48 %tmp.105 = getelementptr [300 x sbyte]* %net_file, long 0, long 0
49 %tmp.106 = getelementptr [300 x sbyte]* %arch_file, long 0, long 0
50 %tmp.107 = getelementptr [300 x sbyte]* %place_file, long 0, long 0
51 %tmp.108 = getelementptr [300 x sbyte]* %route_file, long 0, long 0
52 %tmp.109 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 0
53 %tmp.112 = getelementptr %struct..s_placer_opts* %placer_opts, long 0, ubyte 0
54 %tmp.114 = getelementptr %struct..s_placer_opts* %placer_opts, long 0, ubyte 6
55 %tmp.118 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 7
56 %tmp.135 = load int* %operation
57 %tmp.137 = load int* %tmp.112
58 %tmp.138 = getelementptr %struct..s_placer_opts* %placer_opts, long 0, ubyte 1
59 %tmp.139 = load float* %tmp.138
60 %tmp.140 = getelementptr %struct..s_placer_opts* %placer_opts, long 0, ubyte 2
61 %tmp.141 = load int* %tmp.140
62 %tmp.142 = getelementptr %struct..s_placer_opts* %placer_opts, long 0, ubyte 3
63 %tmp.143 = load uint* %tmp.142
64 %tmp.145 = load sbyte** %tmp.101
65 %tmp.146 = getelementptr %struct..s_placer_opts* %placer_opts, long 0, ubyte 5
66 %tmp.147 = load uint* %tmp.146
67 %tmp.149 = load int* %tmp.114
68 %tmp.154 = load uint* %full_stats
69 %tmp.155 = load uint* %verify_binary_search
70 %tmp.156 = getelementptr %struct..s_annealing_sched* %annealing_sched, long 0, ubyte 0
71 %tmp.157 = load uint* %tmp.156
72 %tmp.158 = getelementptr %struct..s_annealing_sched* %annealing_sched, long 0, ubyte 1
73 %tmp.159 = load float* %tmp.158
74 %tmp.160 = getelementptr %struct..s_annealing_sched* %annealing_sched, long 0, ubyte 2
75 %tmp.161 = load float* %tmp.160
76 %tmp.162 = getelementptr %struct..s_annealing_sched* %annealing_sched, long 0, ubyte 3
77 %tmp.163 = load float* %tmp.162
78 %tmp.164 = getelementptr %struct..s_annealing_sched* %annealing_sched, long 0, ubyte 4
79 %tmp.165 = load float* %tmp.164
80 %tmp.166 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 0
81 %tmp.167 = load float* %tmp.166
82 %tmp.168 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 1
83 %tmp.169 = load float* %tmp.168
84 %tmp.170 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 2
85 %tmp.171 = load float* %tmp.170
86 %tmp.172 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 3
87 %tmp.173 = load float* %tmp.172
88 %tmp.174 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 4
89 %tmp.175 = load float* %tmp.174
90 %tmp.176 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 5
91 %tmp.177 = load int* %tmp.176
92 %tmp.178 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 6
93 %tmp.179 = load int* %tmp.178
94 %tmp.181 = load uint* %tmp.118
95 %tmp.182 = getelementptr %struct..s_router_opts* %router_opts, long 0, ubyte 8
96 %tmp.183 = load int* %tmp.182
97 %tmp.184 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 0
98 %tmp.185 = load uint* %tmp.184
99 %tmp.186 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 1
100 %tmp.187 = load float* %tmp.186
101 %tmp.188 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 2
102 %tmp.189 = load float* %tmp.188
103 %tmp.190 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 3
104 %tmp.191 = load float* %tmp.190
105 %tmp.192 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 4
106 %tmp.193 = load uint* %tmp.192
107 %tmp.194 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 5
108 %tmp.195 = load int* %tmp.194
109 %tmp.196 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 6
110 %tmp.197 = load short* %tmp.196
111 %tmp.198 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 7
112 %tmp.199 = load short* %tmp.198
113 %tmp.200 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 8
114 %tmp.201 = load short* %tmp.200
115 %tmp.202 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 9
116 %tmp.203 = load float* %tmp.202
117 %tmp.204 = getelementptr %struct..s_det_routing_arch* %det_routing_arch, long 0, ubyte 10
118 %tmp.205 = load float* %tmp.204
119 %tmp.206 = load %struct..s_segment_inf** %segment_inf
120 %tmp.208 = load uint* %tmp.109
121 %tmp.209 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 1
122 %tmp.210 = load float* %tmp.209
123 %tmp.211 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 2
124 %tmp.212 = load float* %tmp.211
125 %tmp.213 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 3
126 %tmp.214 = load float* %tmp.213
127 %tmp.215 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 4
128 %tmp.216 = load float* %tmp.215
129 %tmp.217 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 5
130 %tmp.218 = load float* %tmp.217
131 %tmp.219 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 6
132 %tmp.220 = load float* %tmp.219
133 %tmp.221 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 7
134 %tmp.222 = load float* %tmp.221
135 %tmp.223 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 8
136 %tmp.224 = load float* %tmp.223
137 %tmp.225 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 9
138 %tmp.226 = load float* %tmp.225
139 %tmp.227 = getelementptr { uint, float, float, float, float, float, float, float, float, float, float }* %timing_inf, long 0, ubyte 10
140 %tmp.228 = load float* %tmp.227
141 call void %place_and_route( int %tmp.135, int %tmp.137, float %tmp.139, int %tmp.141, uint %tmp.143, sbyte* %tmp.145, uint %tmp.147, int %tmp.149, sbyte* %tmp.107, sbyte* %tmp.105, sbyte* %tmp.106, sbyte* %tmp.108, uint %tmp.154, uint %tmp.155, uint %tmp.157, float %tmp.159, float %tmp.161, float %tmp.163, float %tmp.165, float %tmp.167, float %tmp.169, float %tmp.171, float %tmp.173, float %tmp.175, int %tmp.177, int %tmp.179, uint %tmp.181, int %tmp.183, uint %tmp.185, float %tmp.187, float %tmp.189, float %tmp.191, uint %tmp.193, int %tmp.195, short %tmp.197, short %tmp.199, short %tmp.201, float %tmp.203, float %tmp.205, %struct..s_segment_inf* %tmp.206, uint %tmp.208, float %tmp.210, float %tmp.212, float %tmp.214, float %tmp.216, float %tmp.218, float %tmp.220, float %tmp.222, float %tmp.224, float %tmp.226, float %tmp.228 )
142 %tmp.231 = load uint* %show_graphics
143 %tmp.232 = setne uint %tmp.231, 0
144 br bool %tmp.232, label %then.2, label %endif.2
145
146 then.2:
147 br label %endif.2
148
149 endif.2:
150 ret int 0
151 }
152
153 declare int %printf(sbyte*, ...)
154
155 declare void %place_and_route(int, int, float, int, uint, sbyte*, uint, int, sbyte*, sbyte*, sbyte*, sbyte*, uint, uint, uint, float, float, float, float, float, float, float, float, float, int, int, uint, int, uint, float, float, float, uint, int, short, short, short, float, float, %struct..s_segment_inf*, uint, float, float, float, float, float, float, float, float, float, float)
0 ;; Date: May 28, 2003.
1 ;; From: test/Programs/External/SPEC/CINT2000/254.gap.llvm.bc
2 ;; Function: int %OpenOutput(sbyte* %filename.1)
3 ;;
4 ;; Error: A sequence of GEPs is folded incorrectly by llc during selection
5 ;; causing an assertion about a dynamic casting error.
6 ;; This code sequence was produced (correctly) by preselection
7 ;; from a nested pair of ConstantExpr getelementptrs.
8 ;; The code below is the output of preselection.
9 ;; The original ConstantExprs are included in a comment.
10 ;;
11 ;; Cause: FoldGetElemChain() was inserting an extra leading 0 even though
12 ;; the first instruction in the sequence contributes no indices.
13 ;; The next instruction contributes a leading non-zero so another
14 ;; zero should not be added before it!
15 ;;
16
17
18 %FileType = type { int, [256 x sbyte], int, int, int, int }
19 %OutputFiles = uninitialized global [16 x %FileType]
20 %Output = internal global %FileType* null
21
22
23 implementation; Functions:
24
25 internal int %OpenOutput(sbyte* %filename.1) {
26 entry:
27 %tmp.0 = load %FileType** %Output
28 %tmp.4 = getelementptr %FileType* %tmp.0, long 1
29
30 ;;------ Original instruction in 254.gap.llvm.bc:
31 ;; %tmp.10 = seteq { int, [256 x sbyte], int, int, int, int }* %tmp.4, getelementptr ([16 x { int, [256 x sbyte], int, int, int, int }]* getelementptr ([16 x { int, [256 x sbyte], int, int, int, int }]* %OutputFiles, long 1), long 0, long 0)
32
33 ;;------ Code sequence produced by preselection phase for above instr:
34 ;; This code sequence is folded incorrectly by llc during selection
35 ;; causing an assertion about a dynamic casting error.
36 %addrOfGlobal = getelementptr [16 x %FileType]* %OutputFiles, long 0
37 %constantGEP = getelementptr [16 x %FileType]* %addrOfGlobal, long 1
38 %constantGEP = getelementptr [16 x %FileType]* %constantGEP, long 0, long 0
39 %tmp.10 = seteq %FileType* %tmp.4, %constantGEP
40 br bool %tmp.10, label %return, label %endif.0
41
42 endif.0:
43 ret int 0
44
45 return:
46 ret int 1
47 }
0 ;; Date: May 28, 2003.
1 ;; From: test/Programs/SingleSource/richards_benchmark.c
2 ;; Function: struct task *handlerfn(struct packet *pkt)
3 ;;
4 ;; Error: PreSelection puts the arguments of the Phi just before
5 ;; the Phi instead of in predecessor blocks. This later
6 ;; causes llc to produces an invalid register
7 ;; for the phi arguments.
8 ;;
9 ;; PreSelection Output:
10 ;; *** LLVM code after pre-selection for function handlerfn:
11 ;;
12 ;;
13 ;; %struct..task* %handlerfn(%struct..packet*) {
14 ;; ;
15 ;; setne %struct..packet* %0, null ; :0 [#uses=1]
16 ;; br bool %0, label %1, label %2
17 ;;
18 ;; ;
19 ;; br label %2
20 ;;
21 ;; ;
22 ;; %addrOfGlobal = getelementptr int* %v2, long 0 ; [#uses=1]
23 ;; %addrOfGlobal1 = getelementptr int* %v1, long 0 ; [#uses=1]
24 ;; phi int* [ %addrOfGlobal, %1 ], [ %addrOfGlobal1, %0 ] ; :0 [#uses=1]
25 ;; cast int* %0 to %struct..packet* ; <%struct..packet*>:1 [#uses=1]
26 ;; call void %append( %struct..packet* %0, %struct..packet* %1 )
27 ;; ret %struct..task* null
28 ;; }
29 ;; llc: ../../../include/llvm/CodeGen/MachineInstr.h:294: int MachineOperand::getAllocatedRegNum() const: Assertion `hasAllocatedReg()' failed.
30 ;;
31
32
33 target endian = little
34 target pointersize = 32
35 %struct..packet = type { %struct..packet*, int, int, int, [4 x sbyte] }
36 %struct..task = type { %struct..task*, int, int, %struct..packet*, int, %struct..task* (%struct..packet*)*, int, int }
37 %v1 = external global int
38 %v2 = external global int
39
40 implementation ; Functions:
41
42 %struct..task* %handlerfn(%struct..packet* %pkt.2) {
43 entry: ; No predecessors!
44 %tmp.1 = setne %struct..packet* %pkt.2, null
45 br bool %tmp.1, label %cond_false, label %cond_continue
46
47 cond_false: ; preds = %entry
48 br label %cond_continue
49
50 cond_continue: ; preds = %entry, %cond_false
51 %mem_tmp.0 = phi int* [ %v2, %cond_false ], [ %v1, %entry ]
52 %tmp.12 = cast int* %mem_tmp.0 to %struct..packet*
53 call void %append( %struct..packet* %pkt.2, %struct..packet* %tmp.12 )
54 ret %struct..task* null
55 }
56
57 declare void %append(%struct..packet*, %struct..packet*)