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

            Bug ID: 81540
           Summary: tree-switch-conversion leads to code bloat
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gjl at gcc dot gnu.org
  Target Milestone: ---

Created attachment 41821
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41821&action=edit
cswtch.c: C test case

The following code gets blown by tree-switch-conversion by a factor of 4:

typedef __UINT64_TYPE__ T;

T func64 (int i)
{
    T x = (T) -1;
    switch (i)
    {
        case 1: x = 2; break;
        case 2: x = 2; break;
        case 25: x = 0x12345678abcd; break;
        default: break;
    }
    return x;
}


$ avr-gcc cswtch.c -Os -c -fno-ident
$ avr-size -A cswtch.o
cswtch.o  :
section   size   addr
.text       62      0
.rodata    200      0
Total      262


$ avr-gcc cswtch.c -Os -c -fno-ident -fno-tree-switch-conversion
$ avr-size -A cswtch.o
cswtch.o  :
section   size   addr
.text     66      0
Total     66

Compiler sources are v8 trunk from around 2017-07-18

Target: avr
Configured with: ../../gcc.gnu.org/trunk/configure --target=avr --disable-nls
--prefix=/local/gnu/install/gcc-8-avr-mingw32 --host=i686-w64-mingw32
--build=x86_64-linux-gnu --enable-languages=c,c++,lto --with-gnu-as
--with-gnu-ld --disable-shared --with-dwarf2 --enable-checking=release

Reply via email to