This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3/4] Simple relaxation of dynamic type change detection routine


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]