Question on documentation about RTL PRE in gccint

Jeff Law law@redhat.com
Mon Oct 22 15:42:00 GMT 2012


On 10/22/2012 12:59 AM, Bin.Cheng wrote:
> Hi,
> Quoting from GCCINT, section "9.5 RTL passes":
> "When optimizing for size, GCSE is done using Morel-Renvoise Partial
> Redundancy Elimination, with the exception that it does not try to
> move invariants out of loops—that is left to the loop optimization
> pass. If MR PRE GCSE is done, code hoisting (aka unification) is also
> done, as well as load motion."
>
> While the pass gate function is as below:
> static bool
> gate_rtl_pre (void)
> {
>    return optimize > 0 && flag_gcse
>      && !cfun->calls_setjmp
>      && optimize_function_for_speed_p (cfun)
>      && dbg_cnt (pre);
> }
>
> It seems the PRE pass is disabled when not optimizing for speed.
> Doesn't this conflict with the documentation, which says
> Morel-Renvoise PRE will be used when optimizing for size.
I suspect both the code and the documentation need updating.

We actually use an LCM based PRE rather than MR PRE.

As you note the gating function disables PRE completely when optimizing 
for size.  In the past we had a completely different implementation of 
gcse when optimizing for size (classic GCSE) as PRE will tend to 
increase code size the optimize expression computation.

It's not immediately clear from scanning the code what, if any, gcse we 
perform when optimizing for size.

jeff



More information about the Gcc mailing list