diff mbox

Simplify and fix restrict handling

Message ID alpine.LNX.2.00.1110141513500.308@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Oct. 14, 2011, 1:15 p.m. UTC
This follows up Michas testcase where we fail to handle the
conservatively propagated restrict tags properly.  The following
patch simplifies handling of restrict in the oracle and thus
only excludes NONLOCAL (as designed), but not ESCAPED from
conflict checking.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2011-10-14  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-alias.h (pt_solutions_same_restrict_base): Remove.
	* tree-ssa-alias.c (ptr_derefs_may_alias_p): Remove call to
	pt_solutions_same_restrict_base.
	* tree-ssa-structalias.c (pt_solutions_same_restrict_base): Remove.
	(pt_solutions_intersect_1): Integrate restrict handling here.
diff mbox

Patch

Index: gcc/tree-ssa-alias.c
===================================================================
--- gcc/tree-ssa-alias.c	(revision 179966)
+++ gcc/tree-ssa-alias.c	(working copy)
@@ -316,11 +316,6 @@  ptr_derefs_may_alias_p (tree ptr1, tree
   if (!pi1 || !pi2)
     return true;
 
-  /* If both pointers are restrict-qualified try to disambiguate
-     with restrict information.  */
-  if (!pt_solutions_same_restrict_base (&pi1->pt, &pi2->pt))
-    return false;
-
   /* ???  This does not use TBAA to prune decls from the intersection
      that not both pointers may access.  */
   return pt_solutions_intersect (&pi1->pt, &pi2->pt);
Index: gcc/tree-ssa-alias.h
===================================================================
--- gcc/tree-ssa-alias.h	(revision 179966)
+++ gcc/tree-ssa-alias.h	(working copy)
@@ -130,8 +130,6 @@  extern bool pt_solution_singleton_p (str
 extern bool pt_solution_includes_global (struct pt_solution *);
 extern bool pt_solution_includes (struct pt_solution *, const_tree);
 extern bool pt_solutions_intersect (struct pt_solution *, struct pt_solution *);
-extern bool pt_solutions_same_restrict_base (struct pt_solution *,
-					     struct pt_solution *);
 extern void pt_solution_reset (struct pt_solution *);
 extern void pt_solution_set (struct pt_solution *, bitmap, bool, bool);
 extern void pt_solution_set_var (struct pt_solution *, tree);
Index: gcc/tree-ssa-structalias.c
===================================================================
--- gcc/tree-ssa-structalias.c	(revision 179966)
+++ gcc/tree-ssa-structalias.c	(working copy)
@@ -6079,12 +6079,15 @@  pt_solutions_intersect_1 (struct pt_solu
     return true;
 
   /* If either points to unknown global memory and the other points to
-     any global memory they alias.  */
-  if ((pt1->nonlocal
-       && (pt2->nonlocal
-	   || pt2->vars_contains_global))
-      || (pt2->nonlocal
-	  && pt1->vars_contains_global))
+     any global memory they alias.  If both points-to sets are based
+     off a restrict qualified pointer ignore any overlaps with NONLOCAL.  */
+  if (!(pt1->vars_contains_restrict
+	&& pt2->vars_contains_restrict)
+      && ((pt1->nonlocal
+	   && (pt2->nonlocal
+	       || pt2->vars_contains_global))
+	  || (pt2->nonlocal
+	      && pt1->vars_contains_global)))
     return true;
 
   /* Check the escaped solution if required.  */
@@ -6141,27 +6144,6 @@  pt_solutions_intersect (struct pt_soluti
   return res;
 }
 
-/* Return true if both points-to solutions PT1 and PT2 for two restrict
-   qualified pointers are possibly based on the same pointer.  */
-
-bool
-pt_solutions_same_restrict_base (struct pt_solution *pt1,
-				 struct pt_solution *pt2)
-{
-  /* If we deal with points-to solutions of two restrict qualified
-     pointers solely rely on the pointed-to variable bitmap intersection.
-     For two pointers that are based on each other the bitmaps will
-     intersect.  */
-  if (pt1->vars_contains_restrict
-      && pt2->vars_contains_restrict)
-    {
-      gcc_assert (pt1->vars && pt2->vars);
-      return bitmap_intersect_p (pt1->vars, pt2->vars);
-    }
-
-  return true;
-}
-
 
 /* Dump points-to information to OUTFILE.  */