OSDN Git Service

2009-02-17 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa-structalias.c
index 8b49556..8f88796 100644 (file)
@@ -1502,12 +1502,6 @@ do_sd_constraint (constraint_graph_t graph, constraint_t c,
   unsigned int j;
   bitmap_iterator bi;
 
-  if (bitmap_bit_p (delta, anything_id))
-    {
-      flag |= bitmap_set_bit (sol, anything_id);
-      goto done;
-    }
-
   /* For x = *ESCAPED and x = *CALLUSED we want to compute the
      reachability set of the rhs var.  As a pointer to a sub-field
      of a variable can also reach all other fields of the variable
@@ -1553,6 +1547,12 @@ do_sd_constraint (constraint_graph_t graph, constraint_t c,
        }
     }
 
+  if (bitmap_bit_p (delta, anything_id))
+    {
+      flag |= bitmap_set_bit (sol, anything_id);
+      goto done;
+    }
+
   /* For each variable j in delta (Sol(y)), add
      an edge in the graph from j to x, and union Sol(j) into Sol(x).  */
   EXECUTE_IF_SET_IN_BITMAP (delta, 0, j, bi)
@@ -1657,15 +1657,17 @@ do_ds_constraint (constraint_t c, bitmap delta)
          t = find (v->id);
          tmp = get_varinfo (t)->solution;
 
-         if (set_union_with_increment (tmp, sol, 0))
+            if (add_graph_edge (graph, t, rhs))
            {
-             get_varinfo (t)->solution = tmp;
-             if (t == rhs)
-               sol = get_varinfo (rhs)->solution;
-             if (!TEST_BIT (changed, t))
+                if (bitmap_ior_into (get_varinfo (t)->solution, sol))
                {
-                 SET_BIT (changed, t);
-                 changed_count++;
+                    if (t == rhs)
+                      sol = get_varinfo (rhs)->solution;
+                    if (!TEST_BIT (changed, t))
+                      {
+                        SET_BIT (changed, t);
+                        changed_count++;
+                      }
                }
            }
        }
@@ -3044,8 +3046,14 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p)
      happens below, since it will fall into the default case. The only
      case we know something about an integer treated like a pointer is
      when it is the NULL pointer, and then we just say it points to
-     NULL.  */
-  if (TREE_CODE (t) == INTEGER_CST
+     NULL.
+
+     Do not do that if -fno-delete-null-pointer-checks though, because
+     in that case *NULL does not fail, so it _should_ alias *anything.
+     It is not worth adding a new option or renaming the existing one,
+     since this case is relatively obscure.  */
+  if (flag_delete_null_pointer_checks
+      && TREE_CODE (t) == INTEGER_CST
       && integer_zerop (t))
     {
       temp.var = nothing_id;
@@ -3397,8 +3405,8 @@ do_structure_copy (tree lhsop, tree rhsop)
        {
          if (!do_simple_structure_copy (lhs, rhs, MIN (lhssize, rhssize)))
            {
-             lhs.var = collapse_rest_of_var (lhs.var);
-             rhs.var = collapse_rest_of_var (rhs.var);
+             lhs.var = collapse_rest_of_var (get_varinfo_fc (lhs.var)->id);
+             rhs.var = collapse_rest_of_var (get_varinfo_fc (rhs.var)->id);
              lhs.offset = 0;
              rhs.offset = 0;
              lhs.type = SCALAR;
@@ -4703,7 +4711,8 @@ set_uids_in_ptset (tree ptr, bitmap into, bitmap from, bool is_derefed,
             type-based pruning disabled.  */
          if (vi->is_artificial_var
              || !is_derefed
-             || no_tbaa_pruning)
+             || no_tbaa_pruning
+             || vi->no_tbaa_pruning)
            bitmap_set_bit (into, DECL_UID (vi->decl));
          else
            {
@@ -4926,6 +4935,7 @@ find_what_p_points_to (tree p)
            {
              pi->pt_vars = NULL;
              if (pruned > 0
+                 && !pi->pt_null
                  && pi->is_dereferenced
                  && warn_strict_aliasing > 0
                  && !SSA_NAME_IS_DEFAULT_DEF (p))
@@ -5496,19 +5506,8 @@ compute_points_to_sets (void)
            find_func_aliases (phi);
        }
 
-      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
-       {
-         gimple stmt = gsi_stmt (gsi);
-
-         find_func_aliases (stmt);
-
-         /* The information in GIMPLE_CHANGE_DYNAMIC_TYPE statements
-            has now been captured, and we can remove them.  */
-         if (gimple_code (stmt) == GIMPLE_CHANGE_DYNAMIC_TYPE)
-           gsi_remove (&gsi, true);
-         else
-           gsi_next (&gsi);
-       }
+      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+       find_func_aliases (gsi_stmt (gsi));
     }