This is the mail archive of the 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 Ping] [RFC] Alias export patch

Hi Andrew and Diego,

Sorry for the delay in my answer. Following your suggestions, I've tried the attached patch. It gives the following statistics (gathered by write_stat calls in the patch):

C = 433 add_coalesce is called for pointers with different points-to sets
O = 523 add_coalesce is called when one pointer has a points-to set and the other has not
a = 10563 new disambiguations from extended alias sets when alias_sets_conflict_p is called
x = 1954 new disambiguations from saved points-to sets when *_dependence is called

Before the patch, it was like follows:

a = 10453
x = 2035

i.e. ~1000 chances for not coalescing meaningful pointers during a bootstrap adds 110 new disambiguations with extended alias sets, but removes 81 old ones with points-to sets. On SPECint2000 with -O3 -funroll-loops, we have:

before          after
                C = 26
                O = 52
a = 11691       a = 11691
x = 1028        x = 1035

i.e. only 78 interesting calls of add_coalesce that give us 7 new disambiguations. Given that numbers, I haven't tried to measure performance impact because it doesn't seem like a lot of new opportunities were created.

Does the patch look like what you've said? If so, maybe the problem is in the way we save information from the tree ssa side. Here's the general approach. For each pointer with non-null SSA_NAME_PTR_INFO found in tree operands, we do the following:

 mapped_ptr = var_to_partition_to_var (map, ptr);
 if (mapped_ptr)
    tse_update_var_ann_with_pts_info (mapped_ptr, pi);

where pi is the points-to info for original pointer. In the latter function we extract previously saved points-to set of mapped_ptr, if it has one, or create a brand new one if it hasn't. Then we add all vars from ptr's points-to set to the saved set of mapped_ptr.

If you have any ideas on what could be going wrong on the tree ssa side, then I'm happy to try them. If it looks ok, then I might start looking on how the saved information survives through RTL optimizers.

--- tree-ssa-live.c	(revision 19384)
+++ tree-ssa-live.c	(local)
@@ -1244,12 +1244,38 @@ add_coalesce (coalesce_list_p cl, int p1
 	      int value)
   partition_pair_p node;
+  tree t1, t2;
+  struct ptr_info_def *pi, *qi;
   gcc_assert (cl->add_mode);
   if (p1 == p2)
+  t1 = partition_to_var (cl->map, p1);
+  t2 = partition_to_var (cl->map, p2);  
+  pi = SSA_NAME_PTR_INFO (t1);
+  qi = SSA_NAME_PTR_INFO (t2);
+  if (pi && qi)
+    {
+      /* Do not coalesce when one pointer has a points-to set and 
+         the other hasn't.  */
+      if ((pi->pt_vars && !qi->pt_vars) || (!pi->pt_vars && qi->pt_vars))
+        {
+          write_stat ("O");
+          return; 
+        }
+      /* Do not coalesce when pointers have different points-to sets.  */
+      if (pi->pt_vars && qi->pt_vars 
+          && !bitmap_equal_p (pi->pt_vars, qi->pt_vars)) 
+        {
+          write_stat ("C");
+          return; 
+        }
+    }
   node = find_partition_pair (cl, p1, p2, true);
   node->cost += value;

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