public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/60770] New: disappearing clobbers
@ 2014-04-05 22:31 glisse at gcc dot gnu.org
  2014-04-06  8:55 ` [Bug tree-optimization/60770] " manu at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-04-05 22:31 UTC (permalink / raw)
  To: gcc-bugs

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];
}


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

end of thread, other threads:[~2021-01-27 18:48 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-05 22:31 [Bug tree-optimization/60770] New: disappearing clobbers glisse at gcc dot gnu.org
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

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