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

            Bug ID: 121459
           Summary: [13/14/15/16 Regression] switch table conversion does
                    not like inner bb that comes from non switch
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, needs-bisection
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
void foo (int, int);

__attribute__((noinline, noclone)) void
f1 (unsigned char v, int w)
{
  unsigned char i, j;
  if (!w)
  {
        j = 7;
        i = 27;
        goto lab;
  }
  switch (v)
    {
    case 170:
      j = 7;
      i = 27;
      break;
    case 171:
      i = 8;
      j = 122;
      break;
    case 172:
      i = 21;
      j = -19;
      break;
    case 173:
      i = 18;
      j = 17;
      break;
    case 174:
      i = 33;
      j = 55;
      break;
    case 175:
      i = 33;
      j = 55;
      break;
    case 176:
      i = 33;
      j = 55;
      break;
    case 177:
      i = 33;
      j = 55;
      break;
    default:
      __builtin_abort ();
    }

 lab:
  foo (i, j);
}
```

This will not be done into 2 table lookup since the values 7/27 are used from
outside of the switch.

Reply via email to