This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Speedup CSE by 5%
On Tue, 2005-01-25 at 21:03 -0500, Kazu Hirata wrote:
> Hi Jeff,
>
> > Err, I don't think that patch is safe. See the various calls to
> > validate_change from within fold_rtx.
>
> The comment just above fold_rtx says
>
> INSN is the insn that we may be modifying. If it is 0, make a copy
> of X before modifying it. */
>
> If fold_rtx is called like fold_rtx (x, NULL_RTX), then all the
> recursive calls are of the form fold_rtx (x', NULL_RTX).
>
> If fold_rtx is called like fold_rtx (x, insn), then all the recursive
> calls are of either one of the followoing forms
>
> fold_rtx (x', insn);
>
> fold_rtx (x', NULL_RTX);
>
> In other words, as you go deeper into the recursion, the second
> argument to fold_rtx either stays nonzero or becomes zero, but it does
> not becomes nonzero if NULL_RTX is passed.
>
> Furthermore, if the second argument is 0, we make a fair amount of
> effort to copy X before modiyfing it. I don't know if we are doing a
> perfect job there, though. I haven't looked at the code that
> carefully.
I understand all that. However, if you look at the first call to
validate_change (inside an ASM_OPERANDS case) you'll see a case where
I think we can modify x without copying it first.
jeff