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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
On GIMPLE the candidates are IVOPTs (for in-loop accesses) and SLSR (for
out-of-loop accesses).  SLSR sees

  _1 = i_5(D) >> 2;
  _2 = _1 * 16;
  _3 = p_6(D) + _2;
  _4 = i_5(D) & 3;
  _8 = _3->data[_4];

and for the same example with 5 instead of 4:

  _1 = i_5(D) / 5;
  _2 = _1 * 20;
  _3 = p_6(D) + _2;
  _4 = i_5(D) % 5;
  _8 = _3->data[_4];

I'm not sure SLSR tries to rewrite array accesses like _3->data[_4] if the
embedded multiplication can be strength reduced.  Oh, and of course this
isn't really a strength reduction opportunity.

Reply via email to