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

            Bug ID: 77930
           Summary: Compile time hog w/ -O2 -g -funroll-loops
                    -ftree-loop-if-convert-stores on 32-bit targets
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Keywords: compile-time-hog
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---
            Target: armv7a-hardfloat-linux-gnueabihf, powerpc-*-linux-gnu*

gcc for various 32-bit targets takes disproportionally large time to compile
the following reduced snippet w/ -O2 -g -funroll-loops
-ftree-loop-if-convert-stores:

int t7;

void
wm (int ch)
{
  int os = 0;
  int m7;

  for (m7 = 0; m7 < 16; ++m7)
    {
      int p1 = 1 / ch;

      if (p1 != 0)
        os = p1;
      else
        {
          t7 &= os;
          os = t7;
        }
    }
}

% time powerpc-e300c3-linux-gnu-gcc-7.0.0-alpha20161009 -O1 -g -funroll-loops
-ftree-loop-if-convert-stores -misel -c mzubcyet.c               
powerpc-e300c3-linux-gnu-gcc-7.0.0-alpha20161009 -O1 -g -funroll-loops  -mise 
46.01s user 0.04s system 88% cpu 51.776 total
% time powerpc-e300c3-linux-gnu-gcc-4.8.5 -O1 -g -funroll-loops
-ftree-loop-if-convert-stores -misel -c mzubcyet.c                              
^C
zsh: interrupt  powerpc-e300c3-linux-gnu-gcc-4.8.5 -O1 -g -funroll-loops 
-misel -c mzubcyet.
powerpc-e300c3-linux-gnu-gcc-4.8.5 -O1 -g -funroll-loops  -misel -c mzubcyet. 
0.00s user 0.00s system 0% cpu 2:47.99 total

I've been able to reproduce it w/ armv7a-hardfloat-linux-gnueabihf,
powerpc-e300c3-linux-gnu, powerpc-e500v2-linux-gnuspe from the current trunk
all the way back to 4.8.5 (I don't have versions prior to 4.8). Note that
-misel seems to be also necessary for powerpc.

Reply via email to