The Early Inline Patch
[ghc.git] / testsuite / tests / perf / should_run / all.T
1 # T12791 and T5835 test that GHC uses top-level instances in places where using
2 # a locally given solution would produce worse code.
3 # See Note [Solving from instances when interacting Dicts]
4
5 test('T5835',
6      [stats_num_field('max_bytes_used',
7            [(wordsize(64), 44312, 10)]),
8        only_ways(['normal'])
9        ],
10      compile_and_run,
11      ['-O'])
12
13 test('T12791',
14      [stats_num_field('max_bytes_used',
15            [(wordsize(64), 44312, 10)]),
16        only_ways(['normal'])
17        ],
18      compile_and_run,
19      ['-O'])
20
21 # Tests that newArray/newArray_ is being optimised correctly
22
23 test('T10359',
24      [stats_num_field('bytes allocated',
25           [(wordsize(64), 499512, 5),
26            (wordsize(32), 351508, 5)]),
27       only_ways(['normal'])
28       ],
29      compile_and_run,
30      ['-O'])
31
32 # fortunately the values here are mostly independent of the wordsize,
33 # because the test allocates an unboxed array of doubles.
34 test('T3586',
35      [stats_num_field('peak_megabytes_allocated', (17, 1)),
36                                  # expected value: 17 (amd64/Linux)
37       stats_num_field('bytes allocated', (16102024, 5)),
38                         # prev:           16835544 (amd64/Linux)
39                         # 2014-07-17:     16102024 (amd64/Linux), general round of updates
40       only_ways(['normal']),
41
42       # Use `+RTS -G1` for more stable residency measurements. Note [residency].
43       # Only 64-bit as we don't have a good 32-bit test environment at the moment
44       when(wordsize(64), extra_hc_opts('+RTS -G1 -RTS'))
45       ],
46      compile_and_run,
47      ['-O'])
48
49 test('T4830',
50      [stats_num_field('bytes allocated',
51           [(wordsize(64), 98248, 4),
52            #             127000 (amd64/Linux)
53            # 2013-02-07:  99264 (amd64/Linux)
54            # 2014-01-13:  98248 (amd64/Linux) due to #8647
55            # 2015-04-03: Widen 1->4% (amd64/Windows was doing better)
56            (wordsize(32), 70646, 3)]),
57            # 2013-02-10:  69744 (x86/Windows)
58            # 2013-02-10:  71548 (x86/OSX)
59            # 2014-01-28:  Widen range 2->3
60            #                (x86/Windows - actual 69000, lower was 69233)
61       only_ways(['normal'])
62       ],
63      compile_and_run,
64      ['-O2'])
65
66 test('T3245', [when(doing_ghci(), extra_hc_opts('-fobject-code'))],
67      compile_and_run, ['-O'])
68
69 # Test that bytestring reading/writing isn't over-allocating.  We had
70 # a bug in hGetBufNonBlocking in 6.13 that triggered this.
71 #
72 test('lazy-bs-alloc',
73      [extra_files(['../../numeric/should_run/arith011.stdout']),
74       stats_num_field('peak_megabytes_allocated', (2, 1)),
75                                  # expected value: 2 (amd64/Linux)
76       stats_num_field('bytes allocated',
77           [(wordsize(64), 421792, 5),
78             #             489776 (amd64/Linux)
79             # 2013-02-07: 429744 (amd64/Linux)
80             # 2013-12-12: 425400 (amd64/Linux)
81             # 2015-04-04: Widen 1->3% (amd64/Windows was failing)
82             # 2015-08-15: 431500 (Windows not good enough. avg of Windows&Linux)
83             # 2015-12-15: 444720 (amd64/Linux, D1616)
84             # 2015-12-17: 444720 (widen 3->5%, Windows is at 462688)
85             # 2017-01-30: 421792 (amd64/Linux, strangely Type-indexed Typeable)
86            (wordsize(32), 429760, 2)]),
87             # 2013-02-10: 421296 (x86/Windows)
88             # 2013-02-10: 414180 (x86/OSX)
89             # 2014-01-22: 411500 (x86/Linux)
90             # 2014-01-28: Widen 1->2% (x86/Windows was at 425212)
91             # 2016-04-06: 429760 (x86/Linux) no idea what happened
92             # 2017-02-14: 421448 Early inline patch
93
94       only_ways(['normal']),
95       extra_run_opts('arith011.stdout'),
96       ignore_stdout,
97
98       # Use `+RTS -G1` for more stable residency measurements. Note [residency].
99       # Only 64-bit as we don't have a good 32-bit test environment at the moment
100       when(wordsize(64), extra_hc_opts('+RTS -G1 -RTS'))
101       ],
102      # use a suitably big file, without bloating the repo with a new one:
103      compile_and_run,
104      ['-O'])
105
106 test('T876',
107      [stats_num_field('bytes allocated',
108           [(platform('x86_64-unknown-mingw32'), 66928, 5),
109               # 2015-04-03: 71904 (amd64/Windows, unknown cause)
110               # 2016-11-27: 66928 (amd64/Windows, unknown cause)
111            (wordsize(64), 58128, 5),
112               # 2013-02-14: 1263712 (x86_64/Linux)
113               # 2014-02-10:   63216 (x86_64/Linux), call arity analysis
114               # 2016-11-11:   58128 (x86_64/Linux), it's not clear
115
116            (wordsize(32), 53156, 5) ]),
117               # some date:  663712  (Windows, 64-bit machine)
118               # 2014-04-04:  56820  (Windows, 64-bit machine)
119               # 2014-06-29:  53024  (x86_64/Linux)
120               # 2014-12-01:  56796  (Windows)
121               # 2015-07-11:  53156  (x86_64/Linux)
122
123       only_ways(['normal']),
124       extra_run_opts('10000')
125       ],
126      compile_and_run,
127      ['-O'])
128
129 # Get reproducible floating-point results on x86
130 if config.arch == 'i386':
131    sse2_opts = '-msse2'
132 else:
133    sse2_opts = ''
134
135 test('T4321',
136      omit_ways(['ghci']),
137      compile_and_run, ['-O ' + sse2_opts])
138
139 test('T3736', [], run_command, ['$MAKE -s --no-print-directory T3736'])
140 test('T3738',
141      [extra_clean(['T3738a.hi', 'T3738a.o']),
142       stats_num_field('peak_megabytes_allocated', (2, 0)),
143                     # expected value: 1 (amd64/Linux)
144                     # 2016-08-31:     2 (allocation area size bumped to 1MB)
145       stats_num_field('bytes allocated',
146                       [(wordsize(32), 45648, 5),
147                     # expected value: 50520 (x86/Linux)
148                        (wordsize(64), 50592, 8)]),
149                     # prev:           49400 (amd64/Linux)
150                     # 2014-07-17:     50520 (amd64/Linux) general round of updates
151                     # 2014-09-10:     50592 (amd64/Linux) post-AMP-update
152                     # 2015-04-03: Widen 5->8% (amd64/Windows was doing better)
153       only_ways(['normal'])
154       ],
155      compile_and_run,
156      ['-O'])
157
158 test('MethSharing',
159      [stats_num_field('peak_megabytes_allocated', (2, 0)),
160                     # expected value: 1 (amd64/Linux)
161                     # 2016-08-31:     2 (allocation area size bumped to 1MB)
162       stats_num_field('bytes allocated',
163                       [(wordsize(32), 360940756, 5),
164                     # expected value: 2685858140 (x86/OS X)
165                           # expected: 360940756 (x86/Linux)
166                        (wordsize(64), 480098192, 5)]),
167                           # expected:   640067672 (amd64/Linux)
168                           # 2017-01-31: 480098192 work/wrap noinline things
169       only_ways(['normal'])
170       ],
171      compile_and_run,
172      ['-O'])
173 test('T2902', [], run_command, ['$MAKE -s --no-print-directory T2902'])
174 test('T149',
175      [ # expect_broken(149),
176        # working (2 Jul 2013, x86-64/Linux)
177       extra_clean(['T149_A',    'T149_B',
178                    'T149_A.hi', 'T149_B.hi',
179                    'T149_A.o',  'T149_B.o'])],
180      run_command,
181      ['$MAKE -s --no-print-directory T149'])
182
183 test('T5113',
184      [stats_num_field('bytes allocated',
185                       [(wordsize(32), 4000000, 5),
186                        (wordsize(64), 8000000, 5)]),
187       only_ways(['normal'])
188       ],
189      compile_and_run,
190      ['-O'])
191
192
193 test('T4978',
194      [stats_num_field('bytes allocated',
195                       [(wordsize(32), 10000000, 5),
196                        (wordsize(64), 10137680, 5)]),
197                     # expected value: 10137680 (amd64/Linux)
198       only_ways(['normal'])
199       ],
200      compile_and_run,
201      ['-O2'])
202
203 test('T5205',
204      [stats_num_field('bytes allocated',
205                       [(wordsize(32), 47088, 5),
206                     # expected value: 47088 (x86/Darwin)
207
208                        (platform('x86_64-unknown-mingw32'), 52264, 5),
209                     # 2016-12-14: 52264 (Separate out Windows results)
210
211                        (wordsize(64), 56208, 5)]),
212                     # expected value: 51320 (amd64/Linux)
213                     # 2014-07-17:     52600 (amd64/Linux) general round of updates
214                     # 2015-04-03: Widen 5->7% (amd64/Windows was doing better)
215                     # 2015-08-15: 50648 (Windows too good. avg of Windows&Linux)
216                     # 2015-10-30: 56208 (D757: Emit Typeable at definition site)
217                     # 2016-12-14: Narrow 7->5% (Separate out Windows results)
218       only_ways(['normal', 'optasm'])
219       ],
220      compile_and_run,
221      [''])
222
223 test('T5549',
224      [stats_num_field('bytes allocated',
225                       [(wordsize(32), 4096606332, 5),
226                     # expected value: 3362958676 (Windows)
227                     # 2014-12-01:     4096606332 (Windows) integer-gmp2
228
229                        (wordsize(64), 5793140200, 5)]),
230                     # expected value: 6725846120 (amd64/Linux)
231                     #                 8193140752 (amd64/Linux) integer-gmp2
232                     #                 5793140200 (amd64/Linux) integer-gmp2
233       only_ways(['normal'])
234       ],
235      compile_and_run,
236      ['-O'])
237
238 test('T4474a',
239      [stats_num_field('bytes allocated',
240                       [(wordsize(32), 2405242767, 5),
241                        (wordsize(64), 4831890304, 5)]),
242                     # expected value: 4831890304 (amd64/OSX)
243       only_ways(['normal'])
244       ],
245      compile_and_run,
246      ['-O'])
247 test('T4474b',
248      [stats_num_field('bytes allocated',
249                       [(wordsize(32), 2405242767, 5),
250                        (wordsize(64), 4831890304, 5)]),
251                     # expected value: 4831890304 (amd64/OSX)
252       only_ways(['normal'])
253       ],
254      compile_and_run,
255      ['-O'])
256 test('T4474c',
257      [stats_num_field('bytes allocated',
258                       [(wordsize(32), 2405242767, 5),
259                        (wordsize(64), 4831890304, 5)]),
260                     # expected value: 4831890304 (amd64/OSX)
261       only_ways(['normal'])
262       ],
263      compile_and_run,
264      ['-O'])
265
266 test('T5237',
267      [stats_num_field('bytes allocated',
268                         [(platform('i386-unknown-mingw32'), 73280, 5),
269                          (wordsize(32), 78328, 5),
270                       # expected value: 78328 (i386/Linux)
271                          (wordsize(64), 104176, 5)]),
272                       # expected value: 110888 (amd64/Linux)
273                       # expected value: 104176 (amd64/Linux)
274      only_ways(['normal'])
275      ],
276     compile_and_run,
277     ['-O ' + sse2_opts])
278
279 test('T5536',
280      [stats_num_field('bytes allocated',
281                       [(wordsize(32), 446260520, 1),
282                                    # 1246287228 (i386/Linux)
283                                     # 446328556 (i386/Windows)
284                                     # 446192484 (i386/OSX)
285                        (wordsize(64), 892399040, 5)]),
286                    # expected value: 2492589480 (amd64/Linux)
287                    # 17/1/13:         892399040 (x86_64/Linux)
288                    #                  (new demand analyser)
289      extra_clean(['T5536.data']),
290      ignore_stdout,
291      only_ways(['normal'])
292      ],
293     compile_and_run,
294     ['-O'])
295
296 test('T7257',
297      [stats_num_field('bytes allocated',
298                       [(wordsize(32), 989850664, 10),
299                         # expected value: 1246287228 (i386/Linux)
300                         # 2016-04-06: 989850664 (i386/Linux) no idea what happened
301                        (wordsize(64), 1414893248, 5)]),
302                         # 2012-09-21: 1774893760 (amd64/Linux)
303                         # 2015-11-03: 1654893248 (amd64/Linux)
304                         # 2016-06-22: 1414893248 (amd64/Linux, sizeExpr fix)
305       stats_num_field('peak_megabytes_allocated',
306                       [(wordsize(32), 217, 5),
307                         # 2012-10-08: 217 (x86/Linux)
308                        (wordsize(64), 227, 5)]),
309                         # 2012-09-21: 227 (amd64/Linux)
310
311       only_ways(['normal'])
312      ],
313     compile_and_run, ['-O'])
314
315 test('Conversions',
316      [stats_num_field('bytes allocated',
317                       [(wordsize(32), 76768, 3),
318                         # 2012-12-18: 55316 Guessed 64-bit value / 2
319                         # 2013-02-10: 77472 (x86/OSX)
320                         # 2013-02-10: 79276 (x86/Windows)
321                         # 2014-01-13: 76768 (x86/Linux) due to #8647
322                        (wordsize(64), 107544, 5)]),
323                         # 2012-12-18: 109608 (amd64/OS X)
324                         # 2014-07-17: 107544 (amd64/Linux)
325
326       only_ways(['normal'])
327      ],
328     compile_and_run, ['-O -msse2'])
329
330 test('T7507', omit_ways(['ghci']), compile_and_run, ['-O'])
331 # For 7507, stack overflow is the bad case
332
333 test('T7436',
334      [stats_num_field('max_bytes_used',
335           [(wordsize(64), 60360, 4),
336            #             127000 (amd64/Linux)
337            # 2013-02-07:  60360 (amd64/Linux)
338            # 2015-04-03: Widen 1->4% (amd64/Windows was doing better)
339            (wordsize(32), 58434, 1)]),
340             # 2013-02-10: 58032 (x86/Windows)
341             # 2013-02-10: 58836 (x86/OSX)
342       only_ways(['normal'])
343       ],
344      compile_and_run,
345      ['-O'])
346
347 test('T7797',
348       [stats_num_field('bytes allocated',
349                       [(wordsize(32), 240044984, 5),
350                           # expected value: 2685858140 (x86/OS X)
351                           # expected: 360940756 (x86/Linux)
352                           # expected: 240044984 (x86/Windows, 64bit machine)
353                        (wordsize(64), 480050944, 5)]),
354                           # expected: 480050944 (amd64/Linux)
355       extra_clean(['T7797a.hi', 'T7797a.o']),
356       only_ways(['normal'])
357       ],
358      compile_and_run,
359      ['-O'])
360
361 test('T7954',
362       [stats_num_field('bytes allocated',
363                       [(wordsize(32), 920045264, 10),
364               # some date:  1380051408    (64-bit Windows machine)
365               # 2014-04-04:  920045264    (64-bit Windows machine)
366                        (wordsize(64), 1680051336, 10)]),
367               # 2014-02-10: 1680051336 (x86_64/Linux), call arity analysis
368       only_ways(['normal'])
369       ],
370      compile_and_run,
371      ['-O'])
372
373 test('T7850',
374      [stats_num_field('peak_megabytes_allocated',
375                       [(wordsize(32), 2, 10),
376                        (wordsize(64), 4, 10)]),
377       only_ways(['normal'])],
378      compile_and_run,
379      ['-O'])
380
381 test('T5949',
382      [stats_num_field('bytes allocated',
383                       [ (wordsize(32), 116020, 10),
384                         (wordsize(64), 201008, 10)]),
385                       # previously, it was >400000 bytes
386       only_ways(['normal'])],
387      compile_and_run,
388      ['-O'])
389
390 test('T4267',
391      [stats_num_field('bytes allocated',
392                       [ (wordsize(32), 36012, 10)
393                       # 32-bit value close to 64 bit; c.f. T7619
394                       , (wordsize(64), 40992, 10) ]),
395                       # previously, it was >170000 bytes
396                       # 2014-01-17: 130000
397                       # 2014-02-10: 40992 (x86_64/Linux), call arity analysis
398       only_ways(['normal'])],
399      compile_and_run,
400      ['-O'])
401
402 test('T7619',
403      [stats_num_field('bytes allocated',
404                       [ (wordsize(32), 36012, 10)
405                       # 32-bit close to 64-bit value; most of this very
406                       # small number is standard start-up boilerplate I think
407                       , (wordsize(64), 40992, 10) ]),
408                       # previously, it was >400000 bytes
409       only_ways(['normal'])],
410      compile_and_run,
411      ['-O'])
412
413 test('InlineArrayAlloc',
414      [stats_num_field('bytes allocated',
415                       [ (wordsize(32), 800040960, 5)
416                       , (wordsize(64), 1600040960, 5) ]),
417       only_ways(['normal'])],
418      compile_and_run,
419      ['-O2'])
420
421 test('InlineByteArrayAlloc',
422      [stats_num_field('bytes allocated',
423                       [ (wordsize(32), 1360036012, 5)
424                       , (wordsize(64), 1440040960, 5) ]),
425          # 32 and 64 bit not so different, because
426          # we are allocating *byte* arrays
427       only_ways(['normal'])],
428      compile_and_run,
429      ['-O2'])
430
431 test('InlineCloneArrayAlloc',
432      [stats_num_field('bytes allocated',
433                       [ (wordsize(32), 800041120, 5)
434                       , (wordsize(64), 1600041120, 5) ]),
435       only_ways(['normal'])],
436      compile_and_run,
437      ['-O2'])
438
439 test('T9203',
440      [stats_num_field('bytes allocated',
441                       [ (wordsize(32), 84345136 , 5)
442                       # was
443                       # 2016-04-06     84345136 (i386/Debian) not sure
444                       , (wordsize(64), 84620888, 5) ]),
445                       # was            95747304
446                       # 2019-09-10     94547280 post-AMP cleanup
447                       # 2015-10-28     95451192 emit Typeable at definition site
448                       # 2016-12-19     84620888 Join points
449       only_ways(['normal'])],
450      compile_and_run,
451      ['-O2'])
452
453 test('T9339',
454      [stats_num_field('bytes allocated',
455                       [ (wordsize(32),    40046844, 5)
456                       # is this number correct? Seems very high.
457
458                       , (platform('x86_64-unknown-mingw32'), 47088, 7)
459                       # 2017-02-19                           47088 (x64/Windows) - Unknown
460
461                       , (wordsize(64),       50728, 5) ]),
462                       # w/o fusing last: 320005080
463                       # 2014-07-22:       80050760
464                       # 2016-08-17:          50728 Join points (#12988)
465       only_ways(['normal'])],
466      compile_and_run,
467      ['-O2 -fspec-constr-keen'])
468      # For the -fspec-constr-keen see Note [Making SpecConstr keener] in SpecConstr
469
470
471 test('T8472',
472      [stats_num_field('bytes allocated',
473                       [ (wordsize(32),    50000, 80)
474                       , (wordsize(64),    51424, 80) ]),
475       only_ways(['normal'])],
476      compile_and_run,
477      ['-O2'])
478
479 test('T12996',
480      [stats_num_field('bytes allocated',
481                       [ (wordsize(64),    76776, 5) ]),
482       only_ways(['normal'])],
483      compile_and_run,
484      ['-O2'])
485
486 test('T13001',
487      [stats_num_field('bytes allocated',
488                       [ (wordsize(32),    46728, 20)
489                       , (wordsize(64),    50600, 20) ]),
490       only_ways(['normal'])],
491      compile_and_run,
492      ['-O2'])
493
494 test('T12990',
495     [stats_num_field('bytes allocated',
496                      [ (wordsize(64), 20040936, 5) ]),
497                      # 2017-01-03     34440936  w/o inlining unsaturated
498                      #                          constructor wrappers
499                      # 2017-01-03     21640904 inline wrappers
500                      # 2017-01-31     20040936 work/wrap noinline things
501      only_ways(['normal'])],
502     compile_and_run,
503     ['-O2'])
504
505 test('T13218',
506     [stats_num_field('bytes allocated',
507                      [ (wordsize(64), 82040056, 5) ]),
508                      # 8.1 with default <$  163644216
509                      # 8.1 with derived <$   82040056
510      stats_num_field('max_bytes_used',
511                      [ (wordsize(64), 359128, 10) ]),
512                      # 8.1 with default <$  64408248
513                      # 8.1 with derived <$    359128
514      only_ways(['normal'])],
515     compile_and_run,
516     ['-O'])