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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.5
   Last reconfirmed|                            |2022-10-27
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
      Known to fail|                            |8.1.0
            Summary|Switch conversion removing  |[10/11/12/13 Regression]
                   |code                        |Removing switch with
                   |                            |__builtin_unreachable
                   |                            |causes missed optimizations
      Known to work|                            |7.1.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Testcase which shows this is a regression and switch conversion just exposed
it:
void dead (unsigned n);
void foo (unsigned n);

void func (unsigned n)
{
  switch(n) {
      case 0:
    __builtin_unreachable();
      case 1:
    __builtin_unreachable();
      case 2:
    __builtin_unreachable();
      case 3:
    __builtin_unreachable();
      case 4:
    __builtin_unreachable();
      case 5:
    __builtin_unreachable();
      case 6:
    __builtin_unreachable();
      case 7:
    __builtin_unreachable();
    default:
    ;
  }
  foo (n);
  if (n < 8)
    dead (n);
}

after building the CFG we get with the above testcase:
Removing basic block 10
Removing basic block 9
Removing basic block 8
Removing basic block 7
Removing basic block 6
Removing basic block 5
Removing basic block 4
Removing basic block 3
Merging blocks 2 and 11

Reply via email to