On Wed, Dec 18, 2019 at 1:18 AM Hongtao Liu <crazy...@gmail.com> wrote: > > On Wed, Dec 18, 2019 at 4:26 PM Segher Boessenkool > <seg...@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