Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: test/NaCl/Bitcode/bcdist.ll

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/NaCl/Bitcode/bccompress.ll ('k') | test/NaCl/Bitcode/bitcast-elide.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 ; Simple test to show that we don't break distribution counts.
2
3 ; RUN: llvm-as < %s | pnacl-freeze | pnacl-bcanalyzer --order-blocks-by-id \
4 ; RUN: | FileCheck %s
5
6 @bytes7 = internal global [7 x i8] c"abcdefg"
7
8 @ptr_to_ptr = internal global i32 ptrtoint (i32* @ptr to i32)
9
10 @ptr_to_func = internal global i32 ptrtoint (void ()* @func to i32)
11
12 @compound = internal global <{ [3 x i8], i32 }> <{ [3 x i8] c"foo", i32 ptrtoint (void ()* @func to i32) }>
13
14 @ptr = internal global i32 ptrtoint ([7 x i8]* @bytes7 to i32)
15
16 @addend_ptr = internal global i32 add (i32 ptrtoint (i32* @ptr to i32), i32 1)
17
18 @addend_negative = internal global i32 add (i32 ptrtoint (i32* @ptr to i32), i32 -1)
19
20 @addend_array1 = internal global i32 add (i32 ptrtoint ([7 x i8]* @bytes7 to i32 ), i32 1)
21
22 @addend_array2 = internal global i32 add (i32 ptrtoint ([7 x i8]* @bytes7 to i32 ), i32 7)
23
24 @addend_array3 = internal global i32 add (i32 ptrtoint ([7 x i8]* @bytes7 to i32 ), i32 9)
25
26 @addend_struct1 = internal global i32 add (i32 ptrtoint (<{ [3 x i8], i32 }>* @c ompound to i32), i32 1)
27
28 @addend_struct2 = internal global i32 add (i32 ptrtoint (<{ [3 x i8], i32 }>* @c ompound to i32), i32 4)
29
30 @ptr_to_func_align = internal global i32 ptrtoint (void ()* @func to i32), align 8
31
32 @char = internal constant [1 x i8] c"0"
33
34 @short = internal constant [2 x i8] zeroinitializer
35
36 @bytes = internal global [4 x i8] c"abcd"
37
38 declare i32 @bar(i32)
39
40 define void @func() {
41 ret void
42 }
43
44 define void @AllocCastSimple() {
45 %1 = alloca i8, i32 4, align 8
46 %2 = ptrtoint i8* %1 to i32
47 %3 = bitcast [4 x i8]* @bytes to i32*
48 store i32 %2, i32* %3, align 1
49 ret void
50 }
51
52 define void @AllocCastSimpleReversed() {
53 %1 = alloca i8, i32 4, align 8
54 %2 = ptrtoint i8* %1 to i32
55 %3 = bitcast [4 x i8]* @bytes to i32*
56 store i32 %2, i32* %3, align 1
57 ret void
58 }
59
60 define void @AllocCastDelete() {
61 %1 = alloca i8, i32 4, align 8
62 %2 = alloca i8, i32 4, align 8
63 ret void
64 }
65
66 define void @AllocCastOpt() {
67 %1 = alloca i8, i32 4, align 8
68 %2 = ptrtoint i8* %1 to i32
69 %3 = bitcast [4 x i8]* @bytes to i32*
70 store i32 %2, i32* %3, align 1
71 store i32 %2, i32* %3, align 1
72 ret void
73 }
74
75 define void @AllocBitcast(i32) {
76 %2 = alloca i8, i32 4, align 8
77 %3 = add i32 %0, 1
78 %4 = ptrtoint i8* %2 to i32
79 %5 = bitcast [4 x i8]* @bytes to i32*
80 store i32 %4, i32* %5, align 1
81 ret void
82 }
83
84 define void @StoreGlobal() {
85 %1 = alloca i8, i32 4, align 8
86 %2 = ptrtoint [4 x i8]* @bytes to i32
87 %3 = bitcast i8* %1 to i32*
88 store i32 %2, i32* %3, align 1
89 ret void
90 }
91
92 define void @StoreGlobalCastsReversed() {
93 %1 = alloca i8, i32 4, align 8
94 %2 = ptrtoint [4 x i8]* @bytes to i32
95 %3 = bitcast i8* %1 to i32*
96 store i32 %2, i32* %3, align 1
97 ret void
98 }
99
100 define i32 @StoreGlobalCastPtr2Int() {
101 %1 = alloca i8, i32 4, align 8
102 %2 = ptrtoint [4 x i8]* @bytes to i32
103 %3 = bitcast i8* %1 to i32*
104 store i32 %2, i32* %3, align 1
105 ret i32 0
106 }
107
108 define void @CastAddAlloca() {
109 %1 = alloca i8, i32 4, align 8
110 %2 = add i32 1, 2
111 %3 = ptrtoint i8* %1 to i32
112 %4 = add i32 %3, 2
113 %5 = add i32 1, %3
114 %6 = add i32 %3, %3
115 ret void
116 }
117
118 define void @CastAddGlobal() {
119 %1 = add i32 1, 2
120 %2 = ptrtoint [4 x i8]* @bytes to i32
121 %3 = add i32 %2, 2
122 %4 = add i32 1, %2
123 %5 = add i32 %2, %2
124 ret void
125 }
126
127 define void @CastBinop() {
128 %1 = alloca i8, i32 4, align 8
129 %2 = ptrtoint i8* %1 to i32
130 %3 = ptrtoint [4 x i8]* @bytes to i32
131 %4 = sub i32 %2, %3
132 %5 = mul i32 %2, %3
133 %6 = udiv i32 %2, %3
134 %7 = urem i32 %2, %3
135 %8 = srem i32 %2, %3
136 %9 = shl i32 %2, %3
137 %10 = lshr i32 %2, %3
138 %11 = ashr i32 %2, %3
139 %12 = and i32 %2, %3
140 %13 = or i32 %2, %3
141 %14 = xor i32 %2, %3
142 ret void
143 }
144
145 define void @TestSavedPtrToInt() {
146 %1 = alloca i8, i32 4, align 8
147 %2 = ptrtoint i8* %1 to i32
148 %3 = add i32 %2, 0
149 %4 = call i32 @bar(i32 %2)
150 ret void
151 }
152
153 define void @CastSelect() {
154 %1 = alloca i8, i32 4, align 8
155 %2 = select i1 true, i32 1, i32 2
156 %3 = ptrtoint i8* %1 to i32
157 %4 = select i1 true, i32 %3, i32 2
158 %5 = ptrtoint [4 x i8]* @bytes to i32
159 %6 = select i1 true, i32 1, i32 %5
160 %7 = select i1 true, i32 %3, i32 %5
161 %8 = select i1 true, i32 %5, i32 %3
162 ret void
163 }
164
165 define void @PhiBackwardRefs(i1) {
166 %2 = alloca i8, i32 4, align 8
167 %3 = alloca i8, i32 4, align 8
168 br i1 %0, label %true, label %false
169
170 true: ; preds = %1
171 %4 = bitcast i8* %2 to i32*
172 %5 = load i32* %4
173 %6 = ptrtoint i8* %3 to i32
174 br label %merge
175
176 false: ; preds = %1
177 %7 = bitcast i8* %2 to i32*
178 %8 = load i32* %7
179 %9 = ptrtoint i8* %3 to i32
180 br label %merge
181
182 merge: ; preds = %false, %true
183 %10 = phi i32 [ %6, %true ], [ %9, %false ]
184 %11 = phi i32 [ %5, %true ], [ %8, %false ]
185 ret void
186 }
187
188 define void @PhiForwardRefs(i1) {
189 br label %start
190
191 merge: ; preds = %false, %true
192 %2 = phi i32 [ %11, %true ], [ %11, %false ]
193 %3 = phi i32 [ %5, %true ], [ %7, %false ]
194 ret void
195
196 true: ; preds = %start
197 %4 = inttoptr i32 %9 to i32*
198 %5 = load i32* %4
199 br label %merge
200
201 false: ; preds = %start
202 %6 = inttoptr i32 %9 to i32*
203 %7 = load i32* %6
204 br label %merge
205
206 start: ; preds = %1
207 %8 = alloca i8, i32 4, align 8
208 %9 = ptrtoint i8* %8 to i32
209 %10 = alloca i8, i32 4, align 8
210 %11 = ptrtoint i8* %10 to i32
211 br i1 %0, label %true, label %false
212 }
213
214 define void @PhiMergeCast(i1) {
215 %2 = alloca i8, i32 4, align 8
216 %3 = alloca i8, i32 4, align 8
217 br i1 %0, label %true, label %false
218
219 true: ; preds = %1
220 %4 = bitcast i8* %2 to i32*
221 %5 = load i32* %4
222 %6 = ptrtoint i8* %3 to i32
223 %7 = add i32 %5, %6
224 br label %merge
225
226 false: ; preds = %1
227 %8 = bitcast i8* %2 to i32*
228 %9 = load i32* %8
229 %10 = ptrtoint i8* %3 to i32
230 br label %merge
231
232 merge: ; preds = %false, %true
233 %11 = phi i32 [ %6, %true ], [ %10, %false ]
234 %12 = phi i32 [ %5, %true ], [ %9, %false ]
235 ret void
236 }
237
238 define void @LongReachingCasts(i1) {
239 %2 = alloca i8, i32 4, align 8
240 br i1 %0, label %Split1, label %Split2
241
242 Split1: ; preds = %1
243 br i1 %0, label %b1, label %b2
244
245 Split2: ; preds = %1
246 br i1 %0, label %b3, label %b4
247
248 b1: ; preds = %Split1
249 %3 = ptrtoint i8* %2 to i32
250 %4 = bitcast [4 x i8]* @bytes to i32*
251 store i32 %3, i32* %4, align 1
252 store i32 %3, i32* %4, align 1
253 ret void
254
255 b2: ; preds = %Split1
256 %5 = ptrtoint i8* %2 to i32
257 %6 = bitcast [4 x i8]* @bytes to i32*
258 store i32 %5, i32* %6, align 1
259 store i32 %5, i32* %6, align 1
260 ret void
261
262 b3: ; preds = %Split2
263 %7 = ptrtoint i8* %2 to i32
264 %8 = bitcast [4 x i8]* @bytes to i32*
265 store i32 %7, i32* %8, align 1
266 store i32 %7, i32* %8, align 1
267 ret void
268
269 b4: ; preds = %Split2
270 %9 = ptrtoint i8* %2 to i32
271 %10 = bitcast [4 x i8]* @bytes to i32*
272 store i32 %9, i32* %10, align 1
273 store i32 %9, i32* %10, align 1
274 ret void
275 }
276
277 define void @SwitchVariable(i32) {
278 switch i32 %0, label %l1 [
279 i32 1, label %l2
280 i32 2, label %l2
281 i32 4, label %l3
282 i32 5, label %l3
283 ]
284 ; No predecessors!
285 br label %end
286
287 l1: ; preds = %1
288 br label %end
289
290 l2: ; preds = %1, %1
291 br label %end
292
293 l3: ; preds = %1, %1
294 br label %end
295
296 end: ; preds = %l3, %l2, %l1, %2
297 ret void
298 }
299
300
301 ; CHECK: # Toplevel Blocks: 1
302
303 ; CHECK: Block Histogram (8 elements):
304
305 ; CHECK: %File Count %Count # Bits Bits/Elmt Block
306 ; CHECK-NEXT: {{.*}} 1 {{.*}} {{.*}} {{.*}} BLOCKINFO_BLOCK
307 ; CHECK-NEXT: {{.*}} 1 {{.*}} {{.*}} {{.*}} MODULE_BLOCK
308
309 ; CHECK: Subblocks (5 elements):
310
311 ; CHECK: Count %Count Subblock
312 ; CHECK-NEXT: 19 82.61 FUNCTION_BLOCK
313 ; CHECK-NEXT: 1 4.35 GLOBALVAR_BLOCK
314 ; CHECK-NEXT: 1 4.35 TYPE_BLOCK_ID
315 ; CHECK-NEXT: 1 4.35 VALUE_SYMTAB
316 ; CHECK-NEXT: 1 4.35 BLOCKINFO_BLOCK
317
318 ; CHECK: Record Histogram: (2 elements):
319
320 ; CHECK: Count %Count # Bits Bits/Elmt % Abv Record Kind
321 ; CHECK-NEXT: 20 95.24 {{.*}} {{.*}} FUNCTION
322 ; CHECK-NEXT: 1 4.76 {{.*}} {{.*}} VERSION
323
324 ; CHECK: Block Histogram (continued)
325 ; CHECK-NEXT: %File Count %Count # Bits Bits/Elmt Block
326 ; CHECK-NEXT: {{.*}} 17 {{.*}} {{.*}} {{.*}} CONSTANTS_BLOCK
327
328 ; CHECK: Record Histogram: (2 elements):
329
330 ; CHECK: Count %Count # Bits Bits/Elmt % Abv Record Kind
331 ; CHECK-NEXT: 26 59.09 {{.*}} {{.*}} {{.*}} INTEGER
332 ; CHECK-NEXT: 18 40.91 {{.*}} {{.*}} {{.*}} SETTYPE
333
334 ; CHECK: Block Histogram (continued)
335 ; CHECK-NEXT: %File Count %Count # Bits Bits/Elmt Block
336 ; CHECK-NEXT: {{.*}} 19 {{.*}} {{.*}} {{.*}} FUNCTION_BLOCK
337
338 ; CHECK: Subblocks (1 elements):
339
340 ; CHECK: Count %Count Subblock
341 ; CHECK-NEXT: 17 100.00 CONSTANTS_BLOCK
342
343 ; CHECK: Record Histogram: (12 elements):
344
345 ; CHECK: Count %Count # Bits Bits/Elmt % Abv Record Kind
346 ; CHECK-NEXT: 22 15.83 {{.*}} {{.*}} {{.*}} INST_RET
347 ; CHECK-NEXT: 22 15.83 {{.*}} {{.*}} {{.*}} INST_BINOP
348 ; CHECK-NEXT: 20 14.39 {{.*}} {{.*}} INST_ALLOCA
349 ; CHECK-NEXT: 19 13.67 {{.*}} {{.*}} DECLAREBLOCKS
350 ; CHECK-NEXT: 17 12.23 {{.*}} {{.*}} INST_BR
351 ; CHECK-NEXT: 16 11.51 {{.*}} {{.*}} {{.*}} INST_STORE
352 ; CHECK-NEXT: 6 4.32 {{.*}} {{.*}} {{.*}} INST_LOAD
353 ; CHECK-NEXT: 6 4.32 {{.*}} {{.*}} INST_PHI
354 ; CHECK-NEXT: 5 3.60 {{.*}} {{.*}} INST_VSELECT
355 ; CHECK-NEXT: 4 2.88 {{.*}} {{.*}} {{.*}} FORWARDTYPEREF
356 ; CHECK-NEXT: 1 0.72 {{.*}} {{.*}} INST_CALL
357 ; CHECK-NEXT: 1 0.72 {{.*}} {{.*}} INST_SWITCH
358
359 ; CHECK: Block Histogram (continued)
360 ; CHECK-NEXT: %File Count %Count # Bits Bits/Elmt Block
361 ; CHECK-NEXT: {{.*}} 1 {{.*}} {{.*}} {{.*}} VALUE_SYMTAB
362
363 ; CHECK: Record Histogram: (1 elements):
364
365 ; CHECK: Count %Count # Bits Bits/Elmt % Abv Record Kind
366 ; CHECK-NEXT: 36 100.00 {{.*}} {{.*}} {{.*}} ENTRY
367
368 ; CHECK: Block Histogram (continued)
369 ; CHECK-NEXT: %File Count %Count # Bits Bits/Elmt Block
370 ; CHECK-NEXT: {{.*}} 1 {{.*}} {{.*}} {{.*}} TYPE_BLOCK_ID
371
372 ; CHECK: Record Histogram: (4 elements):
373
374 ; CHECK: Count %Count # Bits Bits/Elmt % Abv Record Kind
375 ; CHECK-NEXT: 5 50.00 {{.*}} {{.*}} {{.*}} FUNCTION
376 ; CHECK-NEXT: 3 30.00 {{.*}} {{.*}} INTEGER
377 ; CHECK-NEXT: 1 10.00 {{.*}} {{.*}} VOID
378 ; CHECK-NEXT: 1 10.00 {{.*}} {{.*}} NUMENTRY
379
380 ; CHECK: Block Histogram (continued)
381 ; CHECK-NEXT: %File Count %Count # Bits Bits/Elmt Block
382 ; CHECK-NEXT: {{.*}} 1 {{.*}} {{.*}} {{.*}} GLOBALVAR_BLOCK
383
384 ; CHECK: Record Histogram: (6 elements):
385
386 ; CHECK: Count %Count # Bits Bits/Elmt % Abv Record Kind
387 ; CHECK-NEXT: 16 45.71 {{.*}} {{.*}} {{.*}} VAR
388 ; CHECK-NEXT: 12 34.29 {{.*}} {{.*}} {{.*}} RELOC
389 ; CHECK-NEXT: 4 11.43 {{.*}} {{.*}} {{.*}} DATA
390 ; CHECK-NEXT: 1 2.86 {{.*}} {{.*}} COUNT
391 ; CHECK-NEXT: 1 2.86 {{.*}} {{.*}} {{.*}} ZEROFILL
392 ; CHECK-NEXT: 1 2.86 {{.*}} {{.*}} {{.*}} COMPOUND
OLDNEW
« no previous file with comments | « test/NaCl/Bitcode/bccompress.ll ('k') | test/NaCl/Bitcode/bitcast-elide.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698