public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Jambor <mjambor@suse.cz>
To: Richard Guenther <rguenther@suse.de>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 3/4] Simple relaxation of dynamic type change detection routine
Date: Mon, 18 Apr 2011 15:57:00 -0000	[thread overview]
Message-ID: <20110418154421.GB3555@virgil.arch.suse.de> (raw)
In-Reply-To: <alpine.LNX.2.00.1104151728250.810@zhemvz.fhfr.qr>

Hi,

On Fri, Apr 15, 2011 at 05:28:49PM +0200, Richard Guenther wrote:
> On Fri, 15 Apr 2011, Martin Jambor wrote:
> 
> > Hi,
> > 
> > in order to speed up astar, I had to persuade the function that
> > decides whether a statement potentially modifies the dynamic type of
> > an object by storing a new value to the VMT pointer to consider the
> > following statement harmless (all types are integers of some sort):
> > 
> > MEM[(i32 *)b2arp_3(D) + 8B] = 0;
> > 
> > I'd like to experiment with this routine a bit more once I have some
> > other IPA-CP infrastructure in place but at the moment I opted for a
> > simple solution:  All scalar non-pointer stores are deemed safe.
> > 
> > VMT pointer is a compiler generated field which is a pointer so legal
> > user code is not able to store stuff there through some fancy type
> > casts and compiler generated code should have no reason whatsoever to
> > that either.  Therefore I believe this change is safe and useful.
> > 
> > I have bootstrapped and tested the patch on x886_64-linux.  OK for
> > trunk?
> 
> I think this should be only done for -fstrict-aliasing.
> 
> Ok with that change.

OK, this is what I am testing and what I intend to commit if all goes
well.

Thanks,

Martin

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

	* ipa-prop.c (stmt_may_be_vtbl_ptr_store): Return false for scalar
	non-pointer assignments.

Index: src/gcc/ipa-prop.c
===================================================================
*** src.orig/gcc/ipa-prop.c
--- src/gcc/ipa-prop.c
*************** stmt_may_be_vtbl_ptr_store (gimple stmt)
*** 405,417 ****
      {
        tree lhs = gimple_assign_lhs (stmt);
  
!       if (TREE_CODE (lhs) == COMPONENT_REF
! 	  && !DECL_VIRTUAL_P (TREE_OPERAND (lhs, 1))
! 	  && !AGGREGATE_TYPE_P (TREE_TYPE (lhs)))
  	    return false;
!       /* In the future we might want to use get_base_ref_and_offset to find
! 	 if there is a field corresponding to the offset and if so, proceed
! 	 almost like if it was a component ref.  */
      }
    return true;
  }
--- 405,423 ----
      {
        tree lhs = gimple_assign_lhs (stmt);
  
!       if (!AGGREGATE_TYPE_P (TREE_TYPE (lhs)))
! 	{
! 	  if (flag_strict_aliasing
! 	      && !POINTER_TYPE_P (TREE_TYPE (lhs)))
  	    return false;
! 
! 	  if (TREE_CODE (lhs) == COMPONENT_REF
! 	      && !DECL_VIRTUAL_P (TREE_OPERAND (lhs, 1)))
! 	    return false;
! 	  /* In the future we might want to use get_base_ref_and_offset to find
! 	     if there is a field corresponding to the offset and if so, proceed
! 	     almost like if it was a component ref.  */
! 	}
      }
    return true;
  }

  reply	other threads:[~2011-04-18 15:44 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 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: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: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 [this message]
2011-04-15 13:06 ` [PATCH 1/4] Remove usesess and wrong code from ipa_analyze_virtual_call_uses Martin Jambor
2011-04-15 15:21   ` Richard Guenther

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=20110418154421.GB3555@virgil.arch.suse.de \
    --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).