[Bug tree-optimization/54634] [4.8 Regression] miscompilation with -O3 -ftree-loop-distribution

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Sep 20 12:27:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54634

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-20 12:26:53 UTC ---
We split

  <bb 89>:
  # s2_207 = PHI <0.0(88), s2_524(91)>
  # prephitmp_1456 = PHI <0(88), k.76_530(91)>
  _496 = prephitmp_1456 * -2;
  _1535 = lx_355 + _496;
  D.3330 = _1535;
  _1533 = binomial (&j, &k);
  _517 = binomial (&ma, &D.3330);
  _518 = _1533 * _517;
  _520 = _518 * 0.0;
  s2_524 = _520 + s2_207;
  D.3330 ={v} {CLOBBER};
  k.76_530 = prephitmp_1456 + 1;
  k = k.76_530;
  if (j.72_383 == prephitmp_1456)
    goto <bb 90>;
  else
    goto <bb 91>;

into bogus pieces:

  <bb 204>:
  # prephitmp_1664 = PHI <k.76_1674(205), 0(88)>
  _1665 = prephitmp_1664 * -2;
  _1666 = lx_355 + _1665;
  D.3330 = _1666;
  D.3330 ={v} {CLOBBER};
  k.76_1674 = prephitmp_1664 + 1;
  if (j.72_383 == prephitmp_1664)
    goto <bb 206>;
  else
    goto <bb 205>;

split for the store D.3330 (huh, well ...), but somehow lost the
binomial call here.

  <bb 207>:
  # prephitmp_1678 = PHI <k.76_1688(208), 0(206)>
  k.76_1688 = prephitmp_1678 + 1;
  k = k.76_1688;
  if (j.72_383 == prephitmp_1678)
    goto <bb 209>;
  else
    goto <bb 208>;

well ... likewise.

  <bb 89>:
  # s2_207 = PHI <0.0(209), s2_524(91)>
  # prephitmp_1456 = PHI <0(209), k.76_530(91)>
  _1533 = binomial (&j, &k);
  _517 = binomial (&ma, &D.3330);
  _518 = _1533 * _517;
  _520 = _518 * 0.0;
  s2_524 = _520 + s2_207;
  k.76_530 = prephitmp_1456 + 1;
  if (j.72_383 == prephitmp_1456)
    goto <bb 90>;
  else
    goto <bb 91>;

finally all the calls.  Investigating some more.

Ah, binomial () is pure.  The RDG is bogus, it does not consider
calls that merely read unknown memory.  That is because
get_references_in_stmt handles calls by returning true/false only ...
in this case it doesn't add any data references.

So it's a very old problem that bites us now.

*sigh*



More information about the Gcc-bugs mailing list