https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68030

--- Comment #8 from amker at gcc dot gnu.org ---
(In reply to rguent...@suse.de from comment #7)
> On May 10, 2016 6:25:57 PM GMT+02:00, "amker at gcc dot gnu.org"
> <gcc-bugzi...@gcc.gnu.org> wrote:
> >https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68030
> >
> >--- Comment #6 from amker at gcc dot gnu.org ---
> >It's not only the vectorizer generating CSE sub-optimal code, pre and
> >lim also
> >do this kind of transform.
> 
> In another PR I suggested swapping LIM and PRE to cleanup after LIM.  IIRC
> that had some testsuite regressions.
> 
Not really, PRE and LIM do same transform here.  What we need is to transform
below:
  _970 = iy_186 + -2;
  _971 = _970 * 516;
  _979 = iy_186 + -1;
  _980 = _979 * 516;
  _985 = iy_186 * 516;
  _990 = iy_186 + 1;
  _991 = _990 * 516;
  _996 = iy_186 + 2;
  _997 = _996 * 516;
into:
  _x = iy_186 * 516
  _971 = _x - 516 * 2
  _980 = _x - 516
  _985 = _x
  _990 = _x + 516
  _997 = _x + 516 * 2

I remember a way to handle reassociation is to assign different ranks to
const/ssa_names, and re-associate expressions wrto to ranks.  GCC creates new
expressions time to time (for this case, it's cunroll), we may be able to do
same re-association when we are creating new expressions, thus they can be
easily handled by CSE (or something else).

Reply via email to