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] More performance fallout from the PR33870 fix


On Mon, 29 Oct 2007, Richard Guenther wrote:

> On Mon, 29 Oct 2007, Richard Guenther wrote:
> 
> > So we might consider going for the alternative approach of forcing
> > memory partitioning to honor the operand scanners pre-requesites of
> > not partitioning SFTs of one variable separately.
> 
> The following is a reversal patch of the PR33870 fix (ontop of the
> patch I just replied to) retaining the optimization and streamlining
> work.  After this patch gcc.c-torture/execute/pr33870.c will fail
> again.

Diego asked me to apply this (thus, revert the fix for PR33870).  The
following is what I committed after bootstrapping and testing on
x86_64-unknown-linux-gnu.  The testcase is XFAILed.

Richard.

2007-10-29  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/33870
	* tree-ssa-operands.c (add_vars_for_offset): Remove mpt_vars parameter.
	(add_virtual_operand): Do not recurse into MPTs looking for pointed-to
	SFTs.

	* gcc.c-torture/execute/pr33870.x: XFAIL testcase for -O2 and -Os.

Index: pointer_plus/gcc/tree-ssa-operands.c
===================================================================
*** pointer_plus.orig/gcc/tree-ssa-operands.c	2007-10-29 18:01:17.000000000 +0100
--- pointer_plus/gcc/tree-ssa-operands.c	2007-10-29 18:03:33.000000000 +0100
*************** access_can_touch_variable (tree ref, tre
*** 1391,1397 ****
  static bool
  add_vars_for_offset (tree var,
  		     unsigned HOST_WIDE_INT offset, unsigned HOST_WIDE_INT size,
! 		     bool is_def, bitmap mpt_vars)
  {
    bool added = false;
    tree subvar;
--- 1391,1397 ----
  static bool
  add_vars_for_offset (tree var,
  		     unsigned HOST_WIDE_INT offset, unsigned HOST_WIDE_INT size,
! 		     bool is_def)
  {
    bool added = false;
    tree subvar;
*************** add_vars_for_offset (tree var,
*** 1412,1427 ****
        if (size <= SFT_OFFSET (subvar) - offset)
  	break;
  
!       /* Avoid adding a SFT that is contained in the same MPT as the
! 	 pointed-to location as this MPT will be added as alias anyway.  */
!       if (!mpt_vars
! 	  || !bitmap_bit_p (mpt_vars, DECL_UID (subvar)))
! 	{
! 	  if (is_def)
! 	    append_vdef (subvar);
! 	  else
! 	    append_vuse (subvar);
! 	}
        added = true;
      }
  
--- 1412,1421 ----
        if (size <= SFT_OFFSET (subvar) - offset)
  	break;
  
!       if (is_def)
! 	append_vdef (subvar);
!       else
! 	append_vuse (subvar);
        added = true;
      }
  
*************** add_virtual_operand (tree var, stmt_ann_
*** 1502,1535 ****
  	{
  	  tree al = referenced_var (i);
  
- 	  /* We have to consider SFTs inside MPTs as possible pointed-to
- 	     location as well because even if aliases does not contain
- 	     a single SFT, the SFTs inside the MPT may be incomplete in
- 	     that not all aliased subvars have to be in this MPT, too.
- 	     But only if we start with NMT aliases.  */
- 	  if (TREE_CODE (al) == MEMORY_PARTITION_TAG
- 	      && TREE_CODE (var) == NAME_MEMORY_TAG)
- 	    {
- 	      bitmap_iterator bi;
- 	      unsigned int i;
- 
- 	      EXECUTE_IF_SET_IN_BITMAP (MPT_SYMBOLS (al), 0, i, bi)
- 		{
- 		  tree ptsft = referenced_var (i);
- 
- 		  if (TREE_CODE (ptsft) == STRUCT_FIELD_TAG)
- 		    none_added &= !add_vars_for_offset (ptsft, offset, size,
- 							flags & opf_def,
- 							MPT_SYMBOLS (al));
- 		}
- 	    }
- 
  	  /* For SFTs we have to consider all subvariables of the parent var
  	     if it is a potential points-to location.  */
  	  if (TREE_CODE (al) == STRUCT_FIELD_TAG
  	      && TREE_CODE (var) == NAME_MEMORY_TAG)
  	    none_added &= !add_vars_for_offset (al, offset, size,
! 					        flags & opf_def, NULL);
  	  else
  	    {
  	      /* Call-clobbered tags may have non-call-clobbered
--- 1496,1507 ----
  	{
  	  tree al = referenced_var (i);
  
  	  /* For SFTs we have to consider all subvariables of the parent var
  	     if it is a potential points-to location.  */
  	  if (TREE_CODE (al) == STRUCT_FIELD_TAG
  	      && TREE_CODE (var) == NAME_MEMORY_TAG)
  	    none_added &= !add_vars_for_offset (al, offset, size,
! 					        flags & opf_def);
  	  else
  	    {
  	      /* Call-clobbered tags may have non-call-clobbered
Index: testsuite/gcc.c-torture/execute/pr33870.x
===================================================================
--- testsuite/gcc.c-torture/execute/pr33870.x	(revision 0)
+++ testsuite/gcc.c-torture/execute/pr33870.x	(revision 0)
@@ -0,0 +1,9 @@
+# The test breaks because of wrong alias info for -O2 and -Os
+
+set torture_eval_before_compile {
+  if {[string match {*-O[2s]*} "$option"]} {
+     set torture_execute_xfail "*-*-*"
+  }
+}
+
+return 0


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