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/81346] Missed constant propagation into comparison


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.

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