public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ysrumyan at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [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.
Date: Tue, 10 Sep 2013 15:34:00 -0000	[thread overview]
Message-ID: <bug-58384-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2013-09-10 15:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-10 15:34 ysrumyan at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-58384-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).