This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/77664] Missed optimization: signed int >= 0 && < unsigned short
- 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: Wed, 21 Sep 2016 09:55:17 +0000
- Subject: [Bug rtl-optimization/77664] Missed optimization: signed int >= 0 && < unsigned short
- Auto-submitted: auto-generated
- References: <bug-77664-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77664
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Well, IMHO we want to do it not just when you have a >= 0 & a < x
where x is known to have the MSB (from range info) in the comparison type
clear, but also if there is && or the conditions are possibly appart, say
if (a >= 0 && d && e != 21 && f && a < b) etc.
So, I'd think that tree-ssa-reassoc.c would be a better place to optimize this.
So, init_range_entry would need to be taught to handle
GT_EXPR/GE_EXPR/LT_EXPR/LE_EXPR with non-INTEGER_CST second argument by
creating an entry with "symbolic" high and constant low, range_entry_cmp to
sort those last and then deal with it when merging ranges.