http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53180

             Bug #: 53180
           Summary: Revision 186378 generates incorrect code for cpu2006
                    416.gamess
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: pthau...@gcc.gnu.org
                CC: berg...@gcc.gnu.org, ber...@gcc.gnu.org
              Host: powerpc64-linux
            Target: powerpc64-linux
             Build: powerpc64-linux


Created attachment 27276
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27276
testcase

416.gamess benchmark started failing with r186378 due to segfault when running
the benchmark. I've tracked down to what appears to be bad code for register
spilling. Subroutine with bad code is attatched, compile with "gfortran -O3
-m64 -mcpu=power7 -funroll-loops -ffast-math".

Snippets from the dump files for the insns of interest:

193r.ira

r186377:

(insn 6636 6631 6639 43 (set (reg:SI 2943 [ D.2378 ])
        (plus:SI (reg:SI 2944 [ MEM[base: D.4806_3018, index: ivtmp.1254_3009,
offset: 0B] ])
            (subreg/s:SI (reg/v:DI 454 [ nx+-4 ]) 4))) hsandt.f:200 78
{*addsi3_internal1}
     (expr_list:REG_DEAD (reg:SI 2944 [ MEM[base: D.4806_3018, index:
ivtmp.1254_3009, offset: 0B] ])
        (expr_list:REG_EQUIV (mem:SI (plus:DI (reg/f:DI 4113)
                    (reg:DI 2445 [ D.4808 ])) [3 MEM[base: D.4809_3021, index:
ivtmp.1232_213, offset: 0B]+0 S4 A32])
            (nil))))
...
(insn 6637 6632 6640 43 (set (mem:SI (plus:DI (reg/f:DI 4113)
                (reg:DI 2445 [ D.4808 ])) [3 MEM[base: D.4809_3021, index:
ivtmp.1232_213, offset: 0B]+0 S4 A32])
        (reg:SI 2943 [ D.2378 ])) hsandt.f:200 377 {*movsi_internal1}
     (expr_list:REG_DEAD (reg/f:DI 4113)
        (expr_list:REG_DEAD (reg:SI 2943 [ D.2378 ])
            (nil))))


r186378:

(insn 6636 6631 6639 43 (set (reg:SI 2943 [ D.2378 ])
        (plus:SI (reg:SI 2944 [ MEM[base: D.4806_3018, index: ivtmp.1254_3009,
offset: 0B] ])
            (subreg/s:SI (reg/v:DI 454 [ nx+-4 ]) 4))) hsandt.f:200 78
{*addsi3_internal1}
     (expr_list:REG_DEAD (reg:SI 2944 [ MEM[base: D.4806_3018, index:
ivtmp.1254_3009, offset: 0B] ])
        (nil)))
...
(insn 6637 6632 6640 43 (set (mem:SI (plus:DI (reg/f:DI 4113)
                (reg:DI 2445 [ D.4808 ])) [3 MEM[base: D.4809_3021, index:
ivtmp.1232_213, offset: 0B]+0 S4 A32])
        (reg:SI 2943 [ D.2378 ])) hsandt.f:200 377 {*movsi_internal1}
     (expr_list:REG_DEAD (reg/f:DI 4113)
        (expr_list:REG_DEAD (reg:SI 2943 [ D.2378 ])
            (nil))))

Note that insn 6636 no longer contains the REG_EQUIV note in r186378. Not sure
of the significance yet, but something I noticed.



194r.reload

r186377:

changing reg in insn 6636
changing reg in insn 6637
 Register 2943 now on stack.
...
(insn 6636 6631 8007 43 (set (reg:SI 18 18)
        (plus:SI (reg:SI 18 18 [orig:2944 MEM[base: D.4806_3018, index:
ivtmp.1254_3009, offset: 0B] ] [2944])
            (reg:SI 11 11 [orig:454 nx ] [454]))) hsandt.f:200 78
{*addsi3_internal1}
     (expr_list:REG_EQUIV (mem:SI (plus:DI (reg/f:DI 19 19 [4113])
                (reg:DI 6 6 [orig:2445 D.4808 ] [2445])) [3 MEM[base:
D.4809_3021, index: ivtmp.1232_213, offset: 0B]+0 S4 A32])
        (nil)))

(insn 8007 6636 6639 43 (set (mem/c:SI (plus:DI (reg/f:DI 19 19 [4113])
                (reg:DI 6 6 [orig:2445 D.4808 ] [2445])) [3 MEM[base:
D.4809_3021, index: ivtmp.1232_213, offset: 0B]+0 S4 A32])
        (reg:SI 18 18)) hsandt.f:200 377 {*movsi_internal1}
     (nil))


r186378:

changing reg in insn 6636
changing reg in insn 6637
      Assigning 2943(freq=2) slot 13 of 524 2290
 Register 2943 now on stack.
...
(insn 6636 6631 8052 43 (set (reg:SI 18 18)
        (plus:SI (reg:SI 18 18 [orig:2944 MEM[base: D.4806_3018, index:
ivtmp.1254_3009, offset: 0B] ] [2944])
            (reg:SI 11 11 [orig:454 nx ] [454]))) hsandt.f:200 78
{*addsi3_internal1}
     (nil))

(insn 8052 6636 6639 43 (set (mem/c:SI (plus:DI (reg/f:DI 1 1)
                (const_int 17664 [0x4500])) [32 %sfp+17664 S4 A64])
        (reg:SI 18 18)) hsandt.f:200 377 {*movsi_internal1}
     (nil))

In both cases insn 6637 is deleted, but as you can see above r186378 stores to
the stack, and that value is not subsequently copied into the original target
location of insn 6637.

I can provide more information/details if needed, just don't know what to throw
in that will be useful at the moment.

Configured with: /home/pthaugen/src/gcc/temp/gcc/configure
--prefix=/home/pthaugen/install/gcc/temp --target=powerpc64-linux
--host=powerpc64-linux --build=powerpc64-linux --enable-secureplt
--enable-threads=posix --enable-shared --enable-__cxa_atexit
--with-long-double-128 --enable-decimal-float --disable-alsa --enable-checking
--with-lto --with-as=/home/pthaugen/install/binutils/binutils-2.21.1/bin/as
--with-ld=/home/pthaugen/install/binutils/binutils-2.21.1/bin/ld
--with-gmp=/home/pthaugen/install/gcc-host-libs
--with-mpfr=/home/pthaugen/install/gcc-host-libs
--with-mpc=/home/pthaugen/install/gcc-host-libs
--with-ppl=/home/pthaugen/install/gcc-host-libs
--with-cloog=/home/pthaugen/install/gcc-host-libs
--with-host-libstdcxx=-Wl,-Bstatic,-L/home/pthaugen/install/gcc-host-libs/lib,-lstdc++,-Bdynamic,-lm
--enable-languages=c,fortran,c++ --disable-bootstrap

Reply via email to