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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> There is likely similar issues with -ftrapv -fnon-call-exceptions and
> 
>  _1 = _2 + 3;
> 
>  _3 = _1 - 3;
> 
> 
> where in general forwprop fails to properly replace an internally throwing
> stmt with its folded variant.

There is a difference though, those will reuse the last gimple statement and
end up with the "correct" landing pad. While here we don't reuse that as a
trapping comparison can't be inside a GIMPLE_COND.


> 
> With -fno-delete-dead-exceptions your testcase gives the following,
> highlighting the issue some more:
> 
>   <bb 2> :
>   _6 = a_5(D) < 1.0e+0;
> 
>   <bb 3> :
>   _13 = a_5(D) < 1.0e+0;
>   if (_13 != 0)
>     goto <bb 4>; [INV]
> 
> 
> I believe that in general the match.pd SSA def following should not follow
> to internally throwing defs.  Either in the core workers or by means of
> the valueization hook of individual passes.  Probably the former (though
> it makes such lookup a bit expensive and fragile for stmts not in the CFG).

Let me see if I can figure that out.

Reply via email to