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

--- Comment #15 from rguenther at suse dot de <rguenther at suse dot de> ---
On Fri, 27 Nov 2020, luoxhu at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=22326
> 
> --- Comment #14 from luoxhu at gcc dot gnu.org ---
> (In reply to luoxhu from comment #13)
> > 
> > 2)  mad2.c
> > 
> > float foo (double x, float y, float z)
> > {
> >    return ( y * fabs (x) + z ); 
> > }
> > 
> > 
> > mad2.c.098t.cunrolli:
> > 
> > foo (double x, float y, float z)
> > {
> >   double _1;
> >   double _2;
> >   double _3;
> >   double _4;
> >   double _5;
> >   float _9;
> > 
> >   <bb 2> [local count: 1073741824]:
> >   _1 = (double) y_6(D);
> >   _2 = ABS_EXPR <x_7(D)>;
> >   _3 = _1 * _2;
> >   _4 = (double) z_8(D);
> >   _5 = _3 + _4;
> >   _9 = (float) _5;
> >   return _9;
> > 
> > }
> > 
> 
> Maybe should use forward propagation here to save [_1, _2, _3 ... _9] to 
> m_vars
> and set ignore_convert status in usage_info if rhs of the expression could
> remove double conversion, for stmt which has two rhs, need intersect status
> with AND operation of rhs1 ignore_convert and rhs2 ignore_convert, also clear
> the ignore_convert status if any of it is false.  Not sure whether this works,
> also a bit more complicated then expected...

I think backprop would need a way to "materialize" necessary converts
on select arms of expressions so that double + (double)float can
continue as "unneeded" on the arm to the float?  So basically you
do a optimistic back-propagation followed by a forward propagation
step cancelling optimistic assumptions that didn't work out.

Maybe it already works that way.

Reply via email to