public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/60770] New: disappearing clobbers
Date: Sat, 05 Apr 2014 22:31:00 -0000	[thread overview]
Message-ID: <bug-60770-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 60770
           Summary: disappearing clobbers
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glisse at gcc dot gnu.org

Hello,

looking at Manuel's testcase from PR 60517, I notice that EINLINE changes:

  D.2253 = A::getB (&a);

to:

  D.2264 = a.b;
  D.2263 = D.2264;
  D.2253 = D.2263;

(several copies, but only the original D.2253 has a clobber)
and ESRA changes:

  D.2253 = D.2263;
  D.2253 ={v} {CLOBBER};
  _5 = MEM[(double *)&D.2253];

to:

  D.2253 = D.2263;
  SR.1_3 = MEM[(struct B *)&D.2263];
  D.2253 ={v} {CLOBBER};
  _5 = SR.1_3;

The clobber then disappears in release_ssa.

It is correct, but not so helpful, because it hides the fact that we are
reading from dead memory. If I disable ESRA, the clobber and the memory read
are still present in the right order in the .optimized dump at -O3.

Would it be possible to keep the memory read after the clobber, without
affecting performance?


class B {
public:
    double x[2];
};
class A {
    B b;
public:
    B getB(void) { return b; }
};

double foo(A a) {
    double * x = &(a.getB().x[0]);
    return x[0];
}


             reply	other threads:[~2014-04-05 22:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-05 22:31 glisse at gcc dot gnu.org [this message]
2014-04-06  8:55 ` [Bug tree-optimization/60770] " manu at gcc dot gnu.org
2014-04-07 10:18 ` rguenth at gcc dot gnu.org
2014-04-07 11:31 ` glisse at gcc dot gnu.org
2014-06-22 21:07 ` glisse at gcc dot gnu.org
2014-06-27  6:53 ` glisse at gcc dot gnu.org
2014-06-28  7:26 ` glisse at gcc dot gnu.org
2014-06-28 11:10 ` ebotcazou at gcc dot gnu.org
2014-06-28 12:27 ` glisse at gcc dot gnu.org
2014-11-03 10:47 ` glisse at gcc dot gnu.org
2014-11-22 14:28 ` glisse at gcc dot gnu.org
2021-01-27 17:02 ` orgads at gmail dot com
2021-01-27 17:10 ` glisse at gcc dot gnu.org
2021-01-27 18:48 ` orgads at gmail dot com

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-60770-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).