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

            Bug ID: 83751
           Summary: CSE erf/erfc pair
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: prathamesh3492 at gcc dot gnu.org
  Target Milestone: ---

For the following test case:

double f(double x)
{
  double g(double, double);

  double t1 = __builtin_erf (x);
  double t2 = __builtin_erfc (x);
  return g(t1, t2);
}

optimized dump shows:
  <bb 2> [local count: 1073741825]:
  t1_2 = __builtin_erf (x_1(D));
  t2_5 = __builtin_erfc (x_1(D));
  _7 = g (t1_2, t2_5); [tail call]
  return _7;

I was wondering if it'd be a good idea to add a simple dom pass to
tree-ssa-math-opts.c that would eliminate call to erfc(x) if erf(x) is present
at-least with -funsafe-math-optimizations ?

erfc(x) == 1.0 - erf(x)

Thanks,
Prathamesh

Reply via email to