This is the mail archive of the
mailing list for the GCC project.
[PATCH]: Fix reference counting (Wa Re: Broke swim interchangethrough aliasing)
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Diego Novillo <dnovillo at redhat dot com>
- Date: Sun, 10 Jul 2005 16:34:32 -0400
- Subject: [PATCH]: Fix reference counting (Wa Re: Broke swim interchangethrough aliasing)
- References: <firstname.lastname@example.org> <email@example.com>
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
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
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.
Okay for mainline?
2005-07-10 Daniel Berlin <firstname.lastname@example.org>
* tree-ssa-structalias.c (update_alias_info): Change counting of
references to not include vdefs.
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
- def_operand_p def_p;
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)
+ /* 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))
+ /* 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));