public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/58384] New: [4.9 regression] Runfail on spec2000/253.perlbmk if lto and pre-reload scheduler is used on x86 after r200133.
@ 2013-09-10 15:34 ysrumyan at gmail dot com
  2013-09-10 15:36 ` [Bug rtl-optimization/58384] " ysrumyan at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ysrumyan at gmail dot com @ 2013-09-10 15:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58384
           Summary: [4.9 regression] Runfail on spec2000/253.perlbmk if
                    lto and pre-reload scheduler is used on x86 after
                    r200133.
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ysrumyan at gmail dot com

We also assume that arm can have the same problem at given benchmark if -flto
is used to compile since pre-reload scheduler is used by default on it.

The issue can be reproduced at attached test-case extracted from 253.perlbmk
sources (function Perl_pp_entersub, file pp_hot.c).

Before r200133 forward propagation (fwprop1 for rtl) performs substitution of
stored value to subsequent load with the same base, but after this fix does
not.
Looking at assembly files for test-case we can see that
  -- before fix --

    call    realloc
    movq    (%rbx), %r8
    movq    %rax, %r9
    movq    %rax, %rcx
    movq    8(%rsp), %rdx
    movq    %rax, 24(%r8)
    movq    %rax, (%r8)
    jmp    .L4
 i.e. return value of 'realloc' is copied to %r9 and %rcx which correspondent
to pre temporaries.

  -- after fix -- (without pre-reload scheduler)

    call    realloc
    movq    (%rbx), %rcx
    movq    (%rbx), %r8
    movq    8(%rsp), %rdx
    movq    %rax, 24(%rcx)
    movq    %rax, (%rcx)
    movq    (%r8), %rcx  <--- redundant load
    movq    %rcx, %rax
    jmp    .L4

i.w. we can see redundant load from %r8.

But if we turn on pre-reload scheduler, this load will be unlegal hoisted cross
interleaved store (we got RT error on 253.perlbmk) and we can see it in
assembly:

    call    realloc
    movq    (%rbx), %r8
    movq    8(%rsp), %rdx
    movq    (%r8), %rcx  <--- non-legal code motion
    movq    %rax, 24(%r8)
    movq    %rax, (%r8)
    movq    %rcx, %rax
    jmp    .L4
To reproduce compile attached test-case with options
-Ofast -march=corei7 -fschedule-insns --param sched-pressure-algorithm=1
-fsched-pressure


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-11-05 13:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-10 15:34 [Bug rtl-optimization/58384] New: [4.9 regression] Runfail on spec2000/253.perlbmk if lto and pre-reload scheduler is used on x86 after r200133 ysrumyan at gmail dot com
2013-09-10 15:36 ` [Bug rtl-optimization/58384] " ysrumyan at gmail dot com
2013-09-11  8:04 ` rguenth at gcc dot gnu.org
2013-11-01  8:32 ` izamyatin at gmail dot com
2013-11-01  9:48 ` ysrumyan at gmail dot com
2013-11-05 13:54 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).