[Bug c/66263] New: Performance regression from gcc-4.8 and up (trivial sudoku program)

2015-05-23 Thread bdeyal at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66263

Bug ID: 66263
   Summary: Performance regression from gcc-4.8 and up (trivial
sudoku program)
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bdeyal at gmail dot com
  Target Milestone: ---

Created attachment 35605
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35605&action=edit
Preprocessed source file

I ran the attached simple program with gcc-4.6, 4.7, 4.8, 4.9 and 5.1

This is a simple brute force + recursion program that finds all the solutions
for a given sudoku board. My input file had about half a million different
solutions.

System is fedora 21 with gcc 4.9.2
All other compilers were built locally.

my compilation command line was:

$(CC) -Ofast -W -Wall -DNDEBUG src/sudoku.c -o bin/sudoku


Running time results



gcc-4.6.4   0.483s
gcc-4.7.4   0.496s
gcc-4.8.4   0.749s
gcc-4.9.2   0.762s
gcc-5.1.0   0.776s


Files:
==
Attached preprocessed file to compile.

In addition here's the input file contents for solving:

- - - - - 1 - 3 -
- - 8 - - - - 7 5
- 1 - 9 - - - - -
- - 7 - - - - - 1
- - - 8 - 9 - - -
8 - - - 3 - - - -
- - - - - - - 9 -
9 2 - - - - 3 - -
- - - - - - - - -

to test you should run something like:

time ./sudoku --quiet < input_file.txt

where ./sudoku is the produced executable and input_file.txt is the sudoku
board from above.



Detailed compiler version and configure options:


$ gcc-4.6 -v
Using built-in specs.
COLLECT_GCC=gcc-4.6
COLLECT_LTO_WRAPPER=/opt/gcc46/libexec/gcc/x86_64-redhat-linux/4.6.4/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/gcc46 --enable-bootstrap
--enable-shared --enable-threads=posix --enable-checking=release
--enable-multilib --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++
--enable-plugin --enable-initfini-array --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.6.4 (GCC)


$ gcc-4.7 -v
Using built-in specs.
COLLECT_GCC=gcc-4.7
COLLECT_LTO_WRAPPER=/opt/gcc-4.7.4/libexec/gcc/x86_64-redhat-linux/4.7.4/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../gcc-4.7.4/configure --prefix=/opt/gcc-4.7.4
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu
--enable-languages=c,c++,fortran --enable-plugin --enable-initfini-array
--disable-dssi --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.7.4 (GCC)


$ gcc-4.8 -v
Using built-in specs.
COLLECT_GCC=gcc-4.8
COLLECT_LTO_WRAPPER=/opt/gcc48/libexec/gcc/x86_64-redhat-linux/4.8.4/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/gcc48 --enable-bootstrap
--enable-shared --enable-threads=posix --enable-checking=release
--enable-multilib --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu
--enable-languages=c,c++,fortran,go,lto --enable-plugin --enable-initfini-array
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.4 (GCC)


$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.9.2/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --enable-multilib --with-system-zlib
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu
--enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --enable-plugin
--enable-initfini-array --disable-libgcj
--with-isl=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/isl-install
--with-cloog=/builddir/build/BUILD/gcc-4.9.2-20150212/obj-x86_64-redhat-linux/cloog-install
--enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.9.2 20150212 (Red Hat 4.9.2-6) (GCC)


$ gcc-5.0 -v
Using built-in specs.
COLLECT_GCC=gcc-5.0
COLLECT_LTO_WRAPPER=/opt/gcc5/libexec/gcc/x86_64-redhat-linux/5.1.0/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/gcc5/ --enable-bootstrap
--enable-shared --enable-threads=posix --enable-checking=release
--enable-

[Bug c/66263] Performance regression from gcc-4.8 and up (trivial sudoku program)

2015-05-23 Thread bdeyal at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66263

--- Comment #1 from EyalBD  ---
Created attachment 35606
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35606&action=edit
Input file for running


[Bug c/66263] Performance regression from gcc-4.8 and up (trivial sudoku program)

2015-05-24 Thread bdeyal at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66263

--- Comment #2 from EyalBD  ---
Created attachment 35614
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35614&action=edit
Preprocessed source file


[Bug tree-optimization/66263] [4.8/4.9/5/6 Regression] Performance regression from gcc-4.8 and up (trivial sudoku program)

2015-05-27 Thread bdeyal at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66263

--- Comment #4 from EyalBD  ---
Same results for -fwhole-program too.  gcc-4.6,4.7 around 0.5s, others 0.7-0.8s