public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hubicka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/45791] Missed devirtualization
Date: Sun, 26 Sep 2010 06:02:00 -0000	[thread overview]
Message-ID: <20100926060200.aRbf4mATTgMIydrXRsbuCA2o0k8iF4UbjyPiECWYedk@z> (raw)
In-Reply-To: <bug-45791-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> 2010-09-25 22:17:41 UTC ---
Another testcase where we devirtualize via folding is:
// { dg-do assemble  }
// { dg-options "-g -O2" }

//  Copyright (C) 1999 Free Software Foundation, Inc.
//  Contributed by Nathan Sidwell 21 Nov 1999 <nathan@acm.org>

// This causes assember relocation errors

struct X
{
  virtual ~X () {}
};

struct Y
{
  Y (){};
};

void foo ()
{
  X *x = new X;
  x->~X ();
  Y ys[2];
}

compiled with -O2 we get
  x_3 = operator new (8);
  # DEBUG this => x_3
  x_3->_vptr.X = &_ZTV1X[2];
  # DEBUG x => x_3 
  D.2142_7 = (int (*__vtbl_ptr_type) (void)) __comp_dtor ;
  OBJ_TYPE_REF(D.2142_7;x_3->0) (x_3);
that gets folded only in ccp3. We need FRE to fold:
  x_3->_vptr.X = &_ZTV1X[2];
  # DEBUG x => x_3
  D.2141_6 = &_ZTV1X[2];
  D.2142_7 = *D.2141_6;
  OBJ_TYPE_REF(D.2142_7;x_3->0) (x_3);
into
  x_3 = operator new (8);
  # DEBUG this => x_3
  x_3->_vptr.X = &_ZTV1X[2];
  # DEBUG x => x_3
  D.2141_6 = x_3->_vptr.X;
  D.2142_7 = *D.2141_6;
  OBJ_TYPE_REF(D.2142_7;x_3->0) (x_3);


  parent reply	other threads:[~2010-09-25 22:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-25 17:28 [Bug tree-optimization/45791] New: " hubicka at gcc dot gnu.org
2010-09-25 19:50 ` [Bug tree-optimization/45791] " hubicka at gcc dot gnu.org
2010-09-26  3:33 ` hubicka at gcc dot gnu.org
2010-09-26  3:39 ` hubicka at gcc dot gnu.org
2010-09-26  6:02 ` hubicka at gcc dot gnu.org [this message]
2010-10-11 17:15 ` jamborm at gcc dot gnu.org
2010-10-11 18:40 ` jamborm at gcc dot gnu.org
2010-12-14 17:46 ` jamborm at gcc dot gnu.org
2010-12-14 23:15 ` hubicka at gcc dot gnu.org
2010-12-14 23:17 ` hubicka at gcc dot gnu.org
2010-12-14 23:35 ` jamborm at gcc dot gnu.org
2010-12-15  0:10 ` hubicka at gcc dot gnu.org
2010-12-15  0:13 ` hubicka at gcc dot gnu.org
2010-12-15 16:07 ` jamborm at gcc dot gnu.org
2014-02-24  9:44 ` matthijs at stdin dot nl
2014-09-25 20:29 ` hubicka at gcc dot gnu.org
2021-01-07 17:38 ` jamborm 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=20100926060200.aRbf4mATTgMIydrXRsbuCA2o0k8iF4UbjyPiECWYedk@z \
    --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).