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]

[PATCH]: Fix reference counting (Wa Re: Broke swim interchangethrough aliasing)


On Sun, 2005-07-10 at 15:55 -0400, Daniel Berlin wrote:
> 
> On Sun, 2005-07-10 at 15:49 -0400, Daniel Berlin wrote:
> > It looks like we are now giving type tags to global that didn't use to
> > have type tags, and are *not* pointers.
> > 
> 
> As a followup, it looks like alias grouping went crazy and turned on
> here, when it didn't before.
> 
> It looks like we used to think for this testcase that we had 0 aliased
> vops, and now we think we have 586
> hmmmm.
> 

And here's a patch to fix it (we used to only look at regular defs when
counting refs, and now you had it looking at vdefs too).

I've just copied the old code we used to have to count the references.

I guess the other thing to do is greatly increase the total_alias_vops
limit.

But in the spirit of "no function changes", i chose this approach

Bootstrapped and regtested on i686-pc-linux-gnu.

Normally, i'd commit this myself, but since you may want to go the other
way, i'll wait for your approval.
swimfix
Okay for mainline?


2005-07-10  Daniel Berlin  <dberlin@dberlin.org>

	* tree-ssa-structalias.c (update_alias_info): Change counting of
	references to not include vdefs.
Index: tree-ssa-structalias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-structalias.c,v
retrieving revision 2.14
diff -u -p -r2.14 tree-ssa-structalias.c
--- tree-ssa-structalias.c	10 Jul 2005 00:27:51 -0000	2.14
+++ tree-ssa-structalias.c	10 Jul 2005 20:32:33 -0000
@@ -2501,9 +2501,9 @@ update_alias_info (tree stmt, struct ali
 {
   bitmap addr_taken;
   use_operand_p use_p;
-  def_operand_p def_p;
   ssa_op_iter iter;
   bool stmt_escapes_p = is_escape_site (stmt, ai);
+  tree op;
 
   /* Mark all the variables whose address are taken by the statement.  */
   addr_taken = addresses_taken (stmt);
@@ -2629,16 +2629,27 @@ update_alias_info (tree stmt, struct ali
 	}
     }
 
-  /* Update reference counter for definitions to any potentially
-     aliased variable.  This is used in the alias grouping heuristics.  */
-  FOR_EACH_PHI_OR_STMT_DEF (def_p, stmt, iter, SSA_OP_ALL_DEFS)
+  if (TREE_CODE (stmt) == PHI_NODE)
+    return;
+
+  /* Update reference counter for definitions to any
+     potentially aliased variable.  This is used in the alias
+     grouping heuristics.  */
+  FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_DEF)
     {
-      tree op = DEF_FROM_PTR (def_p);
       tree var = SSA_NAME_VAR (op);
       var_ann_t ann = var_ann (var);
       bitmap_set_bit (ai->written_vars, DECL_UID (var));
       if (may_be_aliased (var))
 	NUM_REFERENCES_INC (ann);
+      
+    }
+  
+  /* Mark variables in V_MAY_DEF operands as being written to.  */
+  FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_VIRTUAL_DEFS)
+    {
+      tree var = DECL_P (op) ? op : SSA_NAME_VAR (op);
+      bitmap_set_bit (ai->written_vars, DECL_UID (var));
     }
 }
 

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