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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
This happens with reductions in BBs as well - the "reduction" part
gets pulled into the chain:

  c.21_93 = c;
  _112 = _111 * _110;
  _95 = _92 + _112;
  c.22_114 = _95 + c.21_93;  <---
  _132 = _131 * _130;
  c.22_134 = c.22_114 + _132;
  _152 = _151 * _150;
  c.22_154 = c.22_134 + _152;
  _55 = _54 * _53;
  c.22_57 = c.22_154 + _55;
  c = c.22_57;

while before reassoc we have

  _92 = _90 * _91;
  c.21_93 = c;
  c.22_94 = _92 + c.21_93;
  _112 = _110 * _111;
  c.22_114 = c.22_94 + _112;
...

the rank of _93 is 1 while that of _112 is 655366.  This is because the
load of c doesn't have any SSA operands and thus gets rank 0 + 1.  Other
loads get sth biased by BB rank because ultimatively the array index used
depends on a loop phi.

I don't see how we can (or should) reasonably fix this in reassociation.

Instead what we want to do is re-org SLP detection to cover these cases
which requires some changes to its IL.

Reply via email to