public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Jambor <mjambor@suse.cz>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Richard Guenther <rguenther@suse.de>
Subject: [PATCH 1/4] Remove usesess and wrong code from ipa_analyze_virtual_call_uses
Date: Fri, 15 Apr 2011 13:06:00 -0000	[thread overview]
Message-ID: <20110415125645.222435961@virgil.suse.cz> (raw)
In-Reply-To: <20110415125619.325556455@virgil.suse.cz>

[-- Attachment #1: ipa_otr_analysis_fixup.diff --]
[-- Type: text/plain, Size: 1658 bytes --]

Hi,

ipa_analyze_virtual_call_uses contains code that was meant to deal
with situation where OBJ_TYPE_REF_OBJECT is a (number of)
COMPONENT_REFs on top of a dereferenced default definition SSA_NAME of
a parameter.

The code is useless because that never happens in the IL, if an
ancestor object of a parameter is being used for a virtual call, the
object in the expression is always an SSA_NAME which is assigned the
proper value in a previous statement.

Moreover, if it ever triggered, it might lead to wrong code because in
cases like this it is necessary also to store the offset within the
parameter into the indirect call graph edge information (like we do in
indirect inlining).

The above is done in the next patch in the series.  I've split this
part from it because I would like to commit it also to the 4.6 branch.
I have bootstrapped and tested this on x86-64-linux without any
problems.  OK for trunk and the 4.6 branch?

Thanks,

Martin


2011-04-08  Martin Jambor  <mjambor@suse.cz>

	* ipa-prop.c (ipa_analyze_virtual_call_uses): Remove handling
	of ADR_EXPRs.


Index: src/gcc/ipa-prop.c
===================================================================
--- src.orig/gcc/ipa-prop.c
+++ src/gcc/ipa-prop.c
@@ -1383,18 +1383,6 @@ ipa_analyze_virtual_call_uses (struct cg
   if (!flag_devirtualize)
     return;
 
-  if (TREE_CODE (obj) == ADDR_EXPR)
-    {
-      do
-	{
-	  obj = TREE_OPERAND (obj, 0);
-	}
-      while (TREE_CODE (obj) == COMPONENT_REF);
-      if (TREE_CODE (obj) != MEM_REF)
-	return;
-      obj = TREE_OPERAND (obj, 0);
-    }
-
   if (TREE_CODE (obj) != SSA_NAME
       || !SSA_NAME_IS_DEFAULT_DEF (obj))
     return;

  parent reply	other threads:[~2011-04-15 13:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-15 13:00 [PATCH 0/4] Devirtualization fix and improvements Martin Jambor
2011-04-15 13:00 ` [PATCH 4/4] Devirtualization based on global objects Martin Jambor
2011-04-15 15:41   ` Richard Guenther
2011-04-18 16:32     ` Martin Jambor
2011-04-15 13:00 ` [PATCH 2/4] Handle calls to ancestor objects in IPA-CP devirtualization Martin Jambor
2011-04-15 15:29   ` Richard Guenther
2011-04-18 15:57     ` Martin Jambor
2011-04-15 13:06 ` Martin Jambor [this message]
2011-04-15 15:21   ` [PATCH 1/4] Remove usesess and wrong code from ipa_analyze_virtual_call_uses Richard Guenther
2011-04-15 13:06 ` [PATCH 3/4] Simple relaxation of dynamic type change detection routine Martin Jambor
2011-04-15 15:40   ` Richard Guenther
2011-04-18 15:57     ` Martin Jambor

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=20110415125645.222435961@virgil.suse.cz \
    --to=mjambor@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /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).