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/79408] New: Missed VRP optimization of integer modulo


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79408

            Bug ID: 79408
           Summary: Missed VRP optimization of integer modulo
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

While looking at PR79388, I've noticed that while VRP optimizes well integer
modulo if say first operand is [0, 133] and second operand 134, we don't do the
same if second operand is [134, 237] or [134, +INF].

Testcase:
unsigned int
foo (unsigned int x, unsigned int y)
{
  if (x > 7312)
    return 7;
  if (y <= 7312)
    return 12;
  return x % y;
}

int
bar (int x, int y)
{
  if (x > 7312 || x < 0)
    return 8;
  if (y <= 7312)
    return 13;
  return x % y;
}

int
baz (int x, int y)
{
  if (x > 7312 || x < -7312)
    return 9;
  if (y <= 7312)
    return 14;
  return x % y;
}

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