[Bug ipa/88936] [7/8/9 Regression] -fipa-pta breaks bash (incorrect optimisation of recursive static function)

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 21 10:35:00 GMT 2019


--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, so the issue is that the clobber of rD.1909 makes *v_8(D) = 0 dead
because IPA points-to uses the callers r UID in the points-to set on
the receiving side as well.

bug (long intD.8 depthD.1905, long intD.8 * vD.1906)
  # RANGE [-9223372036854775808, 9223372036854775806]
  long intD.8 depth_6(D) = depthD.1905;
  # PT = null { D.1909 }
  # ALIGN = 8, MISALIGN = 0
  long intD.8 * v_8(D) = vD.1906;
  long intD.8 valD.1910;
  <bb 2> [local count: 1073741824]:
  if (depth_6(D) == 0)
    goto <bb 3>; [51.12%]
    goto <bb 4>; [48.88%]

  <bb 3> [local count: 548896821]:
  *v_8(D) = 0;
  goto <bb 5>; [100.00%]
  <bb 5> [local count: 1073741824]:
  # _4 = PHI <1(3), _13(4)>
  rD.1909 ={v} {CLOBBER};
  return _4;


I don't see an easy way to mitigate this (this can also happen in arbitrary
cycles).  We have to support the case where exactly this UID needs to be
present (if a pointer to r is returned again) as well as the case of
supporting alternate instantiations of r.  One way would be to always
pass down another dummy var (but we'd need a UID for that).  There's
also the missed optimization that bug() doesn't know v does not point
to its local r in IPA-PTA (I think).

Cycles are difficult.

A simple approach might be to drop to non-IPA mode for members of a
cgraph cycle.  Do we have an utility to compute SCCs of the callgraph?

More information about the Gcc-bugs mailing list