This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/64130] vrp: handle non zero constant divided by range cannot be zero.


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

--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to kugan from comment #5)
> I think it should be in from front-end? 

?

> Tried fixing it in VRP like:

You don't seem to use ranges at all. This might be the right place to implement
the suggestion from comment #2 (though if it does not use ranges, match.pd
would be better), but for the original optimization, what you want to improve
is the computation of the range of a division. When a has range [0, 4294967295]
we compute for 2305843009213693951 / a the range [0, 2305843009213693951] which
is not optimal, the left bound should be 536870912 not 0. If the good interval
is computed, VRP will automatically fold == 0 to false without extra code. We
already get this right when a has range [1, 4294967295].


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]