[Bug tree-optimization/98703] Failure to optimize out non-zero check after multiplication overflow check

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 18 09:36:24 GMT 2021


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amacleod at redhat dot com,
                   |                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I guess so, and even for the case where it returned false.
If it returned true, we can at least infer that both operands are non-zero (and
for operands with the same type and same as the return type's element type also
not 1, 1 * x won't overflow either, but e.g. 1 * x might overflow if stored
into unsigned and x is negative), if it returns false and say one argument is
constant, we can easily compute range of the other one.  Perhaps from range of
one operand we could also infer the range of the other operand, but perhaps
that might be too dangerous.


More information about the Gcc-bugs mailing list