This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/64130] vrp: handle non zero constant divided by range cannot be zero.
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 19 Jun 2015 06:42:05 +0000
- Subject: [Bug tree-optimization/64130] vrp: handle non zero constant divided by range cannot be zero.
- Auto-submitted: auto-generated
- References: <bug-64130-4 at http dot gcc dot gnu dot org/bugzilla/>
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].