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

Feng Xue <fxue at os dot amperecomputing.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxue at os dot 
amperecomputing.com

--- Comment #24 from Feng Xue <fxue at os dot amperecomputing.com> ---
If(In reply to Jakub Jelinek from comment #15)
> For
> A*B+A*C -> (B+C)*A
> the problematic cases are
> A==-1 and B > 0 and C==(max-B)+1 (i.e. when B+C overflows to min)
> or A==0 and B < 0 and C<min-B
> or A==0 and B > 0 and C>max-B
> (last two cases cover when B+C overflows)
> For
> A*B-A*C -> (B-C)*A
> the problematic cases are
> A==-1 and B > 0 and C==min+B (i.e. when B-C is min)
> or A==0 and B < -1 and C>B-min
> or A==0 and B >= 0 and C<B-max
> (last two cases cover when B-C overflows)
> Again, we perform the operation right now if A is not 0 and not -1 for
> certain.
> I guess we could handle those cases by using something like
> check_for_binary_op_overflow, except that for the case where A might be -1
> and plusminus equal to MINUS_EXPR we also need to make sure the result of
> B-C is known not to be min.

Another point: if B+-C can be folded to an existing gimple value, we might
deduce B+-C does not overflow?

Reply via email to