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

--- Comment #8 from Andi Kleen <andi-gcc at firstfloor dot org> ---
It doesn't even try to convert the switch because of

t.c.179.ifcvt:
Can not ifcvt due to multiple exits


  if (loop->num_nodes > 2)
    {
      /* More than one loop exit is too much to handle.  */
      if (!single_exit (loop))
        {
          if (dump_file && (dump_flags & TDF_DETAILS))
            fprintf (dump_file, "Can not ifcvt due to multiple exits\n");
        }
      else

So an early exit problem.

You can see the same problem even without need for switch like

short a[100];

int foo(int n, int counter)
{
   for (int i = 0; i < n; i++)
     {
        if (a[i] == 1 || a[i] == 2)
                return 1;
     }
    return 0;
}

I don't think that should be handled on this bug.

Reply via email to