This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/81346] Missed constant propagation into comparison
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 14 Jul 2017 16:55:24 +0000
- Subject: [Bug tree-optimization/81346] Missed constant propagation into comparison
- Auto-submitted: auto-generated
- References: <bug-81346-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81346
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #8)
> I think always using an unsigned type for the range check would be simpler.
> If we try to check that x>=INT_MIN+2 && x<=INT_MAX-2 with -fwrapv, int is
> still not a suitable type in which to do
> x-(INT_MIN+2)<=INT_MAX-2-(INT_MIN+2), while the issue doesn't exist with an
> unsigned type.
I'm trying to preserve what we did before, it can be tweaked incrementally if
needed.
> I notice you call build_range_check in GENERIC (and new code for GIMPLE). Is
> that temporary until match.pd can optimize range checks?
As long as we keep build_range_check, which is used in multiple other places in
fold-const.c as well as the reassoc pass, using that for GENERIC looks
faster/simpler than emitting the comparison and then optimizing it.
> Do we want :s on trunc_div?
Yes, will do that.