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

            Bug ID: 100802
           Summary: VRP fails to fold comparison with known value orders
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fxue at os dot amperecomputing.com
  Target Milestone: ---

In the case below, it is obvious that we have value orders as i < a <= b inside
loop. So "if (i >= b)" could be optimized away, but VRP fails to do that.


int f1();
int f2();

int foo (unsigned a, unsigned b)
{
   if (a <= b)
    {
       for (unsigned i = 0; i < a; i++)
         {
            f1 ();

            if (i >= b)
              f2 ();
         }

    }

  return 0;
}

Reply via email to