This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/26270] missed vrp optimization with unsigned comparison
- From: "amodra at bigpond dot net dot au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Feb 2006 23:53:31 -0000
- Subject: [Bug tree-optimization/26270] missed vrp optimization with unsigned comparison
- References: <bug-26270-1057@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from amodra at bigpond dot net dot au 2006-02-13 23:53 -------
f1 in the following is optimized to f2
int
f1 (unsigned long offset)
{
return offset < 0x100 && offset + 4 < 0x100;
}
int
f2 (unsigned long offset)
{
return offset < 0xfc;
}
but f3 isn't seen as equivalent to f4
int
f3 (unsigned long offset)
{
unsigned long extra = 4;
return offset < 0x100 && offset + extra < 0x100;
}
int
f4 (unsigned long offset)
{
unsigned long extra = 4;
return offset < 0x100 - extra;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26270