public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jamborm at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/57084] 483. xalancbmk run fails with -O2 -flto for i686
Date: Thu, 02 May 2013 15:46:00 -0000	[thread overview]
Message-ID: <bug-57084-4-3uFI9tNPLI@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-57084-4@http.gcc.gnu.org/bugzilla/>


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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org

--- Comment #2 from Martin Jambor <jamborm at gcc dot gnu.org> 2013-05-02 15:46:35 UTC ---
OK, after I verified and re-verified that the call target determined
by devirtualization is actually correct, I have noticed that the call
graph of the target is an inlined node.  I'm not sure what effects
exactly that has but the following (untested) patch helps while still
performing the devirtualization (and the assembly around the calls is
slightly different).

I think that the final patch will look a bit different because a) the
new code is basically copied from ipa_make_edge_direct_to_target an
thus we'd better commonize it somehow (and I'd like to discuss with
Honza at least the name of the new function) and b) I see no reason
why the constructor-based devirtualization method in PRE cannot have
the same problem and so we'll probably want to handle it there instead
(Honza said on IRC something about a patch he already had but I am not
sure what he meant).

Another interesting point is that at least in the 64 bit non-LTO
build, these polymorphic calls are devirtualized during inlining.  I'm
going to look at why we do not do it in 32 bit LTO one (so far I do
not know which one is the problem).


Index: src/gcc/ipa-prop.c
===================================================================
--- src.orig/gcc/ipa-prop.c
+++ src/gcc/ipa-prop.c
@@ -1978,6 +1978,7 @@ ipa_analyze_node (struct cgraph_node *no
 tree
 ipa_intraprocedural_devirtualization (gimple call)
 {
+  struct cgraph_node *callee;
   tree binfo, token, fndecl;
   struct ipa_jump_func jfunc;
   tree otr = gimple_call_fn (call);
@@ -1993,6 +1994,18 @@ ipa_intraprocedural_devirtualization (gi
   token = OBJ_TYPE_REF_TOKEN (otr);
   fndecl = gimple_get_virt_method_for_binfo (tree_low_cst (token, 1),
                          binfo);
+  if (!fndecl)
+    return NULL_TREE;
+
+  callee = cgraph_get_node (fndecl);
+  if (!callee || callee->global.inlined_to)
+    {
+      if (!canonicalize_constructor_val (fndecl, NULL)
+      || !TREE_PUBLIC (fndecl))
+    return NULL_TREE;
+      cgraph_get_create_real_symbol_node (fndecl);
+    }
+
   return fndecl;
 }


  parent reply	other threads:[~2013-05-02 15:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26 15:07 [Bug lto/57084] New: " izamyatin at gmail dot com
2013-04-29 16:34 ` [Bug lto/57084] " jamborm at gcc dot gnu.org
2013-05-02 15:46 ` jamborm at gcc dot gnu.org [this message]
2013-05-03 13:45 ` jamborm at gcc dot gnu.org
2013-05-07 17:56 ` jamborm at gcc dot gnu.org
2013-05-10 13:41 ` jamborm at gcc dot gnu.org
2013-10-29 14:32 ` 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=bug-57084-4-3uFI9tNPLI@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).