[Bug tree-optimization/95199] Remove extra variable created for memory reference in loop vectorization.

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 20 07:05:42 GMT 2020


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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Btw, there's already vinfo->ivexpr_map to aid simplifying the IL to a point
where IVOPTs can eliminate redundant IVs.  Eliminating them in the vectorizer
is more complicated because of all the code for the IV update code generation.

There's also late FRE which in theory could eliminate them (if we'd run it
in iterative mode).  But of course the idea is to eliminate dups before
or in IVOPTs because it certainly affects IVOPTs decisions.

So I think we should try to enhance IVOPTs here.  For the reduced testcase
below it already works so I believe it has sth to do with SVE
internal functions for scatter/gather?

void __GIMPLE (ssa,startwith("fix_loops"))
foo (double * a, double m, int inc_x, int inc_y)
{
  int i;
  int iy;
  int ix;
  double * b;
  long unsigned int _1;
  long unsigned int _2;
  double * _3;
  long unsigned int _4;
  long unsigned int _5;
  double * _6;

  __BB(2):
  goto __BB4;

  __BB(3):
  _1 = (long unsigned int) ix_7;
  _2 = _1 * 8ul;
  _3 = a_11(D) + _2;
  __MEM <double> (_3) = m_17(D);
  _4 = (long unsigned int) iy_8;
  _5 = _4 * 8ul;
  _6 = a_11(D) + _5;
  __MEM <double> (_6) = m_17(D);
  ix_21 = ix_7 + inc_x_20(D);
  iy_22 = iy_8 + inc_x_20(D);
  i_23 = i_9 + 1;
  goto __BB4;

  __BB(4,loop_header(1)):
  ix_7 = __PHI (__BB2: 0, __BB3: ix_21);
  iy_8 = __PHI (__BB2: 0, __BB3: iy_22);
  i_9 = __PHI (__BB2: 0, __BB3: i_23);
  if (i_9 <= 999)
    goto __BB3;
  else
    goto __BB5;

  __BB(5):
  return;

}


More information about the Gcc-bugs mailing list