This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: Fix PR38785
On Fri, Mar 6, 2009 at 1:02 PM, Joern Rennecke <amylaar@spamcop.net> wrote:
> Quoting Daniel Berlin <dberlin@dberlin.org>:
>
>>>> BTW, I find it mildly humorous that RTL level PRE, if improved, would
>>>> do exactly what i separated out into an option as partial-partial PRE.
>>>> (because RTL level PRE is a complete PRE).
>>>
>>> I don't think that is the case.
>>
>> It's provable.
>> What is called "partial partial PRE" is simply partial availablity +
>> partial anticipation.
>> LCM, which RTL PRE uses, does this by default, there is no way to turn
>> it off or remove it from the calculations.
>> Since RTL PRE has no cost metric at all, if the scanning was improved
>> to actually work sanely, it would indeed perform exactly the
>> optimizations you are turning off here.
>
> The exponential code & cost explosion observed in the testcase in tree-ssa
> comes from copies that are inserted implicitly in the form of phi nodes.
> a = 0;
> if (cond1) a |= const1;
> if (cond2) a |= const2;
>
> gets transformed to:
>
> a_1 = phi (0, const1);
> const2_1 = phi (const2, const1|const2);
> if (cond2) a_2 = phi (a_1, const2_1);
> a_3 = phi (a_1, a_2);
>
> The lunacy of turning simple ALU operations into expensive phi nodes
> creates new anticipatable constants.
>
> Without ssa, you don't have phi nodes, so this kind of code explosion
> won't happen.
Of course it will.
It will simply insert the appropriate copy statements instead of phi nodes.