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/26270] missed vrp optimization with unsigned comparison



------- 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


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