Bug 47598

Summary: -fgraphite-identity at -O2 breaks profiledbootstrap
Product: gcc Reporter: Jack Howarth <howarth.at.gcc>
Component: middle-endAssignee: Not yet assigned to anyone <unassigned>
Status: UNCONFIRMED ---    
Severity: normal CC: spop
Priority: P3    
Version: 4.6.0   
Target Milestone: ---   
Host: x86_64-apple-darwin10 Target: x86_64-apple-darwin10
Build: x86_64-apple-darwin10 Known to work:
Known to fail: Last reconfirmed:

Description Jack Howarth 2011-02-03 15:01:49 UTC
Enabling -fgraphite at -O2 with...

Index: gcc/opts.c
===================================================================
--- gcc/opts.c	(revision 169776)
+++ gcc/opts.c	(working copy)
@@ -459,6 +459,9 @@ static const struct default_options defa
     { OPT_LEVELS_1_PLUS, OPT_fcompare_elim, NULL, 1 },
 
     /* -O2 optimizations.  */
+#ifdef HAVE_cloog
+    { OPT_LEVELS_2_PLUS, OPT_fgraphite_identity, NULL, 1 },
+#endif
     { OPT_LEVELS_2_PLUS, OPT_finline_small_functions, NULL, 1 },
     { OPT_LEVELS_2_PLUS, OPT_findirect_inlining, NULL, 1 },
     { OPT_LEVELS_2_PLUS, OPT_fpartial_inlining, NULL, 1 },

breaks the profiledbootstrap at...

/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/./prev-gcc/xgcc -B/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/./prev-gcc/ -B/sw/lib/gcc4.6/x86_64-apple-darwin10.7.0/bin/ -B/sw/lib/gcc4.6/x86_64-apple-darwin10.7.0/bin/ -B/sw/lib/gcc4.6/x86_64-apple-darwin10.7.0/lib/ -isystem /sw/lib/gcc4.6/x86_64-apple-darwin10.7.0/include -isystem /sw/lib/gcc4.6/x86_64-apple-darwin10.7.0/sys-include    -c -DHAVE_CONFIG_H -g -O2 -mdynamic-no-pic -flto=jobserver -frandom-seed=1 -fprofile-use  -I. -I../../gcc-4.6-20110202/libiberty/../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic  ../../gcc-4.6-20110202/libiberty/cp-demangle.c -o cp-demangle.o
../../gcc-4.6-20110202/libiberty/cp-demangle.c: In function 'd_print_comp':
../../gcc-4.6-20110202/libiberty/cp-demangle.c:4350:1: error: insn does not satisfy its constraints:
(insn 1855 310 311 39 (parallel [
            (set (reg/f:DI 4 si [orig:719 dpi_17(D)->modifiers ] [719])
                (plus:DI (reg:DI 4 si [486])
                    (plus:DI (reg/f:DI 7 sp)
                        (const_int 0 [0]))))
            (clobber (reg:CC 17 flags))
        ]) ../../gcc-4.6-20110202/libiberty/cp-demangle.c:3611 253 {*adddi_1}
     (nil))
../../gcc-4.6-20110202/libiberty/cp-demangle.c:4350:1: internal compiler error: in reload_cse_simplify_operands, at postreload.c:401
Comment 1 Jack Howarth 2011-02-03 15:05:54 UTC
../gcc-4.6-20110202/configure --prefix=/sw --prefix=/sw/lib/gcc4.6 --mandir=/sw/share/man --infodir=/sw/lib/gcc4.6/info --with-build-config=bootstrap-lto --enable-stage1-languages=c,lto --enable-languages=c,c++,fortran,lto,objc,obj-c++,java --with-gmp=/sw --with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-mpc=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --program-suffix=-fsf-4.6 --enable-checking=yes --enable-cloog-backend=isl
Comment 2 Jack Howarth 2011-02-03 15:18:14 UTC
I forgot to mention this was in...

make[3]: *** [cp-demangle.o] Error 1
make[2]: *** [all-stagefeedback-libiberty] Error 2
make[1]: *** [stagefeedback-bubble] Error 2
make: *** [profiledbootstrap] Error 2
Comment 3 Jack Howarth 2011-02-03 15:36:59 UTC
Without a lto-bootstrap, using just...

../gcc-4.6-20110202/configure --prefix=/sw --prefix=/sw/lib/gcc4.6 --mandir=/sw/share/man --infodir=/sw/lib/gcc4.6/info --enable-languages=c,c++,fortran,lto,objc,obj-c++,java --with-gmp=/sw --with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-mpc=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --program-suffix=-fsf-4.6 --enable-checking=yes --enable-cloog-backend=isl

the profiledbootstrap with -fgraphite-identity at -O2 still fails but on a different file...

/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/./prev-gcc/xgcc -B/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/./prev-gcc/ -B/sw/lib/gcc4.6/x86_64-apple-darwin10.7.0/bin/ -B/sw/lib/gcc4.6/x86_64-apple-darwin10.7.0/bin/ -B/sw/lib/gcc4.6/x86_64-apple-darwin10.7.0/lib/ -isystem /sw/lib/gcc4.6/x86_64-apple-darwin10.7.0/include -isystem /sw/lib/gcc4.6/x86_64-apple-darwin10.7.0/sys-include    -c -DHAVE_CONFIG_H -g -O2 -mdynamic-no-pic -fprofile-use  -I. -I../../gcc-4.6-20110202/libiberty/../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic  ../../gcc-4.6-20110202/libiberty/cp-demangle.c -o cp-demangle.o
../../gcc-4.6-20110202/libiberty/cp-demangle.c: In function 'd_print_comp':
../../gcc-4.6-20110202/libiberty/cp-demangle.c:4350:1: error: insn does not satisfy its constraints:
(insn 1855 310 311 39 (parallel [
            (set (reg/f:DI 4 si [orig:719 dpi_17(D)->modifiers ] [719])
                (plus:DI (reg:DI 4 si [486])
                    (plus:DI (reg/f:DI 7 sp)
                        (const_int 0 [0]))))
            (clobber (reg:CC 17 flags))
        ]) ../../gcc-4.6-20110202/libiberty/cp-demangle.c:3611 253 {*adddi_1}
     (nil))
../../gcc-4.6-20110202/libiberty/cp-demangle.c:4350:1: internal compiler error: in reload_cse_simplify_operands, at postreload.c:401
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[3]: *** [cp-demangle.o] Error 1
make[2]: *** [all-stagefeedback-libiberty] Error 2
make[1]: *** [stagefeedback-bubble] Error 2
make: *** [profiledbootstrap] Error 2
Comment 4 H.J. Lu 2011-02-03 15:52:50 UTC
(In reply to comment #0)
> Enabling -fgraphite at -O2 with...
> 
> /sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/./prev-gcc/xgcc
> -B/sw/src/fink.build/gcc46-4.6.0-1000/darwin_objdir/./prev-gcc/
> -B/sw/lib/gcc4.6/x86_64-apple-darwin10.7.0/bin/
> -B/sw/lib/gcc4.6/x86_64-apple-darwin10.7.0/bin/
> -B/sw/lib/gcc4.6/x86_64-apple-darwin10.7.0/lib/ -isystem
> /sw/lib/gcc4.6/x86_64-apple-darwin10.7.0/include -isystem
> /sw/lib/gcc4.6/x86_64-apple-darwin10.7.0/sys-include    -c -DHAVE_CONFIG_H -g
> -O2 -mdynamic-no-pic -flto=jobserver -frandom-seed=1 -fprofile-use  -I.
> -I../../gcc-4.6-20110202/libiberty/../include  -W -Wall -Wwrite-strings
> -Wc++-compat -Wstrict-prototypes -pedantic 
> ../../gcc-4.6-20110202/libiberty/cp-demangle.c -o cp-demangle.o
> ../../gcc-4.6-20110202/libiberty/cp-demangle.c: In function 'd_print_comp':
> ../../gcc-4.6-20110202/libiberty/cp-demangle.c:4350:1: error: insn does not
> satisfy its constraints:
> (insn 1855 310 311 39 (parallel [
>             (set (reg/f:DI 4 si [orig:719 dpi_17(D)->modifiers ] [719])
>                 (plus:DI (reg:DI 4 si [486])
>                     (plus:DI (reg/f:DI 7 sp)
>                         (const_int 0 [0]))))
>             (clobber (reg:CC 17 flags))
>         ]) ../../gcc-4.6-20110202/libiberty/cp-demangle.c:3611 253 {*adddi_1}
>      (nil))
> ../../gcc-4.6-20110202/libiberty/cp-demangle.c:4350:1: internal compiler error:
> in reload_cse_simplify_operands, at postreload.c:401

Can you create a standalone testcase to show this -fgraphite-identity -O2 bug?
Comment 5 Jack Howarth 2011-02-03 16:25:02 UTC
(In reply to comment #4)
> Can you create a standalone testcase to show this -fgraphite-identity -O2 bug?

I think that will be rather difficult to achieve since the bug is occurring in the -fprofile-use stage requiring the generated profiles. I can check that this can also be observed on x86_64 linux though.
Comment 6 Jack Howarth 2011-02-03 23:54:21 UTC
I see the same problem with current gcc trunk the patch to enable -fgraphite-identity at -O2 on x86_64 Fedora 10 linux using...

../gcc/configure --with-gmp=/usr --with-mpfr=/usr --with-mpc=/usr --prefix=/home/howarth/dist --enable-languages=c --enable-checking=yes --with-cloog-include=/home/howarth/dist_cloog_isl/include --with-cloog-lib=/home/howarth/dist_cloog_isl/lib --with-ppl-include=/home/howarth/dist_ppl/include --with-ppl-lib=/home/howarth/dist_ppl/lib --enable-cloog-backend=isl --disable-lto --enable-languages=c --with-demangler-in-ld
make -j 8 profiledbootstrap


/home/howarth/work/./gcc/xgcc -B/home/howarth/work/./gcc/ -B/home/howarth/dist/x86_64-unknown-linux-gnu/bin/ -B/home/howarth/dist/x86_64-unknown-linux-gnu/lib/ -isystem /home/howarth/dist/x86_64-unknown-linux-gnu/include -isystem /home/howarth/dist/x86_64-unknown-linux-gnu/sys-include    -g -O2 -m32 -O2  -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -fno-stack-protector   -I. -I. -I../../.././gcc -I../../../../gcc/libgcc -I../../../../gcc/libgcc/. -I../../../../gcc/libgcc/../gcc -I../../../../gcc/libgcc/../include -I../../../../gcc/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS  -DUSE_TLS -o _gcov_merge_add.o -MT _gcov_merge_add.o -MD -MP -MF _gcov_merge_add.dep -DL_gcov_merge_add -c ../../../../gcc/libgcc/../gcc/libgcov.c
../../../../gcc/libgcc/generic-morestack.c: In function ‘__morestack_fail’:
../../../../gcc/libgcc/generic-morestack.c:259:1: error: insn does not satisfy its constraints:
(insn 107 105 108 10 (parallel [
            (set (reg:SI 5 di [147])
                (plus:SI (reg/v:SI 5 di [orig:83 i ] [83])
                    (plus:SI (reg/f:SI 7 sp)
                        (const_int 56 [0x38]))))
            (clobber (reg:CC 17 flags))
        ]) ../../../../gcc/libgcc/generic-morestack.c:250 252 {*addsi_1}
     (expr_list:REG_EQUIV (mem/s/f/c:SI (plus:SI (reg/f:SI 7 sp)
                (const_int 40 [0x28])) [2 iov[1].iov_base+0 S4 A32])
        (nil)))
../../../../gcc/libgcc/generic-morestack.c:259:1: internal compiler error: in reload_cse_simplify_operands, at postreload.c:401
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.