[PATCH] Fix redundant load missed by fre [tree-optimization 92980]

Andrew Pinski pinskia@gmail.com
Wed Dec 18 10:24:00 GMT 2019


On Wed, Dec 18, 2019 at 1:18 AM Hongtao Liu <crazylht@gmail.com> wrote:
>
> On Wed, Dec 18, 2019 at 4:26 PM Segher Boessenkool
> <segher@kernel.crashing.org> wrote:
> >
> > On Wed, Dec 18, 2019 at 10:37:11AM +0800, Hongtao Liu wrote:
> > > Hi:
> > >   This patch is to simplify A * C + (-D) -> (A - D/C) * C when C is a
> > > power of 2 and D mod C == 0.
> > >   bootstrap and make check is ok.
> >
> > Why would this be a good idea?  It is not reducing the number of
> > operators or similar?
> >
> It helps VN, so that fre will delete redundant load.

It is basically doing a factoring and undoing an optimization that was
done in the front-end (see pointer_int_sum in c-common.c).
But I think the optimization in the front-end should be removed.  It
dates from 1992, a time when GCC did not anything on the tree level
and there was no GCSE (PRE) and the CSE was limited.

Thanks,
Andrew Pinski


> >
> > Segher
>
>
>
> --
> BR,
> Hongtao



More information about the Gcc-patches mailing list