public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Improvements to code hoisting
@ 2010-06-16 15:57 Maxim Kuvyrkov
  2010-06-16 15:58 ` 0001-Add-hoist_insn-debug-counter.patch Maxim Kuvyrkov
                   ` (11 more replies)
  0 siblings, 12 replies; 94+ messages in thread
From: Maxim Kuvyrkov @ 2010-06-16 15:57 UTC (permalink / raw)
  To: Jeff Law, gcc-patches

The following series of patches improves code hoisting and PRE RTL-level 
optimizations.  The two threads of the patches correspond to 
target-independent changes to gcse.c and to changes to ARM backend to 
make it emit RTL that is better suited for optimizers.

Motivating examples for this work are ARM PRs
http://gcc.gnu.org/PR42495
http://gcc.gnu.org/PR42574
With the patches applied GCC produces perfect code for these examples.

The general effect of the patches is that they allow more expressions to 
be hoisted or PRE'd, thus making the optimizations more aggressive.  The 
negative effect of this are extended live ranges and increased register 
pressure.  Luckily, IRA and reload do good job in dealing with excessive 
register pressure.

Still, while investigating size regressions I came upon a problem in 
IRA's estimation of cost of putting a pseudo to memory when optimizing 
for size.  It appears that [ARM's] rtx_cost() model overestimates cost 
of assigning a constant to memory, and, thus, makes IRA allocate a 
register for something it shouldn't have.  This results in a spill of 
another variable that didn't get a register.  I believe, this should not 
block inclusion of the patches as they still provide significant 
improvement on average.

The cumulative patch was tested on x86_64-linux-gnu (bootstrap, default 
languages) and arm-linux-gnu (no bootstrap, c and c++ only).

There's a new FAIL on x86_64-linux-gnu gfortran testsuite: an ICE in 
output_die, at dwarf2out.c:10875.  Although I didn't look in the details 
of the problem, it seems to be a latent bug uncovered by the patches.

I benchmarked an earlier version of these patches on a Cortex-A9 board 
and got 0.1-0.5% size decrease on SPEC2K at -Os for both thumb1 and 
thumb2 modes when compiled with and without -fpic.

I'm now working on getting SPEC2K speed numbers.  I will post detailed 
benchmarking results before committing the patches that aren't obvious 
improvements.  I'll appreciate if someone posts benchmark numbers for 
other architectures.

Each patch will be posted in a subthread.

Thank you,

-- 
Maxim Kuvyrkov
CodeSourcery
maxim@codesourcery.com
(650) 331-3385 x724

^ permalink raw reply	[flat|nested] 94+ messages in thread

end of thread, other threads:[~2010-07-27 21:10 UTC | newest]

Thread overview: 94+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-16 15:57 Improvements to code hoisting Maxim Kuvyrkov
2010-06-16 15:58 ` 0001-Add-hoist_insn-debug-counter.patch Maxim Kuvyrkov
2010-06-16 16:34   ` 0001-Add-hoist_insn-debug-counter.patch Jeff Law
2010-06-16 15:59 ` 0002-Allow-constant-MEMs-through-calls.patch Maxim Kuvyrkov
2010-06-16 16:52   ` 0002-Allow-constant-MEMs-through-calls.patch Jeff Law
2010-06-16 16:03 ` 0003-Improve-VBEout-computation.patch Maxim Kuvyrkov
2010-06-16 17:19   ` 0003-Improve-VBEout-computation.patch Paolo Bonzini
2010-06-16 17:23     ` 0003-Improve-VBEout-computation.patch Maxim Kuvyrkov
2010-06-16 17:32       ` 0003-Improve-VBEout-computation.patch Paolo Bonzini
2010-06-16 17:50         ` 0003-Improve-VBEout-computation.patch Maxim Kuvyrkov
2010-06-16 19:10           ` 0003-Improve-VBEout-computation.patch Paolo Bonzini
2010-06-16 19:25             ` 0003-Improve-VBEout-computation.patch Maxim Kuvyrkov
2010-06-16 19:31               ` 0003-Improve-VBEout-computation.patch Paolo Bonzini
2010-06-21 18:46                 ` 0003-Improve-VBEout-computation.patch Jeff Law
2010-06-21 18:58       ` 0003-Improve-VBEout-computation.patch Jeff Law
2010-06-21 19:00   ` 0003-Improve-VBEout-computation.patch Jeff Law
2010-06-22 12:30     ` 0003-Improve-VBEout-computation.patch Maxim Kuvyrkov
2010-06-23 19:25       ` 0003-Improve-VBEout-computation.patch Maxim Kuvyrkov
2010-06-29 19:08         ` 0003-Improve-VBEout-computation.patch Maxim Kuvyrkov
2010-06-30 17:14           ` 0003-Improve-VBEout-computation.patch Jeff Law
2010-06-16 16:20 ` 0004-Set-pseudos-only-once.patch Maxim Kuvyrkov
2010-06-21 18:22   ` 0004-Set-pseudos-only-once.patch Jeff Law
2010-06-22 12:34     ` 0004-Set-pseudos-only-once.patch Maxim Kuvyrkov
2010-06-23 22:01       ` 0004-Set-pseudos-only-once.patch Jeff Law
2010-06-16 16:20 ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-06-16 16:43   ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Steven Bosscher
2010-06-21 19:45     ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Jeff Law
2010-06-21 20:27       ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Steven Bosscher
2010-06-21 21:35         ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Jeff Law
2010-06-21 21:50           ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Steven Bosscher
2010-06-21 22:21             ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Jeff Law
2010-06-21 22:26               ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Steven Bosscher
2010-06-22 15:17                 ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Paolo Bonzini
2010-06-22 12:42           ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-06-23 19:50             ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-06-23 20:06               ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Paolo Bonzini
2010-06-23 20:30                 ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-06-23 21:23                   ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Steven Bosscher
2010-06-23 21:30                     ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-06-24 17:11               ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-06-29 19:12                 ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-06-30  1:43                   ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Steven Bosscher
2010-06-30  9:39                     ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-06-30 12:14                       ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Steven Bosscher
2010-06-30 16:41                     ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Jeff Law
2010-06-30 16:42                       ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Steven Bosscher
2010-06-30 16:48                         ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Jeff Law
2010-06-30 16:33                   ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Jeff Law
2010-06-30 18:46                 ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Jeff Law
2010-06-30 20:53                   ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-07-01 16:54                     ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Jeff Law
2010-07-02 16:08                       ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-07-07 16:56                         ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Jeff Law
2010-07-09 20:18                           ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-07-14 20:58                             ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Jeff Law
2010-07-14 21:42                               ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-07-15 16:06                                 ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Jeff Law
2010-07-15 19:22                                   ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-07-16 18:37                                     ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Jeff Law
2010-07-17 16:41                                       ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-07-19 18:08                                         ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Jeff Law
2010-07-19 18:39                                           ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-07-23  8:36                                             ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-07-27 18:41                                             ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Jeff Law
2010-07-27 19:02                                               ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-06-29 19:22       ` 0005-Search-all-dominated-blocks-for-expressions-to-hoist.patch Maxim Kuvyrkov
2010-06-16 16:23 ` 0006-GCSE-complex-constants.patch Maxim Kuvyrkov
2010-06-16 17:18   ` 0006-GCSE-complex-constants.patch Jeff Law
2010-06-23 20:39     ` 0006-GCSE-complex-constants.patch Maxim Kuvyrkov
     [not found]       ` <4C2BBEB5.4080209@codesourcery.com>
2010-07-01 17:01         ` 0006-GCSE-complex-constants.patch Jeff Law
2010-06-16 16:25 ` 0007-Add-open-ended-comments.patch Maxim Kuvyrkov
2010-06-16 17:46   ` 0007-Add-open-ended-comments.patch Jeff Law
2010-06-23 20:45     ` 0007-Add-open-ended-comments.patch Maxim Kuvyrkov
2010-06-16 16:54 ` Improvements to code hoisting Richard Guenther
2010-07-01  9:00   ` Maxim Kuvyrkov
2010-06-23 20:42 ` Update compute_transpout Maxim Kuvyrkov
2010-06-23 21:57   ` Jeff Law
2010-06-23 21:20 ` ARM improvements for GCSE Maxim Kuvyrkov
2010-06-23 21:22   ` Maxim Kuvyrkov
2010-06-24 11:24     ` Richard Earnshaw
2010-06-23 21:30   ` Fix thumb1 size cost of small constants Maxim Kuvyrkov
2010-06-24 11:28     ` Richard Earnshaw
2010-06-23 21:35   ` Wrap calculation of PIC address into a single instruction Maxim Kuvyrkov
2010-06-23 21:38     ` Andrew Pinski
2010-06-23 21:41     ` Steven Bosscher
2010-06-23 22:23       ` Maxim Kuvyrkov
2010-06-24 11:56         ` Maxim Kuvyrkov
2010-06-29 19:18           ` Maxim Kuvyrkov
2010-07-01 12:40     ` Richard Earnshaw
2010-07-17 16:52   ` Tune hoisting for ARM Maxim Kuvyrkov
2010-07-19  8:09     ` Richard Earnshaw
2010-07-01 11:05 ` 0008-Don-t-kill-generated-expressions-in-hoist_expr_reach Maxim Kuvyrkov
2010-07-01 14:26   ` 0008-Don-t-kill-generated-expressions-in-hoist_expr_reach Jeff Law
2010-07-27 21:21 ` Improvements to code hoisting Maxim Kuvyrkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).